Martin Schreiber wrote on Fri, 21 Aug 2015:
Cross compiling Linux-x86->eabihf of the program: " program rpiconsole; uses initc; begin end. " produces the messages: " Free Pascal Compiler version 3.0.1 [2015/08/14] for arm Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for ARMHF Compiling rpiconsole.pas Assembling rpiconsole Linking rpiconsole rpiconsole.pas(6) Warning: "crti.o" not found, this will probably cause a linking failure rpiconsole.pas(6) Warning: "crtbegin.o" not found, this will probably cause a linking failure rpiconsole.pas(6) Warning: "crtend.o" not found, this will probably cause a linking failure rpiconsole.pas(6) Warning: "crtn.o" not found, this will probably cause a linking failure
To be able to cross-compile a program that depends on a library for any Unix platform, you need to have a sysroot available with all of those libraries and their own requirements (such as crti.o and crtn.o for glibc, and crtbegin.o and crtend.o for gcc-compiled code). That is unrelated to FPC and inherent to the way linking works on (most) Unix platforms. If you want to cross-compile using gcc or clang, you also need to have the target platform's sysroot available.
It's also unrelated to ARM. The reason it works transparently on many Unix systems for cross-compiling between x86_64 and i386, is that these systems include both a sysroot for x86_64 and for i386.
The easiest is probably to copy the entire /usr hierarchy of the Raspberry Pi to your own machine, and then pass the parent directory in which you copied that "/usr" using FPC's -XR parameter.
As mentioned in the "Issue with linking" thread, you will have to separately tell FPC where to find crtbegin.o and crtend.o, as their location depends on the GCC version used. Since the sysroot path (-XR parameter) should be prepended to any search paths specified after the -XR parameter, make sure this path is relative to the sysroot. Use FPC's -va parameter to see which search paths get added exactly in case of problems (and possibly use -Cn and inspect the generated ppas.sh and link.res).
Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal