question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

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

See original GitHub issue

šŸ› 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:

screenshot 2019-02-25 at 18 10 14

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

  1. Remove -ObjC from and add -force_load libReact.a to the ā€œLinker Flagsā€ section of Xcode, with the correct path to libReact.a (see below)

  2. 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 starting forceLoad59rc2-.... 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

    System:
      OS: macOS 10.14.2
      CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 126.19 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.7.0 - ~/.nvm/versions/node/v10.7.0/bin/node
      Yarn: 1.10.1 - ~/.yarn/bin/yarn
      npm: 6.1.0 - ~/.nvm/versions/node/v10.7.0/bin/npm
      Watchman: 4.7.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 10, 16, 23, 24, 26, 27, 28
        Build Tools: 28.0.0, 28.0.3
        System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5264788
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.1 => 16.8.1
      react-native: 0.59.0-rc.2 => 0.58.5
    npmGlobalPackages:
      react-native-cli: 2.0.1```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
hramoscommented, Feb 25, 2019

Thank you!

1reaction
tomduncalfcommented, Mar 8, 2019

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found