• 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: Statically linking libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Statically linking libraries


  • Subject: Re: Statically linking libraries
  • From: Eric Albert <email@hidden>
  • Date: Fri, 9 Sep 2005 12:45:00 -0700

On Sep 9, 2005, at 10:29 AM, Mark Lively wrote:

There are a few libraries (libcurl for one) that I want to statically
link into my application.  Unfortunately xcode finds the dylib and
links that instead.  Well in addition but the links all point to the
dylib.

Anyway to force a library to link statically?

First, you have to have the static version of the library in a different directory from the dynamic version. Next, pass the directory with the static library earlier to the linker than the directory with the dynamic library. Once you have that done, you can pass the -search_paths_first flag to the linker. From the ld man page:


-search_paths_first
By default when the -dynamic flag is in effect, the -lx and
-weak-lx options first search for a file of the form
`libx.dylib' in each directory in the library search path, then
a file of the form `libx.a' is searched for in the library
search paths. This option changes it so that in each path
`libx.dylib' is searched for then `libx.a' before the next path
in the library search path is searched.


In Xcode, this would be "-Wl,-search_paths_first" under Other Linker Flags.

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: 
 >Statically linking libraries (From: Mark Lively <email@hidden>)

  • Prev by Date: How can I break into debugger?
  • Next by Date: Re: How can I break into debugger?
  • Previous by thread: Statically linking libraries
  • Next by thread: How can I break into debugger?
  • Index(es):
    • Date
    • Thread