LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-19-2006, 12:46 AM   #1
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Rep: Reputation: 15
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:
junaid@Dev-jsahibzada:~/Desktop/elfsh-0.51b3$ make
Builting libelfsh...
make[1]: Entering directory `/home/junaid/Desktop/elfsh-0.51b3/libelfsh'
make[1]: Leaving directory `/home/junaid/Desktop/elfsh-0.51b3/libelfsh'
Libelfsh has been built successfully.
Builting libhashelfsh...
Libhash has been built successfully.
Builting ELFsh...
make[1]: Entering directory `/home/junaid/Desktop/elfsh-0.51b3/vm'
gcc grammar.o disasm.o dyn.o hdr.o main.o got.o interp.o notes.o pht.o rel.o sht.o stab.o sym.o quit.o data.o ctors.o dtors.o fileops.o comment.o save.o load.o unload.o list.o doswitch.o tables.o help.o info.o readln.o print.o lexer.o misc.o atomic.o opt.o implicit.o exec.o modules.o findrel.o objects.o cmdapi.o filter.o reladd.o fcthijack.o -o elfsh -L../libelfsh/ -lelfsh -L../libhash/ -lhashelfsh -rdynamic -g3
modules.o: In function `cmd_modload':/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:41: undefined reference to `dlopen'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:49: undefined reference to `dlsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:55: undefined reference to `dlsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:68: undefined reference to `dlerror'
modules.o: In function `cmd_modunload':/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:91: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/junaid/Desktop/elfsh-0.51b3/vm'
make: *** [all] Error 2
can any one tell me whats wrong

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)
 
Old 07-19-2006, 01:01 AM   #2
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
If it's autotooled, try adding -ldl to your LDFLAGS.
 
Old 07-19-2006, 01:02 AM   #3
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
LDFLAGS=-ldl make
Does it help?
 
Old 07-19-2006, 01:08 AM   #4
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
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?
 
Old 07-19-2006, 01:17 AM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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)
 
Old 07-19-2006, 01:24 AM   #6
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
when i use LDFLAGS=-ldl make

i get the same error

Quote:
fcthijack.c: In function ‘cmd_hijack’:
fcthijack.c:22: warning: dereferencing type-punned pointer will break strict-aliasing rules
gcc grammar.o disasm.o dyn.o hdr.o main.o got.o interp.o notes.o pht.o rel.o sht.o stab.o sym.o quit.o data.o ctors.o dtors.o fileops.o comment.o save.o load.o unload.o list.o doswitch.o tables.o help.o info.o readln.o print.o lexer.o misc.o atomic.o opt.o implicit.o exec.o modules.o findrel.o objects.o cmdapi.o filter.o reladd.o fcthijack.o -o elfsh -L../libelfsh/ -lelfsh -L../libhash/ -lhashelfsh -rdynamic -g3
modules.o: In function `cmd_modload':/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:41: undefined reference to `dlopen'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:49: undefined reference to `dlsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:55: undefined reference to `dlsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:68: undefined reference to `dlerror'
modules.o: In function `cmd_modunload':/home/junaid/Desktop/elfsh-0.51b3/vm/modules.c:91: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/junaid/Desktop/elfsh-0.51b3/vm'
make: *** [all] Error 2


and when i use this command

make LDFLAGS+=-ldl

i get these errors

Quote:
fcthijack.c:22: warning: dereferencing type-punned pointer will break strict-aliasing rules
gcc grammar.o disasm.o dyn.o hdr.o main.o got.o interp.o notes.o pht.o rel.o sht.o stab.o sym.o quit.o data.o ctors.o dtors.o fileops.o comment.o save.o load.o unload.o list.o doswitch.o tables.o help.o info.o readln.o print.o lexer.o misc.o atomic.o opt.o implicit.o exec.o modules.o findrel.o objects.o cmdapi.o filter.o reladd.o fcthijack.o -o elfsh -ldl
grammar.o: In function `lookup4':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:236: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:243: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:231: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:240: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:266: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:233: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:245: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:250: undefined reference to `elfsh_error_msg'
grammar.o:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:238: more undefined references to `elfsh_error_msg' follow
grammar.o: In function `lookup_immed':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:37: undefined reference to `elfsh_get_symbol_by_name'
grammar.o: In function `lookup5_index':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:317: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:322: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:329: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:338: undefined reference to `elfsh_error_msg'
grammar.o: In function `lookup3_index':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:122: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:127: undefined reference to `hash_get'
grammar.o: In function `vm_lookup_param':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:319: undefined reference to `elfsh_error_msg'
grammar.o: In function `lookup3':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:188: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:195: undefined reference to `hash_get'
grammar.o: In function `vm_lookup_param':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:124: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:326: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:46: undefined reference to `elfsh_get_dynsymbol_by_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:183: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:131: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:192: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:333: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:185: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:324: undefined reference to `elfsh_error_msg'
grammar.o:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:129: more undefined references to `elfsh_error_msg' follow
grammar.o: In function `vm_lookup_param':/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:55: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/grammar.c:143: undefined reference to `elfsh_error_msg'
disasm.o: In function `display_object':/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:134: undefined reference to `elfsh_is_pltentry'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:144: undefined reference to `elfsh_raw_read'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:156: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:156: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:167: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:167: undefined reference to `elfsh_raw_read'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:180: undefined reference to `elfsh_get_parent_section'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:188: undefined reference to `elfsh_reverse_symbol'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:190: undefined reference to `elfsh_reverse_dynsymbol'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:183: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:183: undefined reference to `elfsh_raw_read'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:136: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:146: undefined reference to `elfsh_error'
disasm.o: In function `display_section':/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:310: undefined reference to `elfsh_get_symtab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:332: undefined reference to `elfsh_get_symbol_by_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:318: undefined reference to `elfsh_get_parent_section'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:320: undefined reference to `elfsh_get_symbol_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:313: undefined reference to `elfsh_get_anonymous_section'
disasm.o: In function `cmd_disasm':/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:362: undefined reference to `elfsh_get_symtab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:363: undefined reference to `elfsh_get_dynsymtab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:393: undefined reference to `elfsh_get_symbol_by_value'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:404: undefined reference to `elfsh_get_symbol_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:413: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:383: undefined reference to `elfsh_get_vaddr_from_foffset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:385: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:475: undefined reference to `elfsh_get_dynsymbol_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:476: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:476: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:476: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:476: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:490: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:447: undefined reference to `elfsh_get_symbol_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:448: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:448: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:448: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:448: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:462: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:402: undefined reference to `elfsh_get_symbol_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:396: undefined reference to `elfsh_get_symbol_by_value'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:399: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:481: undefined reference to `elfsh_get_symbol_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:453: undefined reference to `elfsh_get_symbol_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/disasm.c:375: undefined reference to `elfsh_error_msg'
dyn.o: In function `vm_dynentinfo':/home/junaid/Desktop/elfsh-0.51b3/vm/dyn.c:93: undefined reference to `elfsh_get_dynentry_string'
:/home/junaid/Desktop/elfsh-0.51b3/vm/dyn.c:95: undefined reference to `elfsh_error'
dyn.o: In function `cmd_dyn':/home/junaid/Desktop/elfsh-0.51b3/vm/dyn.c:207: undefined reference to `elfsh_get_dynamic'
:/home/junaid/Desktop/elfsh-0.51b3/vm/dyn.c:217: undefined reference to `elfsh_get_dynentry_type'
hdr.o: In function `cmd_elf':/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:57: undefined reference to `elfsh_get_hdr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:62: undefined reference to `elfsh_get_magic'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:62: undefined reference to `elfsh_get_class'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:62: undefined reference to `elfsh_get_class'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:32: undefined reference to `elfsh_set_magic'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:72: undefined reference to `elfsh_get_magic'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:74: undefined reference to `elfsh_reverse_metasym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:85: undefined reference to `elfsh_get_arch'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:86: undefined reference to `elfsh_get_objtype'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:87: undefined reference to `elfsh_get_encoding'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_segmexec'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_randexec'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_randmmap'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_mprotect'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_emultramp'
:/home/junaid/Desktop/elfsh-0.51b3/vm/hdr.c:101: undefined reference to `elfsh_get_pax_pageexec'
main.o: In function `main':/home/junaid/Desktop/elfsh-0.51b3/vm/main.c:75: undefined reference to `elfsh_error'
got.o: In function `cmd_got':/home/junaid/Desktop/elfsh-0.51b3/vm/got.c:26: undefined reference to `elfsh_get_got'
:/home/junaid/Desktop/elfsh-0.51b3/vm/got.c:36: undefined reference to `elfsh_reverse_symbol'
:/home/junaid/Desktop/elfsh-0.51b3/vm/got.c:37: undefined reference to `elfsh_reverse_dynsymbol'
interp.o: In function `cmd_interp':/home/junaid/Desktop/elfsh-0.51b3/vm/interp.c:17: undefined reference to `elfsh_get_interp'
notes.o: In function `cmd_notes':/home/junaid/Desktop/elfsh-0.51b3/vm/notes.c:25: undefined reference to `elfsh_get_notes'
:/home/junaid/Desktop/elfsh-0.51b3/vm/notes.c:28: undefined reference to `elfsh_get_section_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/notes.c:38: undefined reference to `elfsh_get_notes'
pht.o: In function `cmd_pht':/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:29: undefined reference to `elfsh_get_pht'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:80: undefined reference to `elfsh_get_sht'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:45: undefined reference to `elfsh_segment_is_executable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:45: undefined reference to `elfsh_segment_is_writable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:45: undefined reference to `elfsh_segment_is_readable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:39: undefined reference to `elfsh_get_segment_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:59: undefined reference to `elfsh_segment_is_executable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:59: undefined reference to `elfsh_segment_is_writable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:59: undefined reference to `elfsh_segment_is_readable'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:91: undefined reference to `elfsh_get_segment_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:98: undefined reference to `elfsh_segment_is_parent'
:/home/junaid/Desktop/elfsh-0.51b3/vm/pht.c:101: undefined reference to `elfsh_get_section_name'
rel.o: In function `vm_getrelascii':/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:13: undefined reference to `elfsh_get_arch'
rel.o: In function `vm_getmaxrelnbr':/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:30: undefined reference to `elfsh_get_arch'
rel.o: In function `cmd_rel':/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:62: undefined reference to `elfsh_get_reloc'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:74: undefined reference to `elfsh_get_section_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:107: undefined reference to `elfsh_get_relsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:107: undefined reference to `elfsh_get_reloffset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:96: undefined reference to `elfsh_get_symname_from_reloc'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:97: undefined reference to `elfsh_get_reltype'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:114: undefined reference to `elfsh_get_relsym'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:114: undefined reference to `elfsh_get_reloffset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/rel.c:128: undefined reference to `elfsh_get_reloc'
sht.o: In function `cmd_sht':/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:25: undefined reference to `elfsh_get_sht'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_align'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_entsize'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_info'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_link'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_foffset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_orderflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_linkflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_strflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_mergeableflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_execflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_writableflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_allocflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:53: undefined reference to `elfsh_get_section_addr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:40: undefined reference to `elfsh_get_section_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:46: undefined reference to `elfsh_get_section_by_index'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:47: undefined reference to `elfsh_get_section_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_link'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_foffset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_orderflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_linkflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_strflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_mergeableflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_execflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_writableflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_allocflag'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:74: undefined reference to `elfsh_get_section_addr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sht.c:27: undefined reference to `elfsh_error'
stab.o: In function `cmd_stab':/home/junaid/Desktop/elfsh-0.51b3/vm/stab.c:25: undefined reference to `elfsh_get_stab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/stab.c:37: undefined reference to `elfsh_get_stab_offset'
:/home/junaid/Desktop/elfsh-0.51b3/vm/stab.c:33: undefined reference to `elfsh_get_stab_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/stab.c:35: undefined reference to `elfsh_get_stab_type'
sym.o: In function `ds':/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:44: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:93: undefined reference to `elfsh_get_symbol_link'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:93: undefined reference to `elfsh_get_symbol_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:93: undefined reference to `elfsh_get_symbol_value'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:54: undefined reference to `elfsh_get_symbol_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:55: undefined reference to `elfsh_get_symbol_bind'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:64: undefined reference to `elfsh_get_parent_section'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:71: undefined reference to `elfsh_get_section_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:105: undefined reference to `elfsh_get_symbol_size'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:105: undefined reference to `elfsh_get_symbol_value'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:82: undefined reference to `elfsh_get_foffset_from_vaddr'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:68: undefined reference to `elfsh_get_section_by_index'
sym.o: In function `cmd_sym':/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:134: undefined reference to `elfsh_get_symtab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:137: undefined reference to `elfsh_get_section_by_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:140: undefined reference to `elfsh_get_symbol_name'
sym.o: In function `cmd_dynsym':/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:154: undefined reference to `elfsh_get_dynsymtab'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:157: undefined reference to `elfsh_get_section_by_type'
:/home/junaid/Desktop/elfsh-0.51b3/vm/sym.c:160: undefined reference to `elfsh_get_dynsymbol_name'
quit.o: In function `cmd_quit':/home/junaid/Desktop/elfsh-0.51b3/vm/quit.c:24: undefined reference to `elfsh_unload_obj'
ctors.o: In function `cmd_ctors':/home/junaid/Desktop/elfsh-0.51b3/vm/ctors.c:26: undefined reference to `elfsh_get_ctors'
:/home/junaid/Desktop/elfsh-0.51b3/vm/ctors.c:37: undefined reference to `elfsh_reverse_symbol'
:/home/junaid/Desktop/elfsh-0.51b3/vm/ctors.c:38: undefined reference to `elfsh_reverse_dynsymbol'
dtors.o: In function `cmd_dtors':/home/junaid/Desktop/elfsh-0.51b3/vm/dtors.c:26: undefined reference to `elfsh_get_dtors'
:/home/junaid/Desktop/elfsh-0.51b3/vm/dtors.c:37: undefined reference to `elfsh_reverse_symbol'
:/home/junaid/Desktop/elfsh-0.51b3/vm/dtors.c:38: undefined reference to `elfsh_reverse_dynsymbol'
fileops.o: In function `cmd_write':/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:22: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:51: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:30: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:33: undefined reference to `elfsh_error_msg'
fileops.o: In function `cmd_fixup':/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:165: undefined reference to `elfsh_fixup_bss'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:164: undefined reference to `elfsh_error_msg'
fileops.o: In function `cmd_append':/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:81: undefined reference to `elfsh_get_section_by_index'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:87: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:84: undefined reference to `elfsh_get_section_by_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:108: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:111: undefined reference to `elfsh_append_data_to_section'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:79: undefined reference to `elfsh_error_msg'
fileops.o: In function `cmd_extend':/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:137: undefined reference to `elfsh_get_section_by_index'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:140: undefined reference to `elfsh_get_section_by_name'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:151: undefined reference to `elfsh_append_data_to_section'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:150: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:149: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:135: undefined reference to `elfsh_error_msg'
:/home/junaid/Desktop/elfsh-0.51b3/vm/fileops.c:144: undefined reference to `elfsh_error_msg'
comment.o: In function `cmd_comments':/home/junaid/Desktop/elfsh-0.51b3/vm/comment.c:23: undefined reference to `elfsh_get_comments'
:/home/junaid/Desktop/elfsh-0.51b3/vm/comment.c:28: undefined reference to `elfsh_get_comments_entry'
:/home/junaid/Desktop/elfsh-0.51b3/vm/comment.c:34: undefined reference to `elfsh_get_comments_entry'
save.o: In function `cmd_save':/home/junaid/Desktop/elfsh-0.51b3/vm/save.c:13: undefined reference to `elfsh_save_obj'
load.o: In function `cmd_load':/home/junaid/Desktop/elfsh-0.51b3/vm/load.c:18: undefined reference to `elfsh_map_obj'
:/home/junaid/Desktop/elfsh-0.51b3/vm/load.c:38: undefined reference to `hash_add'
unload.o: In function `cmd_unload':/home/junaid/Desktop/elfsh-0.51b3/vm/unload.c:56: undefined reference to `hash_del'
:/home/junaid/Desktop/elfsh-0.51b3/vm/unload.c:57: undefined reference to `elfsh_unload_obj'
:/home/junaid/Desktop/elfsh-0.51b3/vm/unload.c:22: undefined reference to `hash_get'
:/home/junaid/Desktop/elfsh-0.51b3/vm/unload.c:49: undefined reference to `elfsh_error_msg'
doswitch.o: In function `cmd_doswitch':/home/junaid/Desktop/elfsh-0.51b3/vm/doswitch.c:19: undefined reference to `hash_get'
tables.o: In function `setup_cmdhash':/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:462: undefined reference to `hash_init'
tables.o: In function `setup_consthash':/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:559: undefined reference to `hash_init'
:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:561: undefined reference to `hash_add'
:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:565: undefined reference to `hash_add'
:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:569: undefined reference to `hash_add'
:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:573: undefined reference to `hash_add'
:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:577: undefined reference to `hash_add'
tables.o:/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:581: more undefined references to `hash_add' follow
tables.o: In function `vm_setup_hashtables':/home/junaid/Desktop/elfsh-0.51b3/vm/tables.c:623: undefined reference to `hash_init'



'..... omitting the rest
make: *** [all] Error 2
 
Old 07-19-2006, 04:16 AM   #7
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
try
Code:
make LDFLAGS+='-ldl -L../libelfsh/ -lelfsh -L../libhash/ -lhashelfsh -rdynamic -g3'
I cannot understand why this Makefile forgets its own LDFLAGS switches. But you can readd them.
 
Old 07-19-2006, 07:33 PM   #8
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
ok thanks this worked.

can u explain what was wrong?
 
Old 07-19-2006, 07:45 PM   #9
llmmix
Member
 
Registered: Jun 2005
Posts: 73

Rep: Reputation: 15
man nm

cd /usr/lib
nm *.a(or *.so*) | grep <undefined referenced symbol> | grep T

Last edited by llmmix; 07-19-2006 at 07:46 PM.
 
Old 07-20-2006, 12:52 PM   #10
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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.
 
Old 05-12-2007, 04:23 PM   #11
byterage
LQ Newbie
 
Registered: May 2007
Posts: 2

Rep: Reputation: 0
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

Last edited by byterage; 05-12-2007 at 04:25 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
undefined reference to dlopen, dlclose, dlsym and dlerror patrickdepingui Slackware 5 02-14-2010 08:55 AM
Undefined reference, why? george_mercury Programming 4 05-07-2009 12:15 AM
undefined reference vkmgeek Programming 1 05-11-2006 06:37 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 12:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration