I want to compile a shared library to other developers, but without shipping source code.
The .so file I built against g++ 4.6, but they used g++ 4.4.
When they linked with my .so file, g++ reported: undefined reference to ‘memcpy@GLIBC_2.14’.
I think there are two possible solutions:
-
I rebuild my shared library which do not depends on specified GLIBC version.
-
Tell them a simple way to link with my shared library with some compiler options to make it work.
I have no idea in both methods, how can I achieve these solutions or one of them?
Thanks.
Edit:
I found a link flag: -static-libgcc
Does that help if I build my shared library with this option? Any drawback?
Finally, I add these options to make it without depends on any shared libraries.
The ldd reports ‘static linked’, and no any required .so files.
This might be useful for anyone who want to ship portable shared library.