Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Static libraries building in wrong folder

I've setup cocoapods for my project and I've been doing development for quite some time without any issues. Recently I added a new Configuration for it called "Beta", duplicating the "Release" configuration. At the same time, I added a Scheme that would build targets using this configuration.

This new scheme would build everything without issues, but linking would fail with the (quite known it seems) message:

ld: library not found for -lPods

I know that issues that makes this error message come up have been discussed widely around the web, with different causes and conditions:

  • library not found for -lPods
  • https://github.com/CocoaPods/CocoaPods/issues/155

None of these fixes seem to apply here. What I can see by looking into the workspace folder, is that Cocoapods build products are put in Build/Products/Release-iphonesimulator instead of in Build/Products/Beta-iphonesimulator, even though the app itself is built rightly so into the latter. Moving all the *.a files into Build/Products/Beta-iphonesimulator makes running in the simulator work properly, but the next build is still put in the wrong location.

Edit

After some further investigations, the environment variable $BUILT_PRODUCTS_DIR is set correctly in the build phase for the app itself, but not when building cocoapods products.

What causes this and how can I fix this?

Ruled out issues

  • pod install has been run, multiple times
  • I'm working in the workspace, not in the project
  • The cocoapods configuration file in the new configuration is properly set

enter image description here

  • Build locations in the preferences seem fine

enter image description here

like image 948
matehat Avatar asked Aug 04 '13 14:08

matehat


1 Answers

For the record, the issue has been solved. So, as I said, I use cocoapods, but my current setup is that a single podfile, and workspace is used for 3 projects that share some common libraries. As explained in this issue, cocoapods will only consider one project out of all those that are specified in the podfile, and it turns the one project (out of three) that it was using, didn't have the beta configuration, so it didn't feel the need to prepare for it. So when it was time to build the project with the beta configuration, cocoapods would be built for the release configuration, and put in some folder specific to release, so the beta project wouldn't be able to find it.

Fixing was a matter of creating the beta configuration for all projects present in the workspace, forcing cocoapods to prepare accordingly. Then, Xcode would be able to wire up everything appropriately.

like image 145
matehat Avatar answered Nov 15 '22 06:11

matehat