[fpc-pascal] Cross-building on from Linux/i386 to Linux/x86-64

Jonas Maebe jonas.maebe at elis.ugent.be
Tue May 7 23:01:01 CEST 2013

On 07 May 2013, at 22:43, patspiper wrote:

> On 07/05/13 21:01, Jonas Maebe wrote:
>> That is by design. fpmake runs on the host, not on the target. /home/user1/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc is a native compiler (so i386->i386 in your case). Options specific to compiling fpmake can be passed using FPMAKEOPT, so add FPMAKEOPT="-Fl/path/to/32bit/libgcc/directory" to your build invocation.
> Shouldn't it be FPCMAKEOPT for compiling fpmake.pp? FPMAKEOPT seems to pass options to fpmake itself.

Yes, sorry.

> Cross compiling for Linux/x86_64 with FPCMAKEOPT="-Fl/usr/lib/gcc/i686-linux-gnu/4.7" went past the previous error point, but yet yielded another error:
> ./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Px86_64 -o -XPx86_64-linux- -o -Xr -o -Ur -o -Xs -o -O2 -o -n -o -Fu/home/user1/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/x86_64-linux -o -Cg -o -Xt -o -dx86_64 -o -dRELEASE --compiler=/home/user1/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppcrossx64 -bu -sp -o -XX -o -CX
> make[2]: *** [smart] Error 216
> make[2]: Leaving directory `/home/user1/Programs/fpc/fpsrc/exported/2.7.1/packages'
> make[1]: *** [packages_smart] Error 2
> make[1]: Leaving directory `/home/user1/Programs/fpc/fpsrc/exported/2.7.1'
> make: *** [build-stamp.x86_64-linux] Error 2
> What could be causing this error?

Error 216 is a segmentation fault. It looks like a bug in fpmake. I've never seen this before. I don't know what causes it.

> Note: I used the following (part of a script) to build the cross compiler (the 1st one triggers the errors):
> ${MAKE} clean all OS_TARGET=${OS} CPU_TARGET=${CPU} OPT="-Xt" FPCMAKEOPT="-Fl/usr/lib/gcc/i686-linux-gnu/4.7"
> ${MAKE} crossinstall INSTALL_PREFIX=${DESTDIR} OS_TARGET=${OS} CPU_TARGET=${CPU} OPT="-Xt" CROSSOPT="-Xd" FPCMAKEOPT="-Fl/usr/lib/gcc/i686-linux-gnu/4.7"

I would get rid of the -Xt and use a proper -XR parameter instead of -Xd.

>>  I also don't know where the "-Xd" comes from in the above compiler invocation. If you added that yourself, remove it again.
> I inherited it from the buildcrosssnapshot script found in fpcbuild-2.6.2.zip, and never even thought about its effect.

That script probably hasn't been used for ages. It's probably best to remove it in order to prevent confusion like you are encountering.

>> At most, you can add it to CROSSOPT, but never to OPT (since it tells FPC to not search the standard library paths and OPT is used for "native" compiles, so why would you want the compiler not to search the standard library paths when doing native compiles?). And you don't need it at all, not even in CROSSOPT, if you use -XR in CROSSOPT (or rather: you mustn't use it at all if you use -XR, since that will then prevent the compiler from searching the standard library paths under the alternative root).
> I suppose the multiarch root path for Linux/x86_64 should be /usr/lib/i686-linux-gnu, but this directory does not exist even on Ubuntu 13.04. Any ideas?

Other than the fact that there are barely any standards on Linux? No.

> Note: Are crossall, FPMAKEOPT, FPCMAKEOPT, etc.. mentioned in any fpc manual? I could not find them.

They might be part of Marco's buildfaq, but I don't know whether it has been updated already for fpmake.


More information about the fpc-pascal mailing list