When linking against libraries using the -l
option (say -lfoo
), gcc will prefer a shared object to a static library if both are found (will prefer
Just add the .a
file to the link line without -l
as if it were a .o
file.
It's dated, but may work: http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html
(almost end of the page)
"As noted earlier, it is also possible to link directly with individual library files by specifying the full path to the library on the command line."
You can specify the full path to the static libs without the -l
flag to link with those.
gcc ... source.c ... /usr/lib32/libmysuperlib.a ...