[fpc-pascal] Cross compiling x86_64 on i386 Linux.

Bruce Tulloch bruce at causal.com
Thu May 31 03:03:21 CEST 2012


In follow up, I updated and rebuilt the latest binutils

  http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz

and tried the patch associated with this bug report:

  http://sourceware.org/bugzilla/show_bug.cgi?id=10340

to see if my problem was due to this bug. It does not appear to be: the
link problem I've described remains true.

I'm thinking Tony Whyman's suggestion (building inside a chroot on a
64/32 bit host platform) is probably the best way forward for me now but
there does look like there's a problem with FPC (i.e. handling of -XR
apropos the ld) and GNU ld (i.e. the failure to prepend sysroot for
symlink dereferenced library files). If you concur on the latter point,
perhaps it might be worth reporting upstream to GNU?

Bruce.

On 31/05/12 10:39, Bruce Tulloch wrote:
> On 31/05/12 01:40, Jonas Maebe wrote:
>>
>>> 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.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list