• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Library Style -> STATIC, still linking dynamically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Library Style -> STATIC, still linking dynamically


  • Subject: Re: Library Style -> STATIC, still linking dynamically
  • From: Eric Albert <email@hidden>
  • Date: Sat, 16 Oct 2004 12:16:10 -0700

On Oct 16, 2004, at 9:40 AM, Drew McCormack wrote:

On Oct 15, 2004, at 4:50 PM, Brent Gulanowski wrote:

This is weird. I'm building with some libs that have dynamic and
static. My build style specifies Static, the linking command lacks
"-dynamic", but the dynamic versions are being used anyway. What
gives?

(If I remove one of the dynamic libs, the program won't run and get a
missing shared lib error; and i can see the Shlib in the libraries
window when I pause the debugger.)

Workaround is to temporarily hide the dynamic libraries?
This is what I have always done.
Either rename or move the dylibs out of the search path. Another option is to add the full paths of the static library files to your compile line, rather than using -l options.


I've always thought this was an ugly hack, but as far as I know, there is no other way.

By default, when you pass -lfoo ld searches your entire search path for libfoo.dylib and then, if it isn't found, ld searches for libfoo.a. If you pass the -search_paths_first flag to ld, ld will go through its search paths one at a time and search for libfoo.a in each one if libfoo.dylib isn't found in that path, then continue on to the next search path.


If you don't have libfoo.a and libfoo.dylib in the same directory, this works nicely. If you do, just use the full path to libfoo.a instead of using -lfoo.

See the ld man page for details.

Hope this helps,
Eric

_______________________________________________
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


References: 
 >Library Style -> STATIC, still linking dynamically (From: Brent Gulanowski <email@hidden>)
 >Re: Library Style -> STATIC, still linking dynamically (From: Drew McCormack <email@hidden>)

  • Prev by Date: Re: Why can't XCode remember window positions?
  • Next by Date: Re: 'Build Button' Ignored!
  • Previous by thread: Re: Library Style -> STATIC, still linking dynamically
  • Next by thread: Re: Library Style -> STATIC, still linking dynamically
  • Index(es):
    • Date
    • Thread