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

patspiper patspiper at gmail.com
Tue May 7 19:27:21 CEST 2013

<Continuation of discussion from "Cross-building on from Linux/x86-64 to 
Linux/i386 (was: Win64 release of FPC 2.6.2 missing)">

On 07/05/13 19:34, Jonas Maebe 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".

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 
-Xd -Xt -gl

None of the paths from CROSSOPT are mentioned in the above line.

In one experiment, I even put -Fl 64 bit paths in OPT. The above line 
compiled, but a [smart] error 216 occurred right after. I have no idea 
what that is.
> 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.

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 

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 

Moreover, make fpc_baseinfo... show GCCLIBDIR and OTHERLIBDIR to be 
empty. I am not sure if this is relevant or not.

I even setup a new Ubuntu 13.04 VM, and installed binutils from the repo 
(instead of building them myself) to no avail.
>> 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 or 
the new cross building (fpmake?) neglects to use it. I am inclined to 
believe the latter as fpcmake.ini contains:
OTHERLIBDIR:=$(shell cat /etc/ld.so.conf.d/* | grep -v "^\#" | awk '{ 
ORS=" "; print $1 }')
which should in theory list the ld paths, but produces (with FPC 2.6.3) 
instead -Flinclude and -Fl/etc/ld.so.conf.d/*.conf switches.

As a workaround for FPC 2.6.3, I passed the 64 bit paths in the LIBDIR 
parameter of make. Unfortunately, this workaround does not work with FPC 
> 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.


More information about the fpc-pascal mailing list