undefined reference to symbol 'dlsym@@GLIBC_2.4'

Nathan picture Nathan · Apr 10, 2015 · Viewed 31.6k times · Source

First off, please keep in mind that I'm new to linux. I'm having problems compiling my project. I keep get the following error:

/usr/bin/ld: CMakeFiles/Robot.dir/source/ModuleHandler.cpp.o: undefined reference to symbol 'dlsym@@GLIBC_2.4' //lib/arm-linux-gnueabihf/libdl.so.2: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status

First off the correct directory is: /usr/lib/arm-linux-gnueabihf/libdl.so Rather than: //lib/arm-linux-gnueabihf/libdl.so

I've tried updating my ldconfig.conf file, setting LD_LIBRARY_PATH, using ldd -r to no avail.

CMAKE is used to create the make file.

I've previously had no problems compiling. It started either when I did a apt-get upgrade or after a tried cross-compiling from VS.

Any suggestions would be greatly appreciated!

//Nathan

Answer

Andrew Henle picture Andrew Henle · Apr 10, 2015

In general, the man page for the symbol you can't find tells you what libraries you need to link in. In your case:

http://linux.die.net/man/3/dlsym

Note the line:

Link with -ldl.