Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 410175

Summary: dev-util/bam-0.4.0 - src/support.c:262: error: undefined reference to 'dlopen'
Product: Gentoo Linux Reporter: Alec Meyers <alecm_88>
Component: [OLD] DevelopmentAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: normal CC: doctorwhoguy, jer, kensington
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/matricks/bam/blob/master/make_unix.sh#L22
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 372079    

Description Alec Meyers 2012-03-29 17:42:17 UTC
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
Comment 1 Patrick McMunn 2012-07-16 05:37:56 UTC
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?
Comment 2 Pacho Ramos gentoo-dev 2012-07-22 17:33:00 UTC
+  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.
+