[fpc-pascal] cross compiling enigma
Sam Liddicott
sam at liddicott.com
Mon Dec 10 14:35:35 CET 2007
Jonas Maebe wrote:
>
> On 08 Dec 2007, at 19:26, Sam Liddicott wrote:
>
>>> So... because the makefile knew it was compiling for the same
>>> architecture it decided that I wasn't building an fpc cross compiler
>>> but cross building an fpc compiler? That's a bit unexpectedly clever...
>> So... this time:
>> $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ppc386
>> BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu-
>>
>> And, just like before, it has created a load of powerpc binaries:
>>
>> $ file /≈/usr/bin/postw32
>> /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB executable,
>> PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped
>
> "make clean all" does not put anything in usr/bin, so you at least alo
> have done a "make install" afterwards.
Yes, I'm modifying lazarus's create_fpc_deb.sh so it can also create
cross-compiler debs as well (this being simpler than fixing the scripts
in cross_unix)
>
>> So I'm still puzzled that the recipe for creating a cross compiler is
>> actually cross-compiling a compiler and cross-compiling the tools.
>>
>> Of course, compiler/ppcrossppc was created, but it seems as a precursor
>> to creating all the powerpc binaries.
>
> It's a cross compiler, which is indeed necessary to create PowerPC
> binaries.
>
yes... I was expecting ppcrossppc to be created, the rest was surprising me
>> So I still think I'm doing it wrong; was my make command line correct to
>> produce an fpc instance that will cross-compile for powerpc-linux?
>
> Cross compilers are only intended as add-ons to a native compiler
> suite. If you do a plain install, the Makefiles assume you want to
> create a native install for the target platform (although currently
> this will only work consistently if both the source and target
> platform have the same endianess).
>
> If you want to perform an add-on cross install (which will only
> install the cross compiler and units, but not the PowerPC-native
> compiler and utilities -- as the natively installed versions of those
> utilities will be used), do something like this:
>
> make FPC=`pwd`/compiler/ppcrossppc
> INSTALL_PREFIX=/tmp/fpc_patchdir/fpc_build/usr install CROSSINSTALL=1
>
this was the required tip, thanks
> (the CROSSINSTALL=1 may not even be necessary when you point FPC to
> the cross compiler, as the Makefile should detect that it's a cross
> compiler and set that variable itself)
It seems to be needed, and I think I have it working now, apart from
adding stuff to /etc/fpc.cfg when the cross compiler package is installed.
I see that the old cross_unix crosswin32 stuff tries to add like this:
# add -FD and -XP entry for cross compiling
echo '# set binutils paths for crosscompiling # fpc_crosswin32' >>
/etc/fpc.cfg
echo '#IFDEF FPC_CROSSCOMPILING # fpc_crosswin32' >>
/etc/fpc.cfg
echo ' -XPfpc-i386-win32-' >> /etc/fpc.cfg
echo '#ENDIF # fpc_crosswin32' >>
/etc/fpc.cfg
# end.
But that seems to presume there will be only one cross compiler
installed; do you have any hints on what to add to fpc.cfg?
Thank
Sam
More information about the fpc-pascal
mailing list