[fpc-pascal] Cross-building on from Linux/x86-64 to Linux/i386 (was: Win64 release of FPC 2.6.2 missing)

Bruce Tulloch pascal at causal.com
Fri May 24 05:46:41 CEST 2013


While trying to debug my ARM cross-compile problems (in another email
thread) I decided to replicate the cross-compiler setup to i386 (to
compare it for clues) but I've run into another problem with x86_64 ->
i386 cross compiling which seems related to this thread.

My cross built fpc 2.7.1 works just fine for x86_64 -> i386 when fpc.cfg has:

  #IFDEF LINUX
    #IFDEF CPUI386
    -Xd
    -k--sysroot=/usr/local/opt/chroot/i386-linux-squeeze
    -FD/usr/local/opt/binutils/bin
    #ENDIF
  #ENDIF

that is, when built against a Debian Squeeze crossroot.

However when linked against a Wheezy crossroot:

  #IFDEF LINUX
    #IFDEF CPUI386
    -Xd
    -k--sysroot=/usr/local/opt/chroot/i386-linux-wheezy
    -FD/usr/local/opt/binutils/bin
    #ENDIF
  #ENDIF

It fails reporting lines like this:

     (.text+0x795): undefined reference to `__divdi3'

This indicates libgcc is not being pulled in (the Wheezy case).

Wheezy is multarch and -Xd means no standard locations are searched by
fpc anyway, so in light of these two bug reports:

    http://bugs.freepascal.org/view.php?id=24372
    http://bugs.freepascal.org/view.php?id=24262

I amended fpc.cfg as:

  #IFDEF LINUX
    #IFDEF CPUI386
    -Xd
    -k--sysroot=/usr/local/opt/chroot/i386-linux-wheezy
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/lib/i386-linux-gnu
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/usr/lib/i386-linux-gnu
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/lib/i486-linux-gnu
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/usr/lib/i486-linux-gnu
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/usr/local/lib
    -Fl/usr/local/opt/chroot/i386-linux-wheezy/usr/lib/gcc/i486-linux-gnu/4.4
    -FD/usr/local/opt/binutils/bin
    #ENDIF
  #ENDIF

It still did not pull in libgcc but I know libgcc.a in the correct
place (in the crossroot) so I recompiled with -Cn and linked with
ppas.sh after manually adding -lgcc to the GROUP statement in
link.res, it linked correctly.

So my question is; what am I missing in the wheezy case that means
libgcc is not applied during the link where as (with everything else
being identical) the squeeze case does work "out of the box" (i.e. no
explicit -lgcc needs to be applied in the link.res file).

Thanks, Bruce.

On Wed, May 8, 2013 at 2:34 AM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
>
> On 07 May 2013, at 18:17, patspiper wrote:
>
> > Cross compiler building is broken for FPC 2.7.1 on Ubuntu and Fedora. I had submitted a couple of bug reports and made several posts in this mailing list, but all went unnoticed or were not handled. I have almost lost hope.
> >
> > Bug reports:
> > http://bugs.freepascal.org/view.php?id=24262
>
> You presumably have to add something like CROSSOPT="-XR/path/to/your/32bit/root -Fl/directory/containing/your/32bitlibgcc". As Florian mentioned, the compiling the entire tree now depends on certain C libraries, and hence you have to tell the build process where to find these (and the associated startup code files) if they are not in the standard directories.
>
> > http://bugs.freepascal.org/view.php?id=24372
>
> And does the linker not interpret that parameter correctly? Even if it doesn't, that does not appear to be a problem specific to cross building.
>
>
> Jonas
>
> PS: when asking questions about a different topic, at change the subject (and preferably start a new thread altogether)_______________________________________________
> 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