-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fix RCT-Folly build error when use_frameworks! and hermes are both enabled #34030
Conversation
Base commit: e5c5dcd |
Base commit: e5c5dcd |
cc @dmitryrykun this is to fix another case when use_frameworks and hermes are both enabled. context: reactwg/react-native-releases#21 (reply in thread) |
@dmitryrykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@Kudo great, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff @Kudo 👍
This pull request was successfully merged by @Kudo in 79baca6. When will my fix make it into a release? | Upcoming Releases |
…abled (facebook#34030) Summary: This PR is fixing the build errors on iOS when `use_frameworks!` and `:hermes_enabled` are both enabled. There are two errors: - fmt/compile.h include not found: This PR adds fmt in header search paths. - undefined symbols `_jump_fcontext` and `_make_fcontext` from boost. the two symbols are actually not be unused. because to generate the shared library in dynamic framework mode, LTO (Link-Time-Optimization) is not as powerful as generating a single executable. ## Changelog [iOS] [Fixed] - Fix RCT-Folly build error when use_frameworks! and hermes are both enabled Pull Request resolved: facebook#34030 Test Plan: - CI passed - ``` $ npx react-native init RN069 --version next # edit RN069/ios/Podfile to enable use_frameworks! and hermes_enabled # patch node_modules/react-native from both facebook#34011 and this prs' patch $ pod install $ yarn ios ``` Reviewed By: cortinico Differential Revision: D37284084 Pulled By: dmitryrykun fbshipit-source-id: 923fa03d7844d1d227880919c8b2c8614c848d59 (cherry picked from commit 79baca6)
…abled (#34030) Summary: This PR is fixing the build errors on iOS when `use_frameworks!` and `:hermes_enabled` are both enabled. There are two errors: - fmt/compile.h include not found: This PR adds fmt in header search paths. - undefined symbols `_jump_fcontext` and `_make_fcontext` from boost. the two symbols are actually not be unused. because to generate the shared library in dynamic framework mode, LTO (Link-Time-Optimization) is not as powerful as generating a single executable. ## Changelog [iOS] [Fixed] - Fix RCT-Folly build error when use_frameworks! and hermes are both enabled Pull Request resolved: #34030 Test Plan: - CI passed - ``` $ npx react-native init RN069 --version next # edit RN069/ios/Podfile to enable use_frameworks! and hermes_enabled # patch node_modules/react-native from both #34011 and this prs' patch $ pod install $ yarn ios ``` Reviewed By: cortinico Differential Revision: D37284084 Pulled By: dmitryrykun fbshipit-source-id: 923fa03d7844d1d227880919c8b2c8614c848d59
Will this fix be backported to RN 0.68? Or only available in the 0.69 release track? |
It's possible to do this one via patch-package - it would be part of this one (which was a separate use_frameworks issue) https://github.com/mikehardy/rnfbdemo/blob/main/patches/react-native%2B0.69.0.patch Just this part |
Looks like this fix introduced a new issue when building to a real iOS device mikehardy/rnfbdemo#10 |
Confirmed - finally got a chance to check this, thank you so much for reporting this and cross-linking @raghavyadavm ! This unfortunately was a workaround for the I have not tested the case where use_frameworks is absent, but I fear it may break as well @Kudo this is a problem and I'm not sure how to solve it. I thought "well, those symbols are from the boost_context library" (which I discovered after some searching),
So I'm a bit lost on how to repair it but I think we're about to get a lot of attention re: the 0.69.1 release |
@mikehardy I can confirm I'm also facing this new -U and BITCODE_ENABLED issue after using the suggested patch package |
Sorry to hear about that of course. It looked like a real advance (Hermes available in use_frameworks context) but...Yep, since react-native 0.69.1 just went out with this I expect to explode in user recognition in 3....2... |
I'm going to do a revert PR and propose the cherry-pick on reactwg/react-native-releases#24 (comment) - a real repair would obviously be better but I'll just post it up in case it is useful |
@mikehardy Yikes sorry to see this is getting ugly. My only concern right now is I wasn't actually on 0.69.1, but rather just patching 0.68.2. Hopefully I'll be able to patch whatever fix is developed |
I did a fresh app init and and it will build to real devices
So the patch clearly has a problem, but Possible workarounds:
|
thanks for the good catch! i'm afraid there's no easy solution. for bitcode, apple requires all symbols to be defined, so that they can recompile optimized code. the so far some workaround are:
|
Oh this bitcode disable link is really unexpected!
Thanks for that link. I was the under impression that bitcode was how they did app thinning and was a best practice + I have been recommending it and how to work with it in relation to uploading dSYMS for crash reporting systems (like I will need to research more but...how are they doing app thinning then? Or are they just no longer doing app thinning? (update: looks like they only have one CPU arch now, so it is not needed https://stackoverflow.com/questions/72543728/xcode-14-deprecates-bitcode-but-why/72552590) Either way, sounds like the "proper" solution here is actually to advice people that if they want We could make a doctor check that looked for use_frameworks && bitcode-enabled combination perhaps and produce an error This will serve as a workaround in Podfile - post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end |
Disabling the Bitcode doesn’t seems to be working with libraries like Reanimated. I ended up using the above option 1 which solved the issue |
I think (correct me if I'm wrong) the correct version of this statement is: Disabling Bitcode allowed the compilation and linking to progress farther at which point issues with Reanimated in The assumption is that bitcode is actually unrelated to a reanimated build issue but the linkage style is? |
Yes you are correct. use_frameworks with static linkage is fixing this issue. |
This Patch does not work on 0.68.2. With |
I think it's important to understand that all work at getting |
Updated to Still undefined symbols With |
@n1tesh that's a very unexpected result. The patch put into 0.69.1 explicitly defines those symbols via linker directives. They are explicit. That makes me think your test is somehow not testing what you think it is testing. That sounds vague and is borderline unhelpful but the point is to triple-check all your steps, make sure you |
Hi Team,
Below is the project configuration
Please suggest us. Thanks |
@rahulgpt1 there is no expectation this will work below react-native 0.69.1
|
Hi Mike, As you said hermes wouldn't work in RN version 0.68.2, but you people resolved this issue in RN version 0.69.1 so I updated my RN version to 0.69.1 but it still gives the same error undefined symbol for "_jump_fcontext" & "_make_fcontext". System Detail:
Pod File Configuration Details:
Thanks |
If you are not using This issue is titled: "Fix RCT-Folly build error when use_frameworks! and hermes are both enabled" Either way, all this modular_headers business is not something I support for react-native-firebase at least, not sure about your dependencies but for react-native-firebase it's
Bitcode must be disabled. And that's the future anyway, Xcode 14 no longer supports it, the app store does not accept bitcode, and no platforms use it anymore, but build systems still have it in sometimes. I use the standard Podfile snippet that has been posted in a few places to disable it as a build setting in Podfile postinstall |
Hi Mike, I have raised a new issue entitled with Undefined symbols for architecture x86_64: "_jump_fcontext" & "_make_fcontext" . Please have a look at #34982 Thanks |
I am not able to draw a clear conclusion from this thread, so I just ask (a possible misformulated question); Does firebase >= v 15.0.0 support react-native 0.69+ and hermes, or do we still have to stick with firebase 14.11+ (or put in another way; is it now possible to use use_frameworks! with hermes (in podfile)?) |
https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh --> react-native 0.70.6 + react-native-firebase v16.n.n + hermes (note @rahulgpt1 you need |
thank you @mikehardy for your demo. After some trial and error I got it to work in my project. I noticed there where several changes in the Podfile. Are these temporary solutions or will these be kept in future releases (as far as you know). I also noticed this; $RNFirebaseAsStaticFramework = true. I guess this is important but I cant see where its used/referenced (?). Would you consider this solution production ready? |
I consider my script the "current gold standard" for whatever the current version of react-native and react-native-firebase is. The Podfile variable you mentioned about static frameworks is used internally in react-native-firebase podspec files to alter linking a little bit |
Hi Team,
There is no problem with the Android upgrade, but there is a "pod install" execution problem with iOS:1.CocoaPods could not find compatible versions for pod "RNFBApp"
2.CocoaPods could not find compatible versions for pod "FirebaseCoreExtension"
3.The Swift pod
and XCode compilation issues:1."/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp:2285:9 Use of bitwise '|' with boolean operandsCast one or both operands to int to silence this warning"
2."/ios/Pods/Headers/Public/React-Core/React/RCTBridge.h:24:1 Unknown type name 'RCT_EXTERN'in file included from"
3."/node_modules/react-native-device-info/ios/RNDeviceInfo/DeviceUID.m:7:1 Use of '@import' when modules are disabled"
4."/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRHeartbeatLogger.m:26:8 Receiver type 'FIRHeartbeatsPayload' for instance message is a forward " Tried |
Summary
This PR is fixing the build errors on iOS when
use_frameworks!
and:hermes_enabled
are both enabled. There are two errors:_jump_fcontext
and_make_fcontext
from boost. the two symbols are actually not be unused. because to generate the shared library in dynamic framework mode, LTO (Link-Time-Optimization) is not as powerful as generating a single executable.Changelog
[iOS] [Fixed] - Fix RCT-Folly build error when use_frameworks! and hermes are both enabled
Test Plan
CI passed