Cannot build with makefile-x86-static on debianAnswered

The following is the error message. 

TurboActivate.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_10bad_alloc_EEEED0Ev[_ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_10bad_alloc_EEEED5Ev]+0x18): undefined reference to `operator delete(void*, unsigned int)'

/usr/bin/ld: ../../bin-linux/x86/libTurboActivate.a(TurboActivate.o): unrecognized relocation (0x2b) in section `.text._ZN5boost6system12system_errorD2Ev[_ZN5boost6system12system_errorD5Ev]'

Answer

Use -lstdc++

I still got the same errors after adding -lstdc++.   FYI, my gcc version: gcc (Debian 4.9.2-10+deb8u2) 4.9.2

g++ -Os -s -ffunction-sections -fdata-sections -DNDEBUG -DTURBOACTIVATE_STATIC -m32 -Wl,--gc-sections -lstdc++ -o ../../bin-linux/x86/example.out example.o ../../bin-linux/x86/libTurboActivate.a -lrt -lpthread

../../bin-linux/x86/libTurboActivate.a(TurboActivate.o): In function `boost::detail::sp_counted_impl_p<boost::exception_detail::clone_impl<boost::exception_detail::bad_exception_> >::~sp_counted_impl_p()':

TurboActivate.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_14bad_exception_EEEED0Ev[_ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_14bad_exception_EEEED5Ev]+0x18): undefined reference to `operator delete(void*, unsigned int)'

../../bin-linux/x86/libTurboActivate.a(TurboActivate.o): In function `boost::detail::sp_counted_impl_p<boost::exception_detail::clone_impl<boost::exception_detail::bad_alloc_> >::~sp_counted_impl_p()':

TurboActivate.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_10bad_alloc_EEEED0Ev[_ZN5boost6detail17sp_counted_impl_pINS_16exception_detail10clone_implINS2_10bad_alloc_EEEED5Ev]+0x18): undefined reference to `operator delete(void*, unsigned int)'

/usr/bin/ld: ../../bin-linux/x86/libTurboActivate.a(TurboActivate.o): unrecognized relocation (0x2b) in section `.text._ZN5boost6system12system_errorD2Ev[_ZN5boost6system12system_errorD5Ev]'

/usr/bin/ld: final link failed: Bad value

collect2: error: ld returned 1 exit status

makefile-x86-static:8: recipe for target '../../bin-linux/x86/example.out' failed

make: *** [../../bin-linux/x86/example.out] Error 1

Ok, you're on an old version of Debian (no security patches for the last couple of years). Use a newer version with a newer compiler. Or just use the dynamic libraries.

, edited