Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCT-Folly linker error: ld: -U and -bitcode_bundle cannot be used together #34148

Closed
ptreitler opened this issue Jul 6, 2022 · 13 comments
Closed
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. Type: Upgrade Issue Issues reported from upgrade issue form

Comments

@ptreitler
Copy link

ptreitler commented Jul 6, 2022

New Version

0.69.1

Old Version

0.66.3

Build Target(s)

iPhone 7

Output of react-native info

info Fetching system and libraries information...
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 334.64 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.6.0 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: ^18.0.0 => 18.0.0
react-native: 0.69.1 => 0.69.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Issue and Reproduction Steps

After updating react-native (via https://react-native-community.github.io/upgrade-helper/?from=0.66.3&to=0.69.1) and all Pods I receive the following compile error when building for a device (running on a simulator works fine):

› Linking   react-native Pods/RCT-Folly » folly
1395

❌  ld: -U and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

1396

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Not using New Architecture or flipper, but use_frameworks! is active in my Podfile (and hasn't been before the update - rnfirebase requires it with the current version).

@ptreitler ptreitler added Needs: Triage 🔍 Type: Upgrade Issue Issues reported from upgrade issue form labels Jul 6, 2022
@raghav-mylagary
Copy link

Here are some details around this issue mikehardy/rnfbdemo#10

@ptreitler
Copy link
Author

@raghavyadavm thanks a lot for the quick response! I'll try the workarounds mentioned in that issue.

@mikehardy
Copy link
Contributor

For anyone else that stumbles on here, we think you can summarize the path forward as:

  • Xcode 14 deprecates bitcode and basically refuses to use it (the App Store refuses to accept it certainly, per their docs)
  • Disabling bitcode removes one of the two flags that are incompatible with each other, so...
  • Disable bitcode in your project and re-try, should work

...although you are now at the leading edge of where a few of us are, and it may still be a bit of a bumpy road getting hermes to work with use_frameworks as it has not really ever worked before so some other subtle issues may pop up. Please help us push it forward by testing + trying what you can and reporting your reproducible results

@egealpay
Copy link

egealpay commented Aug 3, 2022

Setting ENABLE_BITCODE=YES in PodFile resolves this error, but creates a new one which is caused by react-native-permissions.

Here is the error message:

Permission-Camera/libPermission-Camera.a(Permission-Camera-dummy.o)' does not contain bitcode. 
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. 

Any possible solution?

@mikehardy
Copy link
Contributor

disable bitcode is the path forward, apple is no longer using it (never really was apparently...) and will disallow it in future even.

should work if you disable bitcode https://stackoverflow.com/a/73219854/9910298

@fernandosev
Copy link

Setting ENABLE_BITCODE=YES in PodFile resolves this error, but creates a new one which is caused by react-native-permissions.

Here is the error message:

Permission-Camera/libPermission-Camera.a(Permission-Camera-dummy.o)' does not contain bitcode. 
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. 

Any possible solution?

@fernandosev
Copy link

Enabling Hermes and not using post install works for me

@efkan
Copy link

efkan commented Sep 1, 2022

Day by day, overcoming this issue takes longer than before.
I tried out a lot of things but got stuck here.

I cannot try "enabling Hermes" because I use Firebase Crashlytics.

Is there any update?

@fernandosev
Copy link

I needed to downgrade RN version to 0.68.2. The version 0.69.XX was still bugging. 😕

@marquina-abreu
Copy link

same problem ... -U and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

I disabled enable_bitcode both to false and still nothing... the error persists only when running on a real iphone or when archive build
.

@Minishlink
Copy link
Contributor

Make sure to disable Bitcode in Xcode settings for every project/targets, and also add this in your Podfile inside postinstall (where react_native_post_install is)

installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    # Bitcode is deprecated by Apple
    config.build_settings['ENABLE_BITCODE'] = 'NO'
  end
end

Ashoat added a commit to CommE2E/comm that referenced this issue Oct 3, 2022
Summary:
Addresses [ENG-1938](https://linear.app/comm/issue/ENG-1938/ashoat-cant-locally-build-ios-release-build-for-version-145-targeting). Learned more about this issue [here](facebook/react-native#34148 (comment)).

This diff effectively reverts D30. Back then, the default was `ENABLE_BITCODE = YES`, and that diff had the effect of disabling bitcode for debug builds. Now that `ENABLE_BITCODE = NO` is the default, that diff has the effect of enabling bitcode for release builds.

Deleting these lines puts us back to "default" behavior, which is now to have bitcode disabled.

Test Plan: Issue no longer occurs after `yarn workspace native clean-all && yarn cleaninstall`

Reviewers: atul

Reviewed By: atul

Subscribers: tomek, abosh

Differential Revision: https://phab.comm.dev/D5277
@kelset kelset added Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. and removed 📦Bundler labels Apr 6, 2023
Copy link

github-actions bot commented Feb 9, 2024

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 9, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. Type: Upgrade Issue Issues reported from upgrade issue form
Projects
None yet
Development

No branches or pull requests

10 participants