1
General / Hidden symbols when static linking
« on: June 11, 2018, 05:27:23 am »
Hello,
I use SFML in my project Cryptokernel for networking (https://github.com/mit-dci/CryptoKernel). I'm trying to produce static binaries for distribution on Linux, and whilst I have this working on Windows, I cannot link SFML statically on Linux.
I used the following to build SFML:
But when linking my project (with -DSFML_STATIC):
Using nm it doesn't seem to be hidden though:
I would appreciate a pointer as to what could be going wrong here.
Thanks,
James
I use SFML in my project Cryptokernel for networking (https://github.com/mit-dci/CryptoKernel). I'm trying to produce static binaries for distribution on Linux, and whilst I have this working on Windows, I cannot link SFML statically on Linux.
I used the following to build SFML:
Code: [Select]
git clone https://github.com/SFML/SFML.git
cd SFML
cmake . -DBUILD_SHARED_LIBS=NO -DSFML_BUILD_DOC=NO -DSFML_BUILD_AUDIO=NO \
-DSFML_BUILD_GRAPHICS=NO -DSFML_BUILD_WINDOW=NO -DSFML_BUILD_EXAMPLES=NO \
-DCMAKE_BUILD_TYPE=Release
make && make install
cp /usr/local/lib/libsfml-network-s.a /usr/local/lib/libsfml-network.a && cp /usr/local/lib/libsfml-system-s.a /usr/local/lib/libsfml-system.a
But when linking my project (with -DSFML_STATIC):
Code: [Select]
/usr/bin/x86_64-linux-gnu-ld: ckd: hidden symbol `_ZN2sf9IpAddress15getLocalAddressEv' in /usr/local/lib/libsfml-network.a(IpAddress.cpp.o) is referenced by DSO
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Using nm it doesn't seem to be hidden though:
Code: [Select]
...
U _ZN2sf4priv10SocketImpl13invalidSocketEv
U _ZN2sf4priv10SocketImpl5closeEi
U _ZN2sf6SocketD2Ev
0000000000000460 T _ZN2sf9IpAddress15getLocalAddressEv
00000000000009a0 T _ZN2sf9IpAddress16getPublicAddressENS_4TimeE
0000000000000010 B _ZN2sf9IpAddress3AnyE
0000000000000018 B _ZN2sf9IpAddress4NoneE
...
I would appreciate a pointer as to what could be going wrong here.
Thanks,
James