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

Bruce Tulloch bruce at causal.com
Tue May 29 04:19:50 CEST 2012


Closer, but not quite there yet...

To get this going I've (sshfs) mounted a 64 bit system on /mnt/engels
and then attempted to cross-compile on the 32 bit system with:

  fpc -MDelphi -Scgi -CX -O3 -OoUNCERTAIN -OoREGVAR \
  -Tlinux -Px86_64 -Xs -XX -va -l \
  -dLCL -dLCLgtk2 -XR/mnt/engels

This compiles but fails at the linker:

  Searching file /mnt/engels/usr/lib64/crtn.o... found
  Searching file /usr/local/opt/binutils/bin/x86_64-linux-ld... found
  Using util /usr/local/opt/binutils/bin/x86_64-linux-ld
  /usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible
/lib/libpthread.so.0 when searching for /lib/libpthread.so.0
  /usr/local/opt/binutils/bin/x86_64-linux-ld: cannot find
/lib/libpthread.so.0
  Error: Error while linking
  Fatal: There were 1 errors compiling module, stopping

The linker

 /usr/local/opt/binutils/bin/x86_64-linux-ld

was created using (an appropriately modified)

  fpcfixes_2.6/cross/buildcrossbinutils

i.e. built to run on i386 and target x86_64

  MYINTEL=i386
  TARGETS_X86_64="linux"

and the pthread library is (presumably, given the -XR option)

  /mnt/engels/lib/libpthread.so

which file reports as

  libpthread-2.11.3.so: ELF 64-bit LSB shared object, x86-64, version
  1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
  2.6.18, not stripped

How can I find out why x86_64-linux-ld reports it as incompatible?

Many thanks, Bruce.

On 05/28/12 23:02, Jonas Maebe wrote:
> 
> On 28 May 2012, at 14:56, Bruce Tulloch wrote:
> 
>> Am I correct to assume that if I drag in the x86_64 libraries I need
>> from another x86_64 system, put them in a local directory and then
>> reference then using the -XR option I can make this setup work?
> 
> -XR is for pointing the compiler/linker to the top of a complete sysroot (i.e., a hierarchy with /lib, /usr/lib etc), not to a directory with just few handpicked libraries. For the latter, use the -Fl command line switch instead, possibly combined with -Xd (to prevent the compiler from passing the default system directories as search paths to the linker).
> 
> And yes, that should indeed work fine.
> 
> 
> Jonas_______________________________________________
> 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