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

Re: static libraries


  • Subject: Re: static libraries
  • From: Andreas Grosam <email@hidden>
  • Date: Tue, 25 Oct 2005 17:46:30 +0200

I have 2 different things, first a questions, and secondly a suggestion.

1) Does somebody know for a fact how ld orders the search paths specified with the command -L option?
The man says, that it "adds" the search path to the search list, but where? At the tail, at the top or elsewhere?


There is already an option to affect dylib search paths with option -dylib_file. But this does not apply for static libs, too.


2) Another option to resolve search paths ambiguity would be to use a link-file-list. However, such a file is generated by Xcode, and we have no control about this.
From the man:
-filelist listfile[,dirname]
Specifies that the linker should link the files listed in list-
file . This is an alternative to listing the files on the com-
mand line.The file names are listed one per line separated only
by newlines. (Spaces and tabs are assumed to be part of the file
name.) If the optional directory name, dirname is specified, it
is prepended to each name in the list file.


Why does Xcode just not put *all* linked objects into the link-file-list?

Suppose, my App links against Carbon framework, libfreetype (dynamically), libz (dynamically) and my customized png library (statically) which is located in my project folder. Suppose *all* libraries have been dragged into the project so that the app gets linked with them. The content of the link-file-list could look like this:

foo.o, <object_root>
bar.o, <objec_root>
libpng.a, /my/path/to/project/mylibs
libz.dylib, /opt/local/bin
libfreetype.dylib, /opt/local/bin
Carbon.framework, <system_path>


This above would eliminate the ambiguity of library search paths and it also would not require to specify any library search path in the build settings.
So, even when there is a library libpng.dylib in /opt/local/lib ld shouldn´t select it, but libpng.a in the customer search path.



Any pitfalls which come into mind? Otherwise, I would appreciate it very much if Xcode could manage this task for us.




Regards
Andreas



On 25.10.2005, at 15:56, Peter O'Gorman wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

james tittle wrote:
| ...just thought I'd mention a simple (non-xcode) way around this: just
| create a folder called "libs" or "staticlibs" and fill it with symbol
| links ("ln -s /path/to/staticlib.a staticlib.a") to your
| favorite/needed static libraries...then just include the path to this
| folder when linking...this makes all the dylib mix up go away :-)
|


Hi,

This will not work if you have a dylib installed somewhere else along the
linker search path. Ld , by default, searches all of its search paths for
files of the form lib<name>.dylib, then starts again at the beginning and
looks for lib<name>.a. the -search_paths_first flag was added at some point
to allow this to work. With this flag specified, ld will look in each of its
search paths for lib<name>.dylib, then lib<name>,a before moving on to the
next path.


i.e. your system, with -search_paths_first works fine.

Peter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iQCVAwUBQ145jriDAg3OZTLPAQLdJwP+LJgL/F4LCJfo/SA9JYFPPxzEUtPFNDhv
LJ8Fp6g6YHxJUFLKRqygM7k/x6y4tFrKIm0o1Xb8TtvQCFbQiqh0v/rmqptbFrn3
QJCCsd+qKNrmDi7ThIEGXD8AfWvt9HFORs+S6D1Pf/Fdjf5qMyVpZSMkR2qdQrGZ
XMnvA659yj8=
=Fx6e
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ 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: static libraries
      • From: Steve Checkoway <email@hidden>
References: 
 >static libraries (From: Steve Checkoway <email@hidden>)
 >Re: static libraries (From: Andreas Grosam <email@hidden>)
 >Re: static libraries (From: Steve Checkoway <email@hidden>)
 >Re: static libraries (From: james tittle <email@hidden>)
 >Re: static libraries (From: "Peter O'Gorman" <email@hidden>)

  • Prev by Date: Re: Choosing the 3.3 compiler in Xcode
  • Next by Date: Re: Thread viewer tool ?
  • Previous by thread: Re: static libraries
  • Next by thread: Re: static libraries
  • Index(es):
    • Date
    • Thread