Need help to build FPC for PowerPC 64-bit big-endian ELFv2 lazarus / 1-Linux ---------------------------------------------------------------------- link4electronics · 2025-12-01 08:41 Hello everyone, I hope everything is okay. I'm trying to compile FPC for a machine running ArchPOWER Linux, powerpc64 big-endian ELFv2 platform. FPC versions provided to download are only for ppc64 big-endian ELFv1 or ppc64 little-endian ELFv2, and need ppc64 BE ELFv2. I tried to compile on a VM ppc64le using command Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make all OS_TARGET=linux CPU_TARGET=powerpc64 OPT="-Cb -Caelfv2" It compiles until ppc1 but can't run it since it's using ppc64le to be able to compile others binaries. Best regards, Link. ---------------------------------------------------------------------- dbannon · 2025-12-01 10:31 Hmm, probably just noise but ... I suspect you OPT="-Cb -Caelfv2" should be CROSSOPT="-Cb -Caelfv2" ? But no idea of what the options them selves should be in this particular case. Incidentally, should be possible to build a cross compiler from an x86 machine too, probably no harder. I think ... Oh, and you know that  to build version X of FPC, you must use version X-1 ? Davo ---------------------------------------------------------------------- marcov · 2025-12-01 10:57 You can crosscompile X using version X. A version must always be able to compile itself(as it is part of the bootstrap to compile itself). There are some rare exceptions for new architectures etc though. ---------------------------------------------------------------------- dbannon · 2025-12-01 11:41 Oh, well, did not know that. Hm, must have know it, my fpc compile script does, in fact use the newly built compiler ... Incidentally, my comment about building using your x86_64 box is incomplete too. You will also need the binutils-powerp64-linux-gnu, I think they work for both LE and BE but need to be told if not default. Davo ---------------------------------------------------------------------- link4electronics · 2025-12-01 21:13 Hello, Thanks for the suggestions and help. I forgot to say that I'm trying to compile version 3.2.2 But still can't compile it for ppc64 BE ELFv2. on x86_64 tried to compile as Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make all OS_TARGET=linux CPU_TARGET=powerpc64 CROSSOPT="-Cb -Caelfv2" BINUTILSPREFIX=/usr/bin/powerpc64-linux-gnu-, tried adding Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CROSSCOMPILE=1 , on x86_64 binaries were still compiled as for x86_64. on ppc64le they're for pp64le. On Arch Linux they're separate binutils packages for BE and LE, powerpc64-linux-gnu-binutils for BE and powerpc64le-linux-gnu-binutils for LE. Regards, Link. ---------------------------------------------------------------------- dbannon · 2025-12-02 11:09 Quote from: link4electronics on December 01, 2025, 10:13:33 pmBut still can't compile it for ppc64 BE ELFv2. on x86_64 tried to compile as Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make all OS_TARGET=linux CPU_TARGET=powerpc64 CROSSOPT="-Cb -Caelfv2" BINUTILSPREFIX=/usr/bin/powerpc64-linux-gnu- , on x86_64 binaries were still compiled as for x86_64. on ppc64le they're for pp64le. That is quite strange. Now, my notes tell me that I build my armhf compiler in a 64bit intel VM with - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make clean all CPU_TARGET=arm CROSSOPT="-CpARMV6 -CaEABIHF" CROSSBINDIR=/usr/arm- linux-gnueabihf/bin I end up with compiler/ppcarm and compiler/ppcrossarm. The file command confirms them as what they should be. Yours should be ppcpower64 or some such, a cross compiler that is x86_64 and a straight power64 compiler. The only difference I can see is the use of CROSSBINDIR=...  instead of BINUTILSPREFIX...   I take it your power binutils live in /usr/bin and are called powerpc64-linux-gnu-as, powerpc64-linux-gnu-ld etc ?  You have checked that they are actually there ? Mine is a debian based machine so no point me installing here. I am struggling to suggest something more. Perhaps do a make clean, pump a few blank lines and then run that compile command without the "clean" and have a look through the log, the early part, to see if its talking about the right thing. link4, we have to be realistic, there are not a lot of Power CPU users here. I logged a compile problem, a relativly minor issue on PowerLE a few years ago, while it got some comments, no fix unfortunately. The issue being, probably, none of the current devs have access to a Power64 machine. I sure don't ... Davo PS, my binutils look like this - Code: [Select]dbannon@u2004MnewBuild:~/bin/FPC/SRC/test$ ls -l /usr/arm-linux-gnueabihf/bin total 0 lrwxrwxrwx 1 root root 32 Mar 31  2025 ar -> ../../bin/arm-linux- gnueabihf-ar lrwxrwxrwx 1 root root 32 Mar 31  2025 as -> ../../bin/arm-linux- gnueabihf-as lrwxrwxrwx 1 root root 32 Mar 31  2025 ld -> ../../bin/arm-linux- gnueabihf-ld lrwxrwxrwx 1 root root 36 Mar 31  2025 ld.bfd -> ../../bin/arm-linux- gnueabihf-ld.bfd lrwxrwxrwx 1 root root 37 Mar 31  2025 ld.gold -> ../../bin/arm-linux- gnueabihf-ld.gold lrwxrwxrwx 1 root root 32 Mar 31  2025 nm -> ../../bin/arm-linux- gnueabihf-nm lrwxrwxrwx 1 root root 37 Mar 31  2025 objcopy -> ../../bin/arm-linux- gnueabihf-objcopy lrwxrwxrwx 1 root root 37 Mar 31  2025 objdump -> ../../bin/arm-linux- gnueabihf-objdump lrwxrwxrwx 1 root root 36 Mar 31  2025 ranlib -> ../../bin/arm-linux- gnueabihf-ranlib lrwxrwxrwx 1 root root 37 Mar 31  2025 readelf -> ../../bin/arm-linux- gnueabihf-readelf lrwxrwxrwx 1 root root 35 Mar 31  2025 strip -> ../../bin/arm-linux- gnueabihf-strip ---------------------------------------------------------------------- link4electronics · 2025-12-05 01:45 Hello, I'm happily to say that I got it working!  I ended up compiling branch fixes_3_2 from gitlab, which gave me version 3.2.3 Just compiled lazarus and goverlay to test it and confirmed that they work properly! I understand that this platform is old, but it still working great. LLVM project for eg.  is gonna drop support for ELFv1 for powerpc64 big-endian, and they'll only support ELFv2 for PPC64BE for version 22.x onward. Best regards, Link. ---------------------------------------------------------------------- dbannon · 2025-12-05 03:00 Excellent !  I'm guessing you wrote down what you did ? Please consider posting it here so there is a record. We really should have a central list of what make the various cross compilers work. Davo ---------------------------------------------------------------------- PascalDragon · 2025-12-05 20:13 Quote from: link4electronics on December 01, 2025, 10:13:33 pmThanks for the suggestions and help. I forgot to say that I'm trying to compile version 3.2.2 But still can't compile it for ppc64 BE ELFv2. on x86_64 tried to compile as Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make all OS_TARGET=linux CPU_TARGET=powerpc64 CROSSOPT="-Cb -Caelfv2" BINUTILSPREFIX=/usr/bin/powerpc64-linux-gnu-, tried adding Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CROSSCOMPILE=1 , on x86_64 binaries were still compiled as for x86_64. on ppc64le they're for pp64le. On Arch Linux they're separate binutils packages for BE and LE, powerpc64-linux-gnu-binutils for BE and powerpc64le-linux-gnu-binutils for LE. I built both 3.2.2 and 3.3.1 on my x86_64-linux ArchLinux using the following command line: Code: [Select]make all CPU_TARGET=powerpc64 CROSSOPT="-Cb -Caelfv2" BINUTILSPREFIX=powerpc64-linux-gnu- FPMAKEOPT="-T 8" -j 8 A binary compiled with the created ppcrossppc64 runs without problems with qemu-ppc64 and file outputs the following for it: Code: [Select]ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1 (SYSV), statically linked, not stripped Any yes, the created ppcppc64 also runs with qemu-ppc.