haberdasher
haberdasher

Reputation: 669

library not found for -lReact

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

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?

Upvotes: 8

Views: 4743

Answers (3)

Karim Mortabit
Karim Mortabit

Reputation: 692

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)

Upvotes: 4

SudoPlz
SudoPlz

Reputation: 23313

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.

Upvotes: 1

Nandam Mahesh
Nandam Mahesh

Reputation: 1278

Try to add that file to the libraries by finding libReact.a from the project, then clean and run Xcode.

or

Try to add libReact.a to your project "Build Phases" > Link binary with libraries, then clean and run Xcode.

Upvotes: 0

Related Questions