g++ cannot link to libdl even with -ldl flag - c++

I am attempting to compile an example application for a USB camera (mvBlueFOX) sold by Matrix Vision. They provide me with the source code for the application, a make file, and a set of pre-compiled shared libraries. However, the make file fails to successfully build an executable. A "make" returns:
carter#carter-Lenovo-G780:~/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap$ make
make[1]: Entering directory `/home/carter/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap/x86'
/usr/bin/g++ -O2 -Wall -W -fPIC -D_REENTRANT -D_GNU_SOURCE -D_MAJOR_VERSION=1 -D_MINOR_VERSION=12 -D_BUILD_VERSION=22 -D_BUILD2_VERSION=254 -DMALLOC_TRACE -DNDEBUG -I../../.. -o LiveSnap LiveSnap.o -L../../../lib/x86 -lmvDeviceManager -lmvPropHandling -lm -lpthread -ldl
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlsym'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlopen'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[1]: *** [LiveSnap] Error 1
make[1]: Leaving directory `/home/carter/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap/x86'
make: *** [all] Error 2
A simplified version of the link command:
g++ -o LiveSnap x86/LiveSnap.o -lmvDeviceManager -ldl
Still returns:
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlsym'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlopen'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlclose'
libdl.so is being found, however the process still fails. Is this an issue with my version of libdl or is there another problem?

If your gcc version is above 4.6.2 just add the flag '-Wl,--no-as-needed' before -lmvDeviceManager

For those interested in a work around to this problem, I was able to successfully build and run a newer version of the code that I downloaded from the Movie-Matrix website. The version provided on the CD with my camera was 1.2.22 while the version from the website was 2.5.2. Why the older version fails to build is still unknown, but the problem seems to be solved in newer versions of the software.

Related

Eclipse C/C++ : Cross compile Linker error for external libraries: Ubuntu VM amd64 to Ubuntu armhf ( Raspberry Pi)

Setup:
Host:-- amd64 VM hosting Ubuntu Mate 15.10 with Eclipse Mars x64 installed. Also Linaro x64 toolchain installed
Target:-- armhf Ubuntu Mate 15.10 Raspberry Pi
Issue
I am trying to cross compile an existing code I found on git
However I am unable to do so due to linker error.
The project, has a compiled lib mqtt3as.so which looks for libcrypt and libssl. Those are not found by linker. I should mention that I tried below steps..
-- Git code builds fine on Raspberry Pi
-- Host to Target cross compiler works fine with Hello_world code. Deploy and Debug works
-- NFS mounted /lib and /usr/lib from Raspi to toolchainx64/lib folder
but nothing changes. I understand that the issue is related to linker unable to find the libraries. I have tried to follow all possible advice I googled. Below is log from eclipse on host. I can share verbose log if needed.
Literally run out of ideas now. I have unix experience ..but that was years ago and fairly new to eclipse. Still if need arise, I can learn and explore.
Log
18:18:50 **** Build of configuration Default for project prj_c ****
make all
Building file: ../cJSON.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"cJSON.d" -MT"cJSON.o" -o "cJSON.o" "../cJSON.c"
Finished building: ../cJSON.c
Building file: ../cpustat.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"cpustat.d" -MT"cpustat.o" -o "cpustat.o" "../cpustat.c"
../cpustat.c: In function ‘GetCPULoad’:
../cpustat.c:68:10: warning: implicit declaration of function ‘sleep’ [-Wimplicit-function-declaration]
sleep(1);
^
../cpustat.c:63:11: warning: unused variable ‘dump’ [-Wunused-variable]
char dump[50];
^
Finished building: ../cpustat.c
Building file: ../iotmain.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"iotmain.d" -MT"iotmain.o" -o "iotmain.o" "../iotmain.c"
../iotmain.c: In function ‘main’:
../iotmain.c:75:6: warning: unused variable ‘lckStatus’ [-Wunused-variable]
int lckStatus;
^
../iotmain.c: In function ‘trim’:
../iotmain.c:266:2: warning: implicit declaration of function ‘isspace’ [-Wimplicit-function-declaration]
while (isspace(*(++frontp)))
^
../iotmain.c: In function ‘get_config’:
../iotmain.c:291:17: warning: unused variable ‘str2’ [-Wunused-variable]
char str1[10], str2[10];
^
../iotmain.c:291:7: warning: unused variable ‘str1’ [-Wunused-variable]
char str1[10], str2[10];
^
Finished building: ../iotmain.c
Building file: ../jsonReader.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"jsonReader.d" -MT"jsonReader.o" -o "jsonReader.o" "../jsonReader.c"
Finished building: ../jsonReader.c
Building file: ../jsonator.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"jsonator.d" -MT"jsonator.o" -o "jsonator.o" "../jsonator.c"
Finished building: ../jsonator.c
Building file: ../mac.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"mac.d" -MT"mac.o" -o "mac.o" "../mac.c"
Finished building: ../mac.c
Building file: ../mqttPublisher.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -I"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c" -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"mqttPublisher.d" -MT"mqttPublisher.o" -o "mqttPublisher.o" "../mqttPublisher.c"
../mqttPublisher.c: In function ‘subscribeMessage’:
../mqttPublisher.c:117:6: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../mqttPublisher.c:126:10: warning: ‘command’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sprintf(command,"sudo /sbin/shutdown -r %d", time_delay);
^
Finished building: ../mqttPublisher.c
Building target: prj_c
Invoking: Cross G++ Linker
arm-linux-gnueabihf-g++ -L"/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib" -o "prj_c" ./cJSON.o ./cpustat.o ./iotmain.o ./jsonReader.o ./jsonator.o ./mac.o ./mqttPublisher.o -lpaho-mqtt3as
/home/k/dev/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libcrypto.so.1.0.0, needed by /home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so, not found (try using -rpath or -rpath-link)
/home/k/dev/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libssl.so.1.0.0, needed by /home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so, not found (try using -rpath or -rpath-link)
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_get_error#OPENSSL_1.0.0'
makefile:44: recipe for target 'prj_c' failed
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_load_verify_locations#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_alert_desc_string_long#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_msg_callback#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_get1_session#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_write#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `CRYPTO_THREADID_set_numeric#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `ERR_get_error#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_alert_type_string_long#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_default_passwd_cb#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CIPHER_get_name#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_load_error_strings#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_default_passwd_cb_userdata#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_new#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `CRYPTO_set_locking_callback#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `OPENSSL_add_all_algorithms_noconf#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_use_PrivateKey_file#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_library_init#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_get_current_cipher#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_cipher_list#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_default_verify_paths#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_shutdown#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_connect#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_get_cipher_list#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSLv23_client_method#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_use_certificate_chain_file#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `ERR_print_errors_fp#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_info_callback#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_set_session#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_new#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `CRYPTO_THREADID_set_callback#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `CRYPTO_num_locks#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_free#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_read#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSLeay_version#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `ERR_load_crypto_strings#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_get_verify_result#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_free#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_ctrl#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_pending#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_CTX_set_verify#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_state_string_long#OPENSSL_1.0.0'
/home/k/dev/workspace/iot/iot-raspberrypi/samples/c/lib/libpaho-mqtt3as.so: undefined reference to `SSL_set_fd#OPENSSL_1.0.0'
collect2: error: ld returned 1 exit status
make: *** [prj_c] Error 1
18:18:52 Build Finished (took 1s.675ms)
You are missing 2 libraries on your build system: libcrypto.so.1.0.0 and libssl.so.1.0.0.
The developers added an extra section in their repository describing what is needed to build the samples: Note for users who want to change the code, compile and build the .deb file
One thing they state there is that you need to install libssl-dev which will automatically install libssl1.0.0. This package contains both libcrypto.so.1.0.0 and libssl.so.1.0.0.
So running sudo apt-get install libssl-dev might solve your problem.
BUT: You are not directly building the code on the arm system but on an x86/64 system. I am not sure that linking will work though.
I was able to build correctly. Since beginning it was always linker path issue. However due to my lack of expertise with Eclipse and linux, I was not able to find the cause. Posting my observations for others.
Linker was looking for libssl.so and libcrypto.so. Whereas the error in eclipse console was to look for libcrypto.1.0.0. Can someone guide me why this naming issue ?
I was able to build using both local lib folder as well as NFS link to external libraries.
The link to libraries -L should be to final folder of .so and not to parent or up in hierarchy.
While using NFS , due to issue mentioned in point 1, I logged into the target (Raspberry Pi) and made link of .so.1.0.0 to .so via file explorer > right click > make link. This link was showing broken on host nfs mount. Maybe it was absolute. There were few standard libs with links which looked fine.
For valid run from eclipse on host, if comes across error - "error while loading shared libraries" then those libraries need to be copied to /lib or /usr/lib on the target.

Linking libcurl while cross compiling with mingw32 under Linux for Windows

I have compiled libcurl using mingw32 and am trying to link it with my program using mingw32 for a Windows system from my Linux machine.
I was outputted the files, libcurl-4.dll libcurl.a libcurl.la libcurl.lai.
I have included them in my mingw32 libs folder at: /usr/x86_64-w64-mingw32/lib
I was able to find a few other topics on linking with the libstdc++ and libgcc to take care dependency errors while executed but when trying to add libcurl.a it will not compile period.
I used the following:
$ x86_64-w64-mingw32-g++ main.cpp -o hello.exe -static-libgcc -static-libstdc++ -static "/usr/x86_64-w64-mingw32/lib/libcurl.a" -lpthread
However, I cannot not get it to use the libcurl.a and am continuing to receive these errors.
/tmp/ccIceRus.o:main.cpp:(.text+0xde): undefined reference to `__imp_curl_easy_init'
/tmp/ccIceRus.o:main.cpp:(.text+0x106): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x122): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x13e): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x159): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x169): undefined reference to `__imp_curl_easy_perform'
/tmp/ccIceRus.o:main.cpp:(.text+0x180): undefined reference to `__imp_curl_easy_strerror'
/tmp/ccIceRus.o:main.cpp:(.text+0x197): undefined reference to `__imp_curl_easy_cleanup'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccIceRus.o: bad reloc address 0x80 in section `.xdata'
collect2: error: ld returned 1 exit status
What am I doing wrong?. I can not get past this. I know it has to be some stupid issue.
Thank you.
I was able to solve the question by specifying -DCURL_STATICLIB, as well as linking some other dependencies.
x86_64-w64-mingw32-g++ main.cpp -o hello.exe -DCURL_STATICLIB -static -lstdc++ -lgcc -lpthread -lcurl -lwldap32 -lws2_32

compile with boost on ubuntu 14.04 : undefined reference to `boost::thread::get_id() const'

I am trying to compile a simple boost program which uses threading on ubuntu 14.04 ( using boost 1.54 ).
the output of compilation is like this:
09:30:25 **** Incremental Build of configuration Debug for project sdkTest ****
make all
Building target: sdkTest
Invoking: GCC C++ Linker
g++ -L"/home/khan/git/sdkLinux/libFingiSdk/Debug" -o "sdkTest" ./src/CommunicationCoreTest.o ./src/CoreTest.o ./src/LoggerTest.o ./src/ProgramOptions.o ./src/sdkTest.o -lfingidevicesdk -lz -lssl -lcurl -lpthread -lboost_system -lboost_regex -lboost_signals -lboost_thread -lboost_chrono -lboost_program_options -lboost_filesystem -lboost_iostreams -lboost_unit_test_framework -lpython2.7 -lboost_python
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::get_id() const'
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::join()'
collect2: error: ld returned 1 exit status
make: *** [sdkTest] Error 1
09:30:25 Build Finished (took 413ms)
i have install boost by using
sudo apt-get install libboost-all-dev
and in the compilation i have added reference to libboost_thread , pthread and so on. ( infact this used to compile fine on ubuntu 12.10,boost 1.48).
Any idea what could be wrong here?
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::get_id() const'
You need to link libfingidevicesdk.so with the boost thread library as well.

Building Boost_1_55_0's example asynchronous TCP daytime server

I'm trying to build Boost's example of an asynchronous TCP daytime server found on this link:
http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/tutorial/tutdaytime3/src.html
Here what I am trying to build the example with:
g++ -o server server.cpp -I ~/boost/include -L~/boost/lib -lboost_system
Here are the errors I am getting:
g++ -o server server.cpp -I ~/boost/include -L~/boost/lib -lboost_system
/tmp/ccF38gvh.o: In function `__static_initialization_and_destruction_0(int, int)':
server.cpp:(.text+0x221): undefined reference to `boost::system::generic_category()'
server.cpp:(.text+0x22d): undefined reference to `boost::system::generic_category()'
server.cpp:(.text+0x239): undefined reference to `boost::system::system_category()'
/tmp/ccF38gvh.o: In function `boost::system::error_code::error_code()':
server.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'
/tmp/ccF38gvh.o: In function `boost::asio::error::get_system_category()':
server.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [all] Error 1
What do I need to add to get this to successfully build?
I'm pretty sure your command line is different.
In particular, could it be you have the source listed /after/ the libs?
Specificly
g++ -o server -I "$HOME/boost/include" -L"$HOME/boost/lib" -lboost_system server.cpp
would not work, and
g++ -o server server.cpp -I "$HOME/boost/include" -L"$HOME/boost/lib" -lboost_system
should work.
Other than that, see also c++ files to include for boost : asio. The jam-file for the tutorials build everything with -lboost_system -lboost_thread -DBOOST_ALL_NO_LIB=1 (which is likely overkill)
Update Also found this How to compile boost async_client.cpp

linker unable to find __assert_fail

I'm trying to build a library that makes use of boost, and while the library compiles OK, it's hitting a weird linker error that I don't understand. I built and installed Boost 1.54 (also tried 1.52), which went fine.
It claims to not be able to find __assert_fail, which I think is part of the standard library. I tried to build everything in 64-bit. I'm on Fedora 16, using gcc 4.6.3
Any ideas?
make all-am
make[1]: Entering directory `/data/adrian/code/ext/mapper/cmappertools'
/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -o libcmappertools.la -rpath /usr/local/lib/python2.7/site-packages cmappertools.lo
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.3/crtbeginS.o .libs/cmappertools.o -L/usr/lib/gcc/x86_64-redhat-linux/4.6.3 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.6.3/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../../../lib64/crtn.o -O2 -Wl,-soname -Wl,libcmappertools.so.0 -o .libs/libcmappertools.so.0.0.0
.libs/cmappertools.o: In function `condition_variable':
/usr/local/include/boost/thread/pthread/condition_variable_fwd.hpp:69: undefined reference to `__assert_fail'
/usr/local/include/boost/thread/pthread/condition_variable_fwd.hpp:69: undefined reference to `__assert_fail'
.libs/cmappertools.o: In function `~mutex':
/usr/local/include/boost/thread/pthread/mutex.hpp:108: undefined reference to `__assert_fail'
.libs/cmappertools.o: In function `condition_variable':
/usr/local/include/boost/thread/pthread/condition_variable_fwd.hpp:69: undefined reference to `__assert_fail'
.libs/cmappertools.o: In function `~mutex':
/usr/local/include/boost/thread/pthread/mutex.hpp:108: undefined reference to `__assert_fail'
.libs/cmappertools.o:/usr/local/include/boost/smart_ptr/shared_array.hpp:194: more undefined references to `__assert_fail' follow
/usr/local/bin/ld: .libs/libcmappertools.so.0.0.0: hidden symbol `__assert_fail' isn't defined
/usr/local/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libcmappertools.la] Error 1
make[1]: Leaving directory `/data/adrian/code/ext/mapper/cmappertools'
make: *** [all] Error 2
several years later, on different Fedora (29), later version of boost, gcc, etc.etc. I ran into the same problem.
Led more by intuition than understanding I got rid of gcc visibility pragmas
(i.e. I commented out all the:
#pragma GCC visibility push({whatever})
...
#pragma GCC visibility pop)
and that did the trick - it compiled, linked and run successfully.
As Tarni mentioned,
hidden symbol `__assert_fail' isn't defined
is indeed caused by #pragma GCC visibility push(hidden)
However, if you absolutely need to hide some function that calls assert macro, you should include before hiding any symbols, e.g.
// Wrong place to hide
// #pragma GCC visibility push(hidden)
#include <assert.h>
// Right place to hide
#pragma GCC visibility push(hidden)
void fatal_debug(int foo, int bar){
assert(foo == bar);
}
#pragma GCC visibility pop