
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:
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
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:
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/

Robin Becker wrote:
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:
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

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

Robin Becker wrote:
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
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:
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/

Robin Becker wrote:
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:
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

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
participants (4)
-
John J. Lee
-
M.-A. Lemburg
-
Robin Becker
-
Thomas Heller