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

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

On 07 May 2013, at 19:27, patspiper wrote:

> It is the other way round. My OS is 32 bit Ubuntu and one of the targets is Linux/x86-64, so I assume you mean the 64 bit paths and not the 32 bit ones.
> I tried setting CROSSOPT (CROSSOPT="-XR/usr/lib64 -Fl/usr/lib/gcc/i686-linux-gnu/4.7/64"), but the line that fails ("/usr/bin/ld: cannot find -lgcc") is:
> /home/user1/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc fpmake.pp -n -Fu/home/user1/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit/units_bs/i386-linux -Fu/home/user1/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux -Xd -Xt -gl
> None of the paths from CROSSOPT are mentioned in the above line.

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. I also don't know where the "-Xd" comes from in the above compiler invocation. If you added that yourself, remove it again. 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).

> This is obvious, and libgcc, libc, crti.o came from a regular repository package install. In other words, they are supposed to be in the standard directories.

Do "standard cross-compilation library directories" exist on Linux in general? (as in "distribution-independent")

> libc.a and  crti.o are in: /usr/lib/i386-linux-gnu and /usr/lib64
> while libgcc.a is in: /usr/lib/gcc/i686-linux-gnu/4.7.3 and /usr/lib/gcc/i686-linux-gnu/4.7.3/64
> Moreover, make fpc_baseinfo... show GCCLIBDIR and OTHERLIBDIR to be empty. I am not sure if this is relevant or not.

Neither variable is set or used by the Makefile by default. I guess them being shown in "make info" is a relic from the past, and those lines should probably be removed.

>>> 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.
> I tried to replace the include directive with the actual paths. No improvement. Either it is not needed by the cross building process

It is most likely completely unrelated to what you are experiencing here.

>> PS: when asking questions about a different topic, at change the subject (and preferably start a new thread
> Definitely, though my post was inspired by your post regarding the difficulty of building of cross compilers.

It was not about building cross-compilers. It was about compiling regular programs using using cross-compilers that we have already compiled and configured in advance and offer for download on our website.


More information about the fpc-pascal mailing list