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

patspiper patspiper at gmail.com
Wed May 8 00:27:38 CEST 2013

On 08/05/13 00:01, Jonas Maebe wrote:
>> 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.
Removing -Xt eliminated error 216 and the cross compiler was 
successfully built for Linux/x86_64, Win/i386, Win/x86_64, and 
arm-WinCE! At least the cause of the bug is known now.

arm-linux failed, but for some other reason (editors.pas(3798) Error: 
Error while assembling exitcode 1).

Moreover, FPCMAKEOPT was no more needed once -Xt was removed!

I will test tomorrow if the win/i386 cross compiler actually works :) , 
and reinstate the include directive in the etc/ld.so.conf file.
>>>   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.
At least this is what https://wiki.ubuntu.com/MultiarchSpec says. But I 
cannot find this directory on my system.
>> 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.

I had gone through it scrounging for info. fpmake is almost undocumented 
(except for a wiki page).


More information about the fpc-pascal mailing list