library not found for -lRCTOrientation

Viewed 1115

I'm very beginner in React Native, I build a mobile application which is working OK an android, but when I tried to generate the IPA for iOS using Xcode, I faced this issue

ld: library not found for -lRCTOrientation
clang: error: linker command failed with exit code 1 (use -v to see invocation).

RCTOrientation is shown in red color and i can't find this package in my project folder

enter image description here

1 Answers

Try:

1)

  • in Xcode make sure you have followed these 3 steps:

a) Add node_modules/react-native-orientation/iOS/RCTOrientation.xcodeproj to your xcode project, usually under the Libraries group

enter image description here

It should show up somewhere in a list like this:

b) add libRCTOrientation.a (from Products under RCTOrientation.xcodeproj) to build target's Linked Frameworks and Libraries list

It should show somewhere in a list like this:

enter image description here

c) Add $(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/ to Project Name -> Build Settings -> Header Search Paths

Make sure that path is correct, in my case I had to add /../ inside it, as above for my RN project, the rn-orientation docs specify that without /../.

  • in Xcode go to Product menu and run Clean build folder
  • run react-native run-ios

If it still doesn't work try

2) Xcode go to Product menu, Schemes, Edit schemes, Build and make sure parallelized build is NOT enabled in Build Options enter image description here

If it still doesn't work:

3) try to clean all the caches and restart npm:

rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules && yarn install && npm start -- --reset-cache

If you don't have yarn installed just replace yarn word with npm in the above command.

Source for Xcode add library steps: https://github.com/yamill/react-native-orientation

UPDATE: RN 0.60+ supports autolinking and after installing the library with yarn or npm, running a pod install in ios folder, a cache clean, a JS server restart and a rebuild should fix such issues.

Related