Hello,
A few years ago I was managed to create dynamically linked executables with statically linked libgpc (or even only some objects from the lib the program used). Now I have needs to make it again but unfortunately I cann't recall the process :-( The only things I remember - the program was compilled as object first and then linked with ld to executable. I still have system.o and gpc.o in that program's folder and beleive they was involved in process somehow. Could anyone help me with ideas?
Thanks in advance, Peter
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Peter Norton wrote:
A few years ago I was managed to create dynamically linked executables with statically linked libgpc (or even only some objects from the lib the program used). Now I have needs to make it again but unfortunately I cann't recall the process :-( The only things I remember - the program was compilled as object first and then linked with ld to executable. I still have system.o and gpc.o in that program's folder and beleive they was involved in process somehow. Could anyone help me with ideas?
libgpc is statically linked by default. You should be able to find your message (and answers) in mailing list archive.
In particular, you sent:
http://www.gnu-pascal.de/crystal/gpc/en/mail9810.html
and I think in the ansers you got instuctions how to _dynamically_ link libgpc.
Hello,
--- 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 => ...
What I'm looking for:
$ ... -o test hello.p $ ldd test libm.so => .... libc.so => .... /lib/ld-linux.so.2 => ...
You should be able to find your message (and answers) in mailing list archive.
In particular, you sent:
http://www.gnu-pascal.de/crystal/gpc/en/mail9810.html
and I think in the ansers you got instuctions how to _dynamically_ link libgpc.
Before asking my question I have scanned the archive but didn't found an answer. I didn't found an answer in the link you provided as well. As you see in above I have no problems with creating of dynamically linked 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.
Thanks, Peter
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
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).
Hello,
--- Waldek Hebisch hebisch@math.uni.wroc.pl wrote:
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
Yes, Waldek. That's is! Thank you very much.
Peter.
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com