Static link to Sunstudio

I am trying to link my xxx library with the yyy library. I want to link statically so that I don't have to package yyy along with xxx when I deliver xxx. I have two versions of yyy provided by a third party: libyyy.so and libyyyln.a. So here I go and link with -lyyyln.

I don't get an error when I link. The yyyln dependency does not show up when I do "ldd libxxx.so". But "ldd -r libxxx.so" shows that characters from yyy are not allowed. "nm libxxx.so" indicates that these characters from yyy are UNDEF.

What am I missing then?

Edit1: I managed to get it to work eventually with "-l / fullpath / libyyyln.a"

0


a source to share


5 answers


You want to put -Bstatic

in front of the libraries you want to set a static link with. Learn more about the Solaris Linkers and Libraries Guide .



+3


a source


You could ask this question on the Sun Studio forum and got the answers directly from the Sun Studio compiler team



Sun Studio Forums (for C, C ++, Fortran and tools)

+1


a source


I am assuming you are using gcc. By default, gcc will use shared libraries (.so) if possible, so you should make it statically reference the -static option.

Edit: Sorry, I thought sunstudio was the name of the library you are trying to link, I forgot that Sun Studio includes a compiler. However, there should be a similar option for a solar studio.

0


a source


0


a source


I managed to get it to work eventually with "-l / fullpath / libyyyln.a"

I've played around with -Bstatic and -Bdynamic with no success. The solution was really simple like the one above. I should have thought about this before.

0


a source







All Articles