View Full Version : How to force the use of static libs when the dylib is present?
Malarkey
2006.10.12, 01:46 AM
Okay, now this is just frustrating. :mad: :mad: :mad: I'm trying to use libcurl for a project I'm working on but I want it to link to the latest version of libcurl I built myself. However, Mac OSX comes with dylibs to an older version of libcurl, which apparently, XCode will link to over the static libs. After some scouring of the forums, it seems the only solution is to rename the dylibs so that XCode can't find them and then use the static version instead.
So my question now is, has anyone figured out a way around this without renaming the dylib? Besides using XCode, that is.
OneSadCookie
2006.10.12, 05:23 AM
Pass the full absolute path to the .a file to the linker. Use the "extra linker flags" or whatever it's called. Don't add the library to your Xcode project.
Malarkey
2006.10.12, 12:16 PM
Okay, that seemed to do the trick for release builds but not debug ones. Ah well, good enough. The debug builds can use the dylibs. :)
Edit: Or not... Sheesh. Once I renamed the dylibs back to their original names, it started linking to them again. Okay, time to do some more poking around. This is what I'm passing under "Other Linker Flags": -l/Users/vtagle/libcurl/lib/libcurl.a
OneSadCookie
2006.10.12, 04:23 PM
drop the -l
Malarkey
2006.10.12, 08:33 PM
Oh... Okay. Yeah, that did the trick. Thanks!
For the record, if you're trying to statically link libcurl, you'll also need to link to libssl and libcrypto (from the openssl package).
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.