• 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: Mark Lively <email@hidden>
  • Date: Mon, 5 Dec 2005 15:48:26 -0500

Anyone have any ideas?

This worked great but I recently upgraded to Xcode 2.2 and I am now
getting "unrecognized option -search_paths_first" from gcc 4.0.1

On 9/9/05, Eric Albert <email@hidden> wrote:
> 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

  • Follow-Ups:
    • Re: Statically linking libraries
      • From: Michael Rawdon <email@hidden>
  • Prev by Date: vecLib link warning
  • Next by Date: Mysterious error... to a newbie
  • Previous by thread: vecLib link warning
  • Next by thread: Re: Statically linking libraries
  • Index(es):
    • Date
    • Thread