Forum > FPC development
Cross-compile FPC on ppc64 for ppc64le
ferseiti:
Hello. I have been trying to build fpc for target ppc64le but using a ppc64 Fedora vm.
What I did so far was:
Create a script /usr/bin/powerpc64-linux-ld that runs
--- Code: --- ld -A elf64lppc $@
--- End code ---
And create a /usr/bin/powerpc64-linux-as that runs
--- Code: ---as -little $@
--- End code ---
Then:
--- Code: ---make all CROSSOPT="-Cb- -Caelfv2" BINUTILSPREFIX=powerpc64-linux-
--- End code ---
But the build fails with several errors just like this one:
--- Code: ---ld: powerpc64/units/powerpc64-linux/dbgstabs.o: compiled for a little endian system and target is big endian
ld: failed to merge target specific data of file powerpc64/units/powerpc64-linux/dbgstabs.o
pp.pas(238,36) Error: Error while linking
pp.pas(238,36) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
--- End code ---
I am probably doing something wrong, of course. Any help will be appreciated.
Thanks
Jonas Maebe:
As mentioned at http://bugs.freepascal.org/view.php?id=26261#c81964 , building a ppc64le installation on a big endian ppc64 is not possible at this time using the top level Makefile, because we don't have support yet for having multiple ABIs of a single platform in one source tree (which you need when bootstrapping ppc64le on a ppc64 platform).
The easiest way to bootstrap is to cross-build on a non-ppc64 machine instead (with the make invocation that you used), and then copy the resulting bootstrap compiler (compiler/ppcppc64) to your ppc64le system.
ferseiti:
That was a quick response :)
Yes, I saw that bug, but I didn't quite get it from there.
I will give it a try and post the outcome here.
Thank you!
Jonas Maebe:
Alternatively, if you really want to bootstrap on a big endian ppc64 machine:
* build svn trunk for regular ppc64 using a plain make all (note that you can speed up compilations on multicore machines by adding -j X FPMAKEOPT="-T X", with X the number of cores)
* move compiler/ppcppc64 to a temporary location (e.g. $HOME/bin/ppc64n)
* go into fpc/rtl/linux, and execute make FPC=$HOME/bin/ppc64n OPT="-Cb- -Caelfv2 -O2 -a -st" clean all
* then go into fpc/compiler and execute the same there
* scp -r fpc/rtl/units ppc64le-machine:fpc/rtl and then on ppc64le-machine in fpc/units/powerpc64-linux execute for file in *.s; do as -o `basename $file .s`.o $file; done
* scp -r fpc/compiler/powerpc64/units ppc64le-machine:fpc/compiler/powerpc64/units ; scp ppas.sh link.res ppc64le-machine:fpc/compiler
* edit ppas.sh and link.res on the ppc64le machine to adapt the paths to the various files (if necessary) and finally execute ./ppas.sh in the compiler directory on the ppc64le machine. The compiler binary will be called "pp"The above method is generally what I use to bootstrap compilers for a new platform, so that I don't need cross binutils.
ferseiti:
As a matter of fact, I also contacted Jaromír Cápík (reporter of http://bugs.freepascal.org/view.php?id=26261).
He was able to generate a binary which he sent to me and I saved as $HOME/fpc/bin/fpc
Then I ran:
--- Code: ---make compiler_cycle PP=$HOME/fpc/bin/fpc
cp ./compiler/ppcppc64 $HOME/fpc/bin/ppcppc64
make install PP=$HOME/fpc/bin/ppcppc64
--- End code ---
I will try to bootstrap it anyway. Haven't tried yet.
Too bad it wasn't able to build v2.6.4 with the result (The version available in Debian repository).
--- Code: ---/usr/local/bin/ppcppc64 -Ur -Ur -Xs -O2 -n -Fi../inc -Fi../powerpc64 -Fi../unix -Fipowerpc64 -FE. -FU/root/fpc/fpc-debian/fpc-2.6.4+dfsg/fpcsrc/rtl/units/powerpc64-linux @/root/fpc/fpc-debian/fpc-2.6.4+dfsg/debian/deb-host-fpc.cfg -dpowerpc64 -dRELEASE -Us -Sg system.pp
systemh.inc(508,3) Fatal: Cannot find system type "TEXTREC". Check if you use the correct run time library.
--- End code ---
Navigation
[0] Message Index
[#] Next page