Jonas Maebe wrote 12 lines
> I'm thinking that ld should be looking at:
>
> /mnt/engels/lib/libpthread.so.0
>
> but according to the error message it's looking at:
>
> /lib/libpthread.so.0
>
> which read literally would explain the error.
That's correct. It seems that -XR isn't completely implemented on Linux in the compiler. Could you try, *instead* of using -XR, to use -k--sysroot=/full/path/to/crossroot/ ?
I replaced the -XR option with
-k--sysroot=/mnt/engels
and that works (ie, you are correct, -XR does not appear to pass the sysroot to the linker) but there's another catch. Now I'm getting:
x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64/libdl.so when searching for -ldl
this library (on /mnt/engels) **is compatible** but it is a symlink:
/usr/lib64/libdl.so -> /lib/libdl.so.2
Given the specified --sysroot the linker should be looking at
/mnt/engels/lib/libdl.so.2
but I'm guessing it's looking at
/lib/libdl.so.2
which does not right to me. It looks like --sysroot is not analogous to chroot as far as the linker is concerned and symlinks are dereferenced literally.
For completeness I added
-XR/mnt/engels
as well, so all the (other) linker search paths are prepended with /mnt/engels. This ended up producing a slightly errnoeous message:
x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64
//libdl.so when searching for -ldl
Note the "//" in the reported path name before libdl.so.
This time it also reported the same error for glibc:
x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64//libglib- 2.0.so when searching for -lglib-2.0
again with the erroneous "//".
This glibc library is also a symlink to the /lib directory on engels.
I tried adding -k-rpath-link options to tell the linker to look in the relevant paths under /mnt/engels but all to no avail.
Bruce.