Skip to content

Fix the Redefinition of 'NativeXXXSpecJSI' error with Frameworks#44005

Closed
cipolleschi wants to merge 1 commit intofacebook:mainfrom
cipolleschi:export-D55925605
Closed

Fix the Redefinition of 'NativeXXXSpecJSI' error with Frameworks#44005
cipolleschi wants to merge 1 commit intofacebook:mainfrom
cipolleschi:export-D55925605

Conversation

@cipolleschi
Copy link
Copy Markdown
Contributor

Summary:
When using frameworks on iOS, there is a possibility that modules import the Spec.h file twice and this might end up in a Redefinition of some symbols and duplication of symbols which ends up in build errors, as reported here: #42670.

This change adds some #include guards in codegen to avoid the redefinition of those symbols if the header is imported/included multiple times.

Note: I also experimented with #pragma once, but it looks like Apple is not happy with that directive. It seems that it started working flakely from Xcode 15.

Changelog:

[General][Fixed] - Make sure that we can't include Codegen symbols multiple times

Differential Revision: D55925605

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Apr 9, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D55925605

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Apr 9, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,400,687 -4
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,776,100 -3
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 27ef6cd
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D55925605

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D55925605

…ebook#44005)

Summary:

When using frameworks on iOS, there is a possibility that modules import the Spec.h file twice and this might end up in a Redefinition of some symbols and duplication of symbols which ends up in build errors, as reported here: facebook#42670.

This change adds some [`#include guards`](https://en.wikipedia.org/wiki/Include_guard) in codegen to avoid the redefinition of those symbols if the header is imported/included multiple times.

Note: I also experimented with `#pragma once`, but it looks like Apple is not happy with that directive. [It seems](https://forums.developer.apple.com/forums/thread/739964) that it started working flakely from Xcode 15.

## Changelog:
[General][Fixed] - Make sure that we can't include Codegen symbols multiple times

Differential Revision: D55925605
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D55925605

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 46b6453.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 11, 2024
@github-actions
Copy link
Copy Markdown

This pull request was successfully merged by @cipolleschi in 46b6453.

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants