Peter Norton wrote:
--- Waldek Hebisch hebisch@math.uni.wroc.pl wrote:
libgpc is statically linked by default.
Really? Just have tested:
$ gpc -o test hello.p $ ldd test libgpc.so => .... libm.so => .... libc.so => .... /lib/ld-linux.so.2 => ...
I should have written: in default installation gpc provides only static libgpc -- then the problem is to get the shared one. AFAICS you have modified intallation which uses shared library.
What I'm looking for:
$ ... -o test hello.p $ ldd test libm.so => .... libc.so => .... /lib/ld-linux.so.2 => ...
libraries - it's default behaviour of gpc. I have no problem to statically link ALL libraries and get a few MBs hello-world file ;-) The essence of my question is
- how to link statically libgpc only.
First, you need to have static libgpc. You write that you can link everyting statically, so I assume that you have one. Assuming that you have matching version of gcc the following should be enough to use static libgpc:
gpc -c hello.p gcc hello.o -Wl,-static -lgpc -Wl,-Bdynamic -lm
If your versions of gcc and gpc do not match that is slightly more complicated. Basically, you need to modify command used to do final linking so that it has '-static' and '-Bdynamic' around '-lgpc'. You can find out which command is used for linking by "compiling" your program with '-v' option (the last command pronted is used for linking).