http://bugs.winehq.org/show_bug.cgi?id=6158
docbill+bugzilla@freeshell.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Platform|All |PC-x86-64
------- Additional Comments From docbill+bugzilla@freeshell.org 2006-09-09 08:48 ------- I've figured out this is strictly a cross compiling issue. For example, when building wine on an AMD64. The following is a simple test that demonstraits the fundamental problem. Perhaps some form of this test could be added as a configure test to determine when my patch is neccessary...
mkdir foo cd foo echo "void foo(){}" > test.c i686-pc-linux-gnu-gcc --shared -fPIC -o libwine.so test.c cd .. echo "extern void foo();int main(){foo();return 0;}" > bar.c i686-pc-linux-gnu-gcc bar.c -Lfoo -lwine
In a cross compiling envirnoment, where wine has already been installed this will result in an error like: /tmp/ccAZcI8P.o: In function `main': bar.c:(.text+0x12): undefined reference to `foo' collect2: ld returned 1 exit status
If you run an strace on the last command, you can see the problem is the cross compile libraries are added to the search path prior to the library path specified on the command line. In my case I see:
execve("/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld", ["/usr/lib/gcc/x86_64-pc-linux-gnu"..., "--eh-frame-hdr", "-m", "elf_i386", "-dynamic-linker", "/lib/ld-linux.so.2", "/usr/lib/gcc/x86_64-pc-linux-gnu"..., "/usr/lib/gcc/x86_64-pc-linux-gnu"..., "/usr/lib/gcc/x86_64-pc-linux-gnu"..., "-L/emul/linux/x86/lib", "-L/emul/linux/x86/usr/lib", "-Lfoo", "-L/usr/lib/gcc/x86_64-pc-linux-g"..., "-L/usr/lib/gcc/x86_64-pc-linux-g"..., "-L/usr/lib/gcc/x86_64-pc-linux-g"..., "-L/lib/../lib32", ...], [/* 73 vars */]) = 0
Bill