[LCP]statically linking argtable and other libraries

Steve Baker ice at mama.indstate.edu
Thu Jul 8 23:08:02 UTC 2004


"Christopher Baus" <christopher at baus.net> wrote:
> Maybe I just don't understanding gcc linker, but I am a bit confused about
> static vs dynamic linking of libraries.  When I build argtable
> (http://argtable.sourceforge.net/) it produces a .a and a .so file.  If I
> delete the .so the linker statically links argtable when using the
> -largtable2 switch.  If I leave the .so's the linker dynamically links
> argtable.  How can I leave the .so and force the linker to link
> statically?  I am using the -static switch, but that doesn't seem to do
> the trick.

  Does the -static come before or after the -largtable2?  ld args are context
sensitive.  You may want to check the output of gcc -v to make sure the linker
(collect2) is getting -static before any -l's.

								- Steve



More information about the linuxCprogramming mailing list