3

I have compiled my program linked dynamically:

gcc -s -o foo foo.c -lcrypto

It is linked with following libraries:

linux-vdso.so.1 =>  (0x00007fff0bff5000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fd68431c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd683f91000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd683d8c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd683b75000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd68471c000)

Now I need to run it on a system, which is missing only one of the linked libraries (libcrypto.so.1.0.0).

I can compile my code as statically linked:

gcc -static -s -o foo foo.c -lcrypto

But the resulting binary is too large, apparently because it links all libraries statically.

Can I link statically only one library (libcrypto.so.1.0.0), and leave the others linked dynamically ?

Martin Vegter
  • 136
  • 9
  • 32
  • 56
  • 2
    Possible duplicate of [Telling gcc directly to link a library statically](http://stackoverflow.com/questions/6578484/telling-gcc-directly-to-link-a-library-statically) – nos Dec 25 '15 at 21:16

0 Answers0