6

I am working on a project that was previously done and uploaded on app store.When I run this app in Xcode 5.0 it is working fine but when I run this on Xcode Version 5.1.1 (5B1008) I am getting Linker error on both device and simulator.

Error Message- Library not found for -llib. (clang: error: linker command failed with exit code 1 (use -v to see invocation)).

I have searched a lot but I didn't get any thread about Library not found for -llib error. Is there anything I have to change in build settings to resolve this?

Ujitha Perera
  • 25
  • 1
  • 7
Imran
  • 1,715
  • 2
  • 20
  • 42

3 Answers3

11

Look at the linker command line in detail for the -L options being used:

enter image description here

Then use Terminal or Finder to see if your libXXX.a file exists in those directories. If the library exists elsewhere then you need to configure your Library Search Paths:

enter image description here

However there several details which you have not provided in your question when using a library within an app:

  • Is the library built as part of the Xcode project/workspace (as in the first image)?
  • Is the library supplied by a third-party with binary (.a) and header files (as in the second image)?
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Thanks! Was stuck on a similar iOS library link error, it helped. :) – Out Of Office May 06 '16 at 10:10
  • it's now 2016 and this topic frees me out from all the headache! Should mark this as an answer – Merkurial Jun 17 '16 at 08:15
  • @trojanfoe All the libraries were generated by Xcode and none of them was supplied by a third party (.a) . Can you suggest solution for this scenario. I have same error using latest reat native and xcode – catBuddy Aug 06 '23 at 03:19
0

TL;DR: I ran make in the wrong directory so the paths were messed up.

Problem:

>make
linking ../build/release/yubikey-personalization-gui
/usr/x86_64-suse-linux/bin/ld: cannot find -llib
...

I ran into this when compiling the Yubikey Personalisation Tool. I tracked down the -llib call in my Makefile which looked like this:

...
LINK = @echo linking $@ && g++
...
LIBS = $(SUBLIBS)  -L/usr/lib64 -L../lib/release -llib -lyubikey -lykpers-1 -lQtGui -L/usr/lib64 -L/usr/X11R6/lib -lQtCore -lpthread 
...
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

So it was setting a variable called LINK which would print "linking" and then call g++, which is the compiler. Then it set the var LIBS which would hold the ominous -llib. Then it composes and runs the command $(LINK) ... $(LIBS). Which runs g++ with the parameter -llib.

And what does that do? Turns out -l<something> is telling the compiler to use the something-library. So it asks for the library called lib here. Which is strangely generic. I figured out that the sources came with a directory called lib/, which was at ../lib.

So starting make from a directory higher up fixed it.

Chris
  • 5,788
  • 4
  • 29
  • 40
0

You should remove libstdc++ from other linker flags in your xcode project

https://stackoverflow.com/a/53103383/1344237

iosMentalist
  • 3,066
  • 1
  • 30
  • 40