Re: Not finding libraries
Re: Not finding libraries
- Subject: Re: Not finding libraries
- From: Alex Zavatone <email@hidden>
- Date: Thu, 29 Dec 2016 16:03:33 -0600
HOWARD! Guess what I just finished? Fixing pretty much the same thing.
What if you put quotes around the whole path? Does Xcode still mangle it?
Also, if you are just entering in the full path name to where the static libs are for the release and debug builds, you'll want to use the build environment variables instead.
On iOS, I have a framework that keys off of the $PRODUCT_NAME environment variable and picks the proper info.plist, .pch, .entitlements and all the icon and launch screen images, which I call "Branding Assets".
The idea here is by setting all of these (+ any search paths) based off of the build environment variables, all I need to do to create a new branded app for another licensee, is to duplicate the target app, change the product's name and copy all the required components in to a folder that has that same name.
Now, if you're already fried from dealing with the search path joy, the last thing you want to do is start digging in to what all the build environment variables are.
But that's EASY to find out.
Select your target app in the your Build Phases for your app, then click the + above your build phases and add a Run Script. In the field, simply enter "export" without quotes.
You can rename the Run Phase too and I call mine "Log Environment Variables".
Build your app.
Press Command 8 and select the latest build output. At the bottom of your build, you will see the names of all the build environment variables and their values.
Something like this is a lifesaver when trying to solve these issues and make well formed search paths.
Also, if you get sick of seeing this output all the time, just put a # in front of the export text and it will be commented out.
I hope this helps you out.
Cheers,
Alex Zavatone
On Dec 29, 2016, at 11:40 AM, Howard Moon wrote:
> I’ve been having some troubles with including static libraries (.a files) in my project. I have one set of libraries that I need for Debug and one for Release builds.
>
> Initially, the problem was that the paths to two of the libraries includes spaces in it. I was using “Other Linker Flags” to include the libraries, and quoting the paths so that they would remain as one item, both in the settings in the Xcode UI, and in the actual link step.
>
> However, every time I opened the project, the paths were getting mangled, adding ‘\’ escape characters in my settings before each of the quotes and spaces in those libraries’ paths. That in turn caused the linker to fail to find the libraries. Apparently it likes to add the escape characters itself, and did not like their inclusion in the paths in the settings.
>
> On top of that, the NEXT time I opened the project, ANOTHER escape character would be added before (after?) each ‘\’! And this would keep going, adding more and more escape characters each time I open the project.
>
> So, instead of putting the paths in the Other Linker Flags settings themselves, I decided to put just the library names there, and put the paths in Library Search Paths (with quotes).
>
> Now, though, even though I can see that the linker statement includes the correct -L<path> for each of those paths, it fails to find my libraries.
>
> And to top it off, THESE settings ALSO add those stupid escape characters every time I open the project!
>
> So, how in the heck to I add different versions of those libraries for my Debug versus Release builds, and also deal with spaces in the paths to them (and in the library name itself, in one case)?
>
> Thanks,
> Howard
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden