Strange linker problem regarding libXmu.so
In trying to compile the latest Mozilla snapshot I ran in to an
interesting linker problem in that I got error messages along the lines
of:
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__bsd_signal'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `_xstat'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__sigjmp_save'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__setjmp'
The thing is, it was not supposed to link to any libc5 libraries. I
managed to isolate the problem which can be reproduced by simply running
$ gcc -o foo -L/usr/X11R6/lib -lXmu
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__bsd_signal'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `_xstat'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__sigjmp_save'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__setjmp'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_Xglobal_lock'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_XUnlockMutex_fn'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_XLockMutex_fn'
collect2: ld returned 1 exit status
I have the xlib6g, xlib6g-dev, and xlib6 packages installed (but not the
xlib6-altdev package). Furthermore,
$ ls -l /usr/X11R6/lib/libXmu.so*
lrwxrwxrwx 1 root root 13 May 16 04:30
/usr/X11R6/lib/libXmu.so -> libXmu.so.6.0
lrwxrwxrwx 1 root root 13 May 16 04:30
/usr/X11R6/lib/libXmu.so.6 -> libXmu.so.6.0
-rw-r--r-- 1 root root 74428 May 10 03:53
/usr/X11R6/lib/libXmu.so.6.0
$ ldd /usr/X11R6/lib/libXmu.so
ldd: warning: you do not have execution permission for
`/usr/X11R6/lib/libXmu.so'
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x40019000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40063000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4006d000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40084000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40090000)
libc.so.6 => /lib/libc.so.6 (0x40136000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
So nothing is out of the ordinary. Running the gcc command line with the
"-Wl,-verbose" option (to enable verbose linking) doesn't reveal the
problem. Relevant parts of the output are reproduced here:
$ gcc -o foo -L/usr/X11R6/lib -lXmu -Wl,-verbose
GNU ld version 2.9.1 (with BFD 2.9.1.0.24)
Supported emulations:
elf_i386
i386linux
using internal linker script:
==================================================
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/usr/i486-linux/lib);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0x08048000 + SIZEOF_HEADERS;
[...]
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(/usr/lib/crt1.o(.text+0x18): undefined
reference to `main'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__bsd_signal'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `_xstat'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__sigjmp_save'
/usr/lib/libc5-compat/libICE.so.6: undefined reference to `__setjmp'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_Xglobal_lock'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_XUnlockMutex_fn'
/usr/X11R6/lib/libXext.so.6: undefined reference to `_XLockMutex_fn'
.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}
==================================================
attempt to open /usr/lib/crt1.o succeeded
/usr/lib/crt1.o
attempt to open /usr/lib/crti.o succeeded
/usr/lib/crti.o
[...]
Incidentally, moving the /usr/lib/libc5-compat directory out of the way
seems to cure the problem. Now I get
$ gcc -o foo -L/usr/X11R6/lib -lXmu
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
as I'm supposed to.
For the record, I'm running up to date (as of yesterday) potato on a 2.2.9
kernel.
I'm really at a loss here, I can usually solve my own problems but this
looks like a genuine linker/compiler bug to me. I would file this as a
bug report if I knew exactly where the problem was and that it isn't just
my system that's somehow screwed up.
Please try if you can reproduce this problem.
--
/'"`\ zzzZ | My PGP Public Key is available at:
( - - ) | <http://home1.inet.tele.dk/renehl/>
--oooO--(_)--Oooo------------------------------------------
Don't ya just hate it when there's not enough room to fin
Reply to: