How to force the use of static libs when the dylib is present?

Member
Posts: 257
Joined: 2004.06
Post: #1
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.

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
Member
Posts: 257
Joined: 2004.06
Post: #3
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. Smile

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

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
drop the -l
Quote this message in a reply
Member
Posts: 257
Joined: 2004.06
Post: #5
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).

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Dylib problem ugriffin 2 4,061 Apr 20, 2011 05:28 PM
Last Post: ugriffin
  Cocoa fundamentals - the message loop in a dylib bumperman 5 5,779 Nov 8, 2009 11:17 AM
Last Post: OneSadCookie
  XCode doesn't realize a library has changed unless you force your project to build. XSTNX 6 5,712 Jun 8, 2009 10:25 AM
Last Post: XSTNX
  how to debug a dylib? sakiel 1 3,981 Aug 16, 2007 07:26 PM
Last Post: OneSadCookie
  Linking to dylib in xCode Jones 6 5,524 Jun 26, 2006 02:08 PM
Last Post: OneSadCookie