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

Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load #23823

Closed

Conversation

tomduncalf
Copy link
Contributor

@tomduncalf tomduncalf commented Mar 8, 2019

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 PRs:

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.

Changelog

[iOS] [Fixed] - Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load

Test Plan

react-native init project compiles and links with -force_load flag as described in #23645

@pull-bot
Copy link

pull-bot commented Mar 8, 2019

Messages
📖

📋 Changelog Format - Did you include a Changelog? A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

CATEGORY may be:
  • General
  • iOS
  • Android

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

Generated by 🚫 dangerJS against 58b0125

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 8, 2019
@tomduncalf tomduncalf changed the title Remove duplicated compile sources to prevent "duplicate symbols" erro… Remove duplicated Yoga compile sources to prevent "duplicate symbols" errors when linking using -force_load Mar 8, 2019
@kelset kelset requested review from cpojer and dulmandakh March 8, 2019 14:46
@kelset
Copy link
Contributor

kelset commented Mar 8, 2019

cc @SidharthGuglani & @davidaurelio too

@hramos
Copy link
Contributor

hramos commented Mar 8, 2019

Thanks for the fix. I'll import this and ask for a review from the original authors.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @tomduncalf in cecd307.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Mar 11, 2019
grabbou pushed a commit that referenced this pull request Mar 11, 2019
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Linking CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[0.59rc2 blocking] Can't compile React Native on iOS using -force_load instead of -ObjC any more
6 participants