undefined reference to `dlsym'
I downloaded the source code for the software elfsh from the website
http://elfsh.segfault.net/ i am trying to compile it and it is getting stuck at this place Quote:
here are the specs of my systems Ubuntu 6.06 LTS Linux version 2.6.15-26-386 (buildd@terranova) (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) g++ (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5) |
If it's autotooled, try adding -ldl to your LDFLAGS.
|
LDFLAGS=-ldl make
Does it help? |
how do i do this.
i just have this make file and i type make and every thing happens on its own? where am i supposed to make this change? |
You are supposed to either run
LDFLAGS=-ldl make - that means run command make with LDFLAGS environment variable set to '-ldl' or run make LDFLAGS+=-ldl - that passes command to make to add to LDFLAGS -ldl. Both say to make it should tell linker to use libdl.so (to find dlopen and dlsym) |
when i use LDFLAGS=-ldl make
i get the same error Quote:
and when i use this command make LDFLAGS+=-ldl i get these errors Quote:
|
try
Code:
make LDFLAGS+='-ldl -L../libelfsh/ -lelfsh -L../libhash/ -lhashelfsh -rdynamic -g3' |
ok thanks this worked.
can u explain what was wrong? |
man nm
cd /usr/lib nm *.a(or *.so*) | grep <undefined referenced symbol> | grep T |
I guess man nm doesn't explain the problem completely. The problem is that program used some functions from dynamic library. To load correctly, system must know that this functions will be loaded from some library, because it is the only way to resolve them. So, while linking, linker must know full list of all libraries. Makefile failed to pass correct list. You were offered to use standard ways of adding something to the list. But incorrect Makefile failed to pass the libraries it passed without -ldl. So I gave you a command to override the list completely - and included original libraries.
|
You can modify the vm/Makefile file so that the
#DLOPT = -DUSE_STATIC #DLOPT_linux-gnu = -ldl #DLOPT_solaris = -ldl becomes #DLOPT = -DUSE_STATIC #DLOPT_linux-gnu = -ldl #DLOPT_solaris = -ldl DLOPT = -ldl So the option to link with libdl is used. Note that DLOPT_linux-gnu and DLOPT_solaris don't seem to be used lower in the Makefile. After the modification just do make |
All times are GMT -5. The time now is 06:38 PM. |