
How do I specify a static library. I have libraries=['gd'], but I don't seem to load symbols from libgd.a instead I have to use libraries=['libgd.a'] is that right? -- Robin Becker

Robin Becker wrote:
How do I specify a static library. I have libraries=['gd'], but I don't seem to load symbols from libgd.a instead I have to use libraries=['libgd.a'] is that right?
No, you should use the first variant. The compiler will then either take the correspopnding .so file or .a file with a preference for the shared object file (at least that's what gcc does). See distutils/ccompiler.py for details. In general it is a better idea to link to shared libs since these provide more flexibility on the user side. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/

In article <3A70387D.9E87B195@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes
Robin Becker wrote:
How do I specify a static library. I have libraries=['gd'], but I don't seem to load symbols from libgd.a instead I have to use libraries=['libgd.a'] is that right?
No, you should use the first variant. The compiler will then either take the correspopnding .so file or .a file with a preference for the shared object file (at least that's what gcc does).
See distutils/ccompiler.py for details.
In general it is a better idea to link to shared libs since these provide more flexibility on the user side.
Well when I'm using the first form I don't seem to get the relevant things included in my final shared object. I use nm -a and the thinsg that would come from libgd.a are marked U (ie undefined). Our ISP changed up to 4.1.1 FreeBSD and now I'm having lot's of problems. -- Robin Becker

Robin Becker wrote:
In article <3A70387D.9E87B195@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes
Robin Becker wrote:
How do I specify a static library. I have libraries=['gd'], but I don't seem to load symbols from libgd.a instead I have to use libraries=['libgd.a'] is that right?
No, you should use the first variant. The compiler will then either take the correspopnding .so file or .a file with a preference for the shared object file (at least that's what gcc does).
See distutils/ccompiler.py for details.
In general it is a better idea to link to shared libs since these provide more flexibility on the user side.
Well when I'm using the first form I don't seem to get the relevant things included in my final shared object. I use nm -a and the thinsg that would come from libgd.a are marked U (ie undefined).
That's because the linker put a reference to the shared lib libgd.so into the final shared object. ldd ./module.so will show where the dynamic linker looks for the libgd.so file.
Our ISP changed up to 4.1.1 FreeBSD and now I'm having lot's of problems.
Ah, so you do want to link using the static lib ? This should be possible by placing the 'libgd.a' into the objects option: objects = ['libgd.a'] -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/

In article <3A705090.BFA90C16@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ....
Ah, so you do want to link using the static lib ? This should be possible by placing the 'libgd.a' into the objects option:
objects = ['libgd.a']
OK that's nice, any idea how to create .a (win32 .lib) files using distutils. Even my .a files have to be rebuilt. -- Robin Becker

Robin Becker wrote:
In article <3A705090.BFA90C16@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ....
Ah, so you do want to link using the static lib ? This should be possible by placing the 'libgd.a' into the objects option:
objects = ['libgd.a']
OK that's nice, any idea how to create .a (win32 .lib) files using distutils. Even my .a files have to be rebuilt.
I don't know how well it works, but the build_clib command is supposed to support this. The PIL example in the distutils distribution makes use of this command, AFAIR. BTW, I think the correct option name is "extra_objects" -- I read the code and didn't try this out. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/

On Thu, 25 Jan 2001, M.-A. Lemburg wrote:
Robin Becker wrote:
In article <3A705090.BFA90C16@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ....
Ah, so you do want to link using the static lib ? This should be possible by placing the 'libgd.a' into the objects option:
objects = ['libgd.a']
OK that's nice, any idea how to create .a (win32 .lib) files using distutils. Even my .a files have to be rebuilt.
I don't know how well it works, but the build_clib command is supposed to support this. The PIL example in the distutils distribution makes use of this command, AFAIR. [...]
I think I used libraries = [blah blah] but that was for shared libraries, and I can't remember what you put in the list. Look in the subdirectory in the source (there's only one) in build_clib.py or something similar. The source is extremely readable. John

In article <Pine.SOL.4.30.0101262133140.4140-100000@mimosa.csv.warwick.a c.uk>, John J. Lee <phrxy@csv.warwick.ac.uk> writes
On Thu, 25 Jan 2001, M.-A. Lemburg wrote:
Robin Becker wrote:
In article <3A705090.BFA90C16@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ....
Ah, so you do want to link using the static lib ? This should be possible by placing the 'libgd.a' into the objects option:
objects = ['libgd.a']
OK that's nice, any idea how to create .a (win32 .lib) files using distutils. Even my .a files have to be rebuilt.
I don't know how well it works, but the build_clib command is supposed to support this. The PIL example in the distutils distribution makes use of this command, AFAIR. [...]
I think I used
libraries = [blah blah]
but that was for shared libraries, and I can't remember what you put in the list. Look in the subdirectory in the source (there's only one) in build_clib.py or something similar. The source is extremely readable.
John
extra_objects=['libgd.a'] works for me, but I still don't know how to define a clib and get it built as part of an extension. -- Robin Becker

On Fri, 26 Jan 2001, Robin Becker wrote:
In article <Pine.SOL.4.30.0101262133140.4140-100000@mimosa.csv.warwick.a c.uk>, John J. Lee <phrxy@csv.warwick.ac.uk> writes [...]
I think I used
libraries = [blah blah]
but that was for shared libraries, and I can't remember what you put in [...]
No it wasn't. Sorry, I'm new to all this library building stuff as you can tell, and I'm not entirely clear on the machinery. libraries=[stuff] does build .a's. I'll check later today what exactly 'stuff' is.
extra_objects=['libgd.a'] works for me, but I still don't know how to define a clib and get it built as part of an extension. [...]
John

setup( ....., libraries = [ ("mylib", {"sources": ["source/1.c", "source/2.c"], "include_dirs": ["source/include"], "macros": [("_WINDOWS", None)], }, ), ], ......) builds a static library which you can pass to your extensions module. Thomas

In article <002c01c089c8$ebab7200$e000a8c0@thomasnotebook>, Thomas Heller <thomas.heller@ion-tof.com> writes
setup( ....., libraries = [ ("mylib", {"sources": ["source/1.c", "source/2.c"], "include_dirs": ["source/include"], "macros": [("_WINDOWS", None)], }, ), ], ......)
builds a static library which you can pass to your extensions module.
Thomas
that's what I'm looking for. -- Robin Becker
participants (4)
-
John J. Lee
-
M.-A. Lemburg
-
Robin Becker
-
Thomas Heller