From: Protasio Ramirez, Joan
Sent: Tuesday, January 13, 2009 5:04 PM
To: 'hanwen@cs.uu.nl'; 'jork.loeser@inf.tu-dresden.de'
Subject: libgendep, compiling problems
Hi all,
My name’s joan. I’m making an application which works with libgendep. I have tried once before with the library and I didn’t have problems. Unfortunately, this time I’m having problems with it. I have compiled the library (modifying some parameters in Makefile) but when I make a proof the shell shows me the message:
ERROR: ld.so :object liobgendep.so from LD_PRELOAD cannot be preloaded : ignored
Any help will be welcomed,
Thank you very much
Joan
Hi Joan,
ERROR: ld.so :object liobgendep.so from LD_PRELOAD cannot be preloaded : ignored
My guess to this is that you may be on a 64bit system and somehow trying to preload a 32bit libgendep into a 64bit process or vice-versa.
Michael
Hi all,
I'm having problems in executing libgendep 1.0. I don't have problems compiling, it's only in the execution time. The shell shows me the error:
gcc : symbol lookup error : libgendep.so : undefined symbol :dlsym
I have been investigating the library code and in syscall.c there are some functions which use dlsym. The problem is that the pointer address that returns dlsym is not valid (undefined). (I think so), so I have tried to change the arguments to call dlsym.
I have tried dlsym(RTLD_SELF,) or dlsym(RTLD_DEFAULT) dlsym(RTLD_LAZY) but it doesn't works.
Could you give any guess??
Thanks so much
Joan
Hi,
I'm having problems in executing libgendep 1.0. I don't have problems compiling, it's only in the execution time. The shell shows me the error:
gcc : symbol lookup error : libgendep.so : undefined symbol :dlsym
Do you get a similar error, when you run this: LD_PRELOAD=/path/to/your/libgendep.so gcc --version
If so, please post the output of LD_DEBUG=all LD_PRELOAD=/path/to/your/libgendep.so gcc --version
Michael
Hello Michael,
Yes I have the same error. The debug result is:
.
.
. file=/lib/libc.so.6 9857: symbol=_Jv_RegisterClasses; lookup in file=/lib/ld-linux.so.2 9857: symbol=__gmon_start__; lookup in file=gcc 9857: symbol=__gmon_start__; lookup in file=libgendep.so 9857: symbol=__gmon_start__; lookup in file=/lib/libc.so.6 9857: symbol=__gmon_start__; lookup in file=/lib/ld-linux.so.2 9857: 9857: relocation processing: gcc (lazy) 9857: symbol=__gmon_start__; lookup in file=gcc 9857: symbol=__gmon_start__; lookup in file=libgendep.so 9857: symbol=__gmon_start__; lookup in file=/lib/libc.so.6 9857: symbol=__gmon_start__; lookup in file=/lib/ld-linux.so.2 9857: symbol=__environ; lookup in file=libgendep.so 9857: symbol=__environ; lookup in file=/lib/libc.so.6 9857: binding file gcc to /lib/libc.so.6: normal symbol `__environ' [GLIBC_2.0] 9857: symbol=stdout; lookup in file=libgendep.so 9857: symbol=stdout; lookup in file=/lib/libc.so.6 9857: binding file gcc to /lib/libc.so.6: normal symbol `stdout' [GLIBC_2.0] 9857: symbol=stderr; lookup in file=libgendep.so 9857: symbol=stderr; lookup in file=/lib/libc.so.6 9857: binding file gcc to /lib/libc.so.6: normal symbol `stderr' [GLIBC_2.0] 9857: 9857: relocation processing: /lib/ld-linux.so.2 9857: symbol=_r_debug; lookup in file=gcc 9857: symbol=_r_debug; lookup in file=libgendep.so 9857: symbol=_r_debug; lookup in file=/lib/libc.so.6 9857: symbol=_r_debug; lookup in file=/lib/ld-linux.so.2 9857: binding file /lib/ld-linux.so.2 to /lib/ld-linux.so.2: normal symbol `_r_debug' [GLIBC_2.0] 9857: symbol=__libc_memalign; lookup in file=gcc 9857: symbol=__libc_memalign; lookup in file=libgendep.so 9857: symbol=__libc_memalign; lookup in file=/lib/libc.so.6 9857: binding file /lib/ld-linux.so.2 to /lib/libc.so.6: normal symbol `__libc_memalign' [GLIBC_2.0] 9857: symbol=malloc; lookup in file=gcc 9857: symbol=malloc; lookup in file=libgendep.so 9857: symbol=malloc; lookup in file=/lib/libc.so.6 9857: binding file /lib/ld-linux.so.2 to /lib/libc.so.6: normal symbol `malloc' [GLIBC_2.0] 9857: symbol=calloc; lookup in file=gcc 9857: symbol=calloc; lookup in file=libgendep.so 9857: symbol=calloc; lookup in file=/lib/libc.so.6 9857: binding file /lib/ld-linux.so.2 to /lib/libc.so.6: normal symbol `calloc' [GLIBC_2.0] 9857: symbol=realloc; lookup in file=gcc 9857: symbol=realloc; lookup in file=libgendep.so 9857: symbol=realloc; lookup in file=/lib/libc.so.6 9857: binding file /lib/ld-linux.so.2 to /lib/libc.so.6: normal symbol `realloc' [GLIBC_2.0] 9857: symbol=free; lookup in file=gcc 9857: symbol=free; lookup in file=libgendep.so 9857: symbol=free; lookup in file=/lib/libc.so.6 9857: binding file /lib/ld-linux.so.2 to /lib/libc.so.6: normal symbol `free' [GLIBC_2.0] 9857: 9857: calling init: /lib/libc.so.6 9857: 9857: 9857: calling init: libgendep.so 9857: 9857: symbol=fopen; lookup in file=gcc 9857: symbol=fopen; lookup in file=libgendep.so 9857: binding file libgendep.so to libgendep.so: normal symbol `fopen' 9857: symbol=dlsym; lookup in file=gcc 9857: symbol=dlsym; lookup in file=libgendep.so 9857: symbol=dlsym; lookup in file=/lib/libc.so.6 9857: symbol=dlsym; lookup in file=/lib/ld-linux.so.2 9857: libgendep.so: error: symbol lookup error: undefined symbol: dlsym (fatal) gcc: symbol lookup error: libgendep.so: undefined symbol: dlsym
Hi,
Yes I have the same error. The debug result is:
[...] 9857: calling init: libgendep.so 9857: 9857: symbol=fopen; lookup in file=gcc 9857: symbol=fopen; lookup in file=libgendep.so 9857: binding file libgendep.so to libgendep.so: normal symbol `fopen' 9857: symbol=dlsym; lookup in file=gcc 9857: symbol=dlsym; lookup in file=libgendep.so 9857: symbol=dlsym; lookup in file=/lib/libc.so.6 9857: symbol=dlsym; lookup in file=/lib/ld-linux.so.2 9857: libgendep.so: error: symbol lookup error: undefined symbol: dlsym (fatal) gcc: symbol lookup error: libgendep.so: undefined symbol: dlsym
My guess would be that libdl.so is missing on your system. This library is typically installed as /lib/tls/libdl.so.2 or something similar.
If this does not lead you anywhere, please post the output of
ldd /path/to/your/libgendep.so
Michael
Hi all,
I'm developing a quite interesting free software using libgendep. Now I think I have an important problem. I think that the wrapper of libgendep, syscall.c, does not detects all calls to open. And I wonder why?
If I do: strace -f gcc Simplescript.c -o project
I can find lots and lots of calls to open that libgendep does not detects :(. I print every file directly from syscall.c but there are some opens that they don't appear.
I have been investigating the trace of strace and I see that lots of open calls are created in fork processes, so...maybe the problem is this. Do you know if syscall(SYS_open,.... also searches opens of child processes??
Thanks so much
Hi,
If I do: strace -f gcc Simplescript.c -o project
I can find lots and lots of calls to open that libgendep does not detects :(.
Can you post a snippet of the log that gives an example of such an undetected open()?
I have been investigating the trace of strace and I see that lots of open calls are created in fork processes, so...maybe the problem is this.
libgendep should also hook up with all child processes.
Michael
Dear Michael,
Thanks so much for your answer. I wish we could solve the problem together. You are right Michael. Libgendep also searches for child processes but I still don't find some important calls to open for me (as calls to open for "project", I've marked below).
Fragment (writeSingleFile.c is a simple file with a fopen In write mode) : strace -f gcc writeSingleFile.c -o project
execve("/usr/bin/gcc", ["gcc", "writeSingleFile.c", "-o", "project"], [/* 54 vars */]) = 0 uname({sys="Linux", node="npdl436.bpo.hp.com", ...}) = 0 brk(0) = 0x8b2e000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls/i686/sse2", 0xbfe3a43c) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls/i686", 0xbfe3a43c) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No . . . close(3) = 0 open("/tmp/ccNZSFqK.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 close(3) = 0 stat64("/usr/libexec/gcc/i386-redhat-linux/3.4.5/cc1", {st_mode=S_IFREG|0755, st_size=3435232, ...}) = 0 access("/usr/libexec/gcc/i386-redhat-linux/3.4.5/cc1", X_OK) = 0 fork(Process 14951 attached ) = 14951 [pid 14950] waitpid(14951, Process 14950 suspended <unfinished ...> [pid 14951] execve("/usr/libexec/gcc/i386-redhat-linux/3.4.5/cc1", ["/usr/libexec/gcc/i386-redhat-lin"..., "-quiet", "writeSingleFile.c", "-quiet", "-dumpbase", "writeSingleFile.c", "-auxbase", "writeSingleFile", "-o", "/tmp/ccNZSFqK.s"], [/* 56 vars */]) = 0 [pid 14951] uname({sys="Linux", node="npdl436.bpo.hp.com", ...}) = 0 [pid 14951] brk(0) = 0x84fc000 [pid 14951] access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such . . . [pid 14965] open("/tmp/ccNZSCCqK.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 [pid 14965] unlink("project") = 0 <-------NOT FOUND !!!! [pid 14965] open("project", O_RDWR|O_CREAT|O_TRUNC, 0666) = 6 <-------NOT FOUND !!!! [pid 14965] open("/usr/lib/gcc/i386-redhat-linux/3.4.5/../../../crt1.o", O_RDONLY) = 7 [pid 14965] fstat64(7, {st_mode=S_IFREG|0644, st_size=1172, ...}) = 0 [pid 14965] old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4024e000 [pid 14965] _llseek(7, 0, [0], SEEK_SET) = 0 [pid 14965] read(7, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\3\0\1\0\0\0\0\0\0\0"..., 4096) = 1172 [pid 14965] _llseek(7, 1172, [1172], SEEK_SET) = 0 . . . [pid 14965] brk(0x97b1000) = 0x97b1000 [pid 14965] close(14) = 0 [pid 14965] munmap(0x40255000, 4096) = 0 [pid 14965] open("project", O_RDWR) = 14 <-------NOT FOUND !!!!
I don't understand why. I have put one printf inside the function ___open like :
If (rv > 0 ). . . Printf("the current file is %s",fn); . . .
But it doesn't appears!. I also have added to the wrapper one alias to unlink (it also makes mentions to project) but it also don't detect them. It is strange because files in the same child process are detected as [pid 14965] open("/tmp/ccNZSCCqK.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 ...
Thankss!!!
Hi,
Libgendep also searches for child processes but I still don't find some important calls to open for me (as calls to open for "project", I've marked below).
[...] [pid 14965] open("/tmp/ccNZSCCqK.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 [pid 14965] unlink("project") = 0 <-------NOT FOUND !!!! [pid 14965] open("project", O_RDWR|O_CREAT|O_TRUNC, 0666) = 6 <-------NOT FOUND !!!! [...]
I don't understand why. I have put one printf inside the function ___open like :
Have you also instrumented the fopen() function? The open() entries in the strace log might be caused by functions other than open() on the libc API level. Perhaps it is best, if you enable the built-in debugging in libgendep by setting the VERBOSE macro to 1 in syscall.c and recompiling libgendep. Then repeat the strace and see if that makes any difference.
Michael
l4-hackers@os.inf.tu-dresden.de