When compiling bam, I get this error: cc -O2 -march=native -pipe -fno-ident -floop-interchange -floop-strip-mine -floop-block -ggdb -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,--hash-style=gnu -o bam src/support.o src/mem.o src/dep_search.o src/node.o src/luafuncs.o src/path.o src/context.o src/main.o src/cache.o src/dep_cpp.o -lm -lpthread -llua src/support.c:262: error: undefined reference to 'dlopen' src/support.c:271: error: undefined reference to 'dlsym' src/support.c:272: error: undefined reference to 'dlerror' src/support.c:278: error: undefined reference to 'dlclose' src/support.c:265: error: undefined reference to 'dlerror' collect2: ld returned 1 exit status The fix is to add "-ldl" to the LIBS line in files/0.4.0/Makefile (Upstream does it: https://github.com/matricks/bam/blob/master/make_unix.sh#L22) Reproducible: Always
I had the same error. I added -ldl, and it allowed compilation to proceed normally. I also noticed that upstream uses -rdynamic which "[Passes] the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of dlopen or to allow obtaining backtraces from within a program." Should this also be added to the ebuild's Makefile?
+ 22 Jul 2012; Pacho Ramos <pacho@gentoo.org> bam-0.4.0.ebuild, + files/0.4.0/Makefile: + Fix underlinking, bug #410175 by Alec Meyers. +