• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

g++ - Force shared libraries to be linked as static??

Armitage

Banned
I'm trying to run an executable on a machine that doesn't have the peoper shared libraries installed (libmysqlclient FWIW)?

I've tried copying the library in question to my home directory and add the path to it to LD_LIBRARY_PATH. This worked for libg2c, but it's not working for libmysqlclient.

Is there anyway to fore the linker to threat the library as a staic library at build time, so it's right there in the executable?
Any other ideas?

It is such a PITA working on a system I don't have root on :| especially when the guy that does have it is gone till Monday :disgust:
 
Holy executable size batman!
But it worked! Not sure how I missed that looking through the man pages on Wed. ... I guess my brain was already on vacation.
Thanks.
 
Originally posted by: Armitage
Holy executable size batman!
But it worked! Not sure how I missed that looking through the man pages on Wed. ... I guess my brain was already on vacation.
Thanks.

I hear ya. I went the easier route and looked into something I knew could be static to see how it built. 😛
 
It probably didn't work because libmysqlclient also depends on a handfull of other libraries.

ldd /usr/lib/libmysqlclient.so.10
libz.so.1 => /usr/lib/libz.so.1 (0x70050000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x70074000)
libnsl.so.1 => /lib/libnsl.so.1 (0x700b0000)
libm.so.6 => /lib/libm.so.6 (0x700d4000)
libc.so.6 => /lib/libc.so.6 (0x70168000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x08000000)
 
Originally posted by: Nothinman
It probably didn't work because libmysqlclient also depends on a handfull of other libraries.

ldd /usr/lib/libmysqlclient.so.10
libz.so.1 => /usr/lib/libz.so.1 (0x70050000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x70074000)
libnsl.so.1 => /lib/libnsl.so.1 (0x700b0000)
libm.so.6 => /lib/libm.so.6 (0x700d4000)
libc.so.6 => /lib/libc.so.6 (0x70168000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x08000000)

It's not smart enough to go down the list and grab everything it needs?
 
Originally posted by: n0cmonkey
Originally posted by: Nothinman
It probably didn't work because libmysqlclient also depends on a handfull of other libraries.

ldd /usr/lib/libmysqlclient.so.10
libz.so.1 => /usr/lib/libz.so.1 (0x70050000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x70074000)
libnsl.so.1 => /lib/libnsl.so.1 (0x700b0000)
libm.so.6 => /lib/libm.so.6 (0x700d4000)
libc.so.6 => /lib/libc.so.6 (0x70168000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x08000000)

It's not smart enough to go down the list and grab everything it needs?

Well it would be if they were present on the system. When I hacked things around in my original try, I only copied over the libmysqlclient file. I didn't think to check for dependencies from that library.
 
It's not smart enough to go down the list and grab everything it needs?

g++ -static should be, but his original attempt was to copy the necessary libraries and use LD_LIBRARY_PATH to have the dynamic linker find them in a non-standard directory.
 
Originally posted by: Nothinman
It's not smart enough to go down the list and grab everything it needs?

g++ -static should be, but his original attempt was to copy the necessary libraries and use LD_LIBRARY_PATH to have the dynamic linker find them in a non-standard directory.

It appears I'm not smart enough to follow a thread. 😛

I get it now. 🙂
 
Back
Top