FellowTraveler/Open-Transactions — Issue #69: Compiler (linker) Error - Ubuntu 32 and 64 bit
Author: paulrd
Created: 2012-03-03 16:05:23+00:00
State: open

make yields the following error in 32-bit Ubuntu:

/usr/bin/ld: ../OTLib/libOTLib.a(OTScript.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
/usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libdl.so so try adding it to the linker command line
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libdl.so: could not read symbols: Invalid operation

A similar error occurs for 64-bit. This is a problem with the link order of the libraries. In this case, libOTLib depends on libdl so the fix is to make sure the -ldl switch appears after any -lOTLib switch. One way to fix this might be to put the -ldl switch at the end (just before specifying the -o ). This seems to work for me when done manually, but the fix needs to be put in the Makefile I would think.

See http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html for more info on why link order for libraries can be important.