Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

library not found for -lReact

Tags:

react-native

I'm getting this error in all my app builds now and I can't seem to figure it out.

  • I am using the .xcworkspace file
  • I had to rename the app. Used: react-native-app-id ...

  • This morning I was able to build/run on emulator. I tried to setup xcode to run on an actual device and now the universe hates me.

  • I can't even react-native start and react-native run-ios without getting these errors:

    ld: warning: directory not found for option '-L/Users/gmike/Projects/promiscue/tribeoffive/TribeOfFive/ios/build/Build/Products/Debug-iphonesimulator/React' ld: library not found for -lReact clang: error: linker command failed with exit code 1 (use -v to see invocation)

    ** BUILD FAILED **

    The following build commands failed: Ld build/Build/Products/Debug-iphonesimulator/tribe-of-five.app/tribe-of-five normal x86_64

    (1 failure)

    Installing build/Build/Products/Debug-iphonesimulator/tribe-of-five.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to install the requested application The bundle identifier of the application could not be determined. Ensure that the application's Info.plist contains a value for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not Exist

    Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/tribe-of-five.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist

I've checked out a bunch of other stackoverflow articles.

I think this is telling: enter image description here

Thoughts on how to un-mess up my env?

like image 927
haberdasher Avatar asked Jun 26 '18 18:06

haberdasher


2 Answers

The error goes away when you remove libReact.a from the Xcode file tree (for me, it was under the Frameworks folder).

I also removed other files (they all had a transparent/white overlay on them which probably mean they were missing, actually couldn't open them in the finder neither)

like image 90
Karim Mortabit Avatar answered Oct 09 '22 01:10

Karim Mortabit


Ok let's resolve this:

What to look for:

Here's a list of all the sub projects (or their products) that will cause XCode to throw that error when building a react-native project w/ cocoapods:

[
RCTActionSheet,
ART,
RCTBlob,
RCTCameraRoll,
RCTGeolocation,
RCTImage,
RCTLinking,
RCTAnimation,
RCTNetwork,
RCTPushNotification,
RCTTest,
RCTSettings,
RCTText,
RCTVibration,
RCTWebSocket,
]

Where to look for those weird project names:

First of all you'll look in the actual error message. Here's a typical library not found error

Notice the ... /libART.a part? That fellow is causing that error on my end.

In your case it can be any of the strings in the array above.

Found the troublemaker, what to do now?

Step 1: Remove the troublemaker project.

  • Let's try the lucky shot first:

Open the Project Navigator, and check if you can see the linked project that corresponds to the troublemaker string. In my case it was an XCode project called ART. If you find it there, just remove it's reference, and you should be fine.

  • If that didn't work:

    Open {Project Target} > Build Phases > Link binary with libraries and check wether you can see the troublemaker string in there. (It could be something like libArt.a depending on what's causing the issue on your end)

If that worked, forget the next step, otherwise move on:

Step 2: Delete the derived data directory, clean and rebuild

In my case (as seen in the raw error above) the derived data directory was /Users/sudoplz/Library/Developer/Xcode/DerivedData/MySuperApp-haxjchilyksewvdfcnnxwrulvyvy/Build/Products/Debug-iphonesimulator/

find yours in the error log, and delete it. You can then clean XCode, shut it down, launch it again, and re-build.

Hopefully that should either fix the issue, or help you move on with fixing other stuff that may have gone wrong.

That's all folks.

like image 23
SudoPlz Avatar answered Oct 09 '22 00:10

SudoPlz