-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
[0.59rc2 blocking] Can't compile React Native on iOS using -force_load
instead of -ObjC
any more
#23645
Comments
-force_load
instead of -ObjC
any more-force_load
instead of -ObjC
any more
-force_load
instead of -ObjC
any more-force_load
instead of -ObjC
any more
Thank you! |
@hramos do you know the status of this issue? Is there anyone working on it? We decided to hold with making 0.59 stable before there's more context here. |
👋 @tomduncalf - can I ask you one thing? Is this issue reproducible if you test from master? I feel that maybe also looking at the commit history for the file involved may help (maybe there have been subsequent commits that already fixed the issue but we didn't notice them) |
@kelset Going to check for you now! |
@kelset It still happens but I think I might know what is wrong... testing something out and I'll submit a PR if I can fix |
@tomduncalf - that would be 🔥 Let us know 🤗 |
So I tracked down a fix, but I think it needs looking at by someone intricately familiar with how the C++ side of React Native/Yoga to check that it wouldn't have any unintended side effects: #23823 |
That's awesome, thank you so much @tomduncalf - I've already tagged quite a few people over in the PR so that we can try to have it reviewed & merged by early next week and cherry pick before 0.59.0 🙏 |
Happy to help @kelset, just |
… errors when linking using -force_load (#23823) Summary: This change fixes #23645. The issue is that the `YGMarker.cpp`, `YGValue.cpp`, `YGConfig.cpp` and `log.cpp` files are already included in the Yoga compilation unit, so including these files in React's compile sources too results in "duplicate symbols" errors when loading React Native with `-force_load` (which behaves slightly differently to `-ObjC` - according to a colleague, "ObjC will scan through each object file in each library and force linking of any object file that contains Objective C code, while force_load will link every object file in a particular staticlib (regardless of whether or not the object file contains Objective C code)"). These changes seemed to be introduced by a few commits: - D13819111 -> 43601f1 - D13439602 -> b5c66a3 - D14123390-> e8f95dc - D7530369 -> 95f625e Perhaps we need to check with the original authors/any C++ experts to confirm if this fix is correct - it compiles for me but I'm not sure what the original intention of these changes was. [iOS] [Fixed] - Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load Pull Request resolved: #23823 Reviewed By: davidaurelio Differential Revision: D14387657 Pulled By: hramos fbshipit-source-id: d85221b6dc1a0377662624f4201b27222aed8219
🐛 Bug Report
Our project can't use the
-ObjC
linker flag to discover/load all symbols as it causes "duplicate symbol" errors for some of the static libraries we use (ObjC
is all-or-nothing flag, so we can't opt these out of it, and the "duplicate symbols" are valid as we depend on the same shared library from multiple other libraries). As RN depends on this behaviour, the alternative is to use-force_load
for each library that needs to be loaded in this way and specify the path to the compiled (.a
) library.With 0.58 this compiles fine, but with 0.59rc2 it results in "duplicate symbol" errors for some Yoga references in
libReact.a
:Please let me know if you'd like more help looking into this issue or reproducing it - this would be a blocking issue for our project as we can't compile with
-ObjC
.To Reproduce
Remove
-ObjC
from and add-force_load libReact.a
to the "Linker Flags" section of Xcode, with the correct path tolibReact.a
(see below)Clean and build, error will be displayed
I've created a repro case: https://github.com/tomduncalf/rn0.59-force-load-bug - in the interest of keeping the project simple, the path to
libReact.a
needs to be manually changed in "Linker Flags", you can discover it by going to~/Library/Developer/Xcode/DerivedData
and looking for the directory startingforceLoad59rc2-....
then replacing the existing one with this path (feels like there should be a$(..)
variable pointing to this location but I've never found it!).There is also a
rn@0.58
branch in that repo to show it compiles OK in the current release version - you may need to "Clean Build Folder" and/or clear the DerivedData folder to see the change when switching branches.Expected Behavior
Project compiles with no errors as in 0.58
Code Example
https://github.com/tomduncalf/rn0.59-force-load-bug
Environment
The text was updated successfully, but these errors were encountered: