11

I have just added cocoapods to my project, but cannot get my build script working again. I use this command to make the build:

xcodebuild -workspace MyProject.xcworkspace -scheme MyScheme SYMROOT=./build

However, when I perform the build, it fails with the error message ld: library not found for -lPods.

If I build without the SYMROOT set, it works fine. But I would prefer keeping the SYMROOT argument such that I can keep my archiving logic the same way as before.

My conclusion so far is, that because SYMROOT is set, xcodebuild cannot find the Pods library that was built. How can I fix this?

Edit:

I have investigated the file structure after the build a little:

  1. If I do not set SYMROOT, there is a libPods.a file in the folder with the binaries (Library/Developer/Xcode/DerivedData/MyProject-eegsyonkmltdqhggwyqytoqbwath/Build/Products/).
  2. If I set the SYMROOT as described above, the libPods.a file is not present in ./build

Hence, it seems that the output of the build of the pod files are not set properly. Is it a problem in xcodebuild then, or is there a way that I can ensure that the pod files are built to this folder?

The following image shows a comparison of the build output in the two directories to make it more clear: Comparison of build output

JRV
  • 1,702
  • 1
  • 17
  • 27
  • Are you building with ONLY_ACTIVE_ARCHS=NO ? xcodebuild doesn't set that by default – MishieMoo Feb 06 '14 at 17:30
  • Yes, ONLY_ACTIVE_ARCHS has been set to NO in the project file. Please also see my edit to the question above. – JRV Feb 07 '14 at 08:52

1 Answers1

46

Instead of using xcodebuild -workspace MyProject.xcworkspace -scheme MyScheme SYMROOT=./build

Try with this line:

xcodebuild -workspace MyProject.xcworkspace -scheme MyScheme SYMROOT=$(PWD)/build

Hope this will help you.

Explanations here.

Community
  • 1
  • 1
dkrdennis
  • 575
  • 5
  • 4
  • 2
    It actually worked. The only difference is ./build is replaced with $(PWD)/build. So it sends an absolute path to xcodebuild instead of a relative path. There is something rotten.... :-) – JRV Feb 13 '14 at 19:30
  • I came here searching for a completely different problem, namely the "resource envelope is obsolete" problem and this finally solved everything ... Thanks a lot! – Evils Sep 23 '14 at 17:08
  • This is low, even for Xcode (7.2). No error message or anything either, it just doesn't build the pod projects and then fails with a linking error – Earlz Mar 08 '16 at 22:04
  • This still didn't work for me, I still get an error:
    `ld: library not found for -lFontAwesomeKit clang: error: linker command failed with exit code 1 (use -v to see invocation)`
    – Matthew Jul 03 '17 at 14:00
  • Had made some changes to the project settings - just did `git reset --hard HEAD` and tried this again and it worked. – Matthew Jul 03 '17 at 14:25