where is my cross compiler ? [SOLVED] lazarus / 64-FPC development ---------------------------------------------------------------------- lazer · 2017-10-06 15:46 As the central issue on my attempts to be able to cross compiler for win64 from linux64, my key issue seems to be that the cross-compiler isn't a cross-compiler at all. I pulled current trunk fpc built installed to /usr to avoid complications with hacking /etc/fpc.cfg and then breaking the system installed fpc. 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 distclean$make clean all OS_TARGET=win64 CPU_TARGET=x86_64$make crossinstall  OS_TARGET=win64 CPU_TARGET=x86_64  INSTALL_PREFIX=/usr Then when I check the supposed cross-compiler it only supports linux target , which I did not ask for and does not support win64 target which I specified. 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 $ /usr/lib/fpc/3.1.1/ppcrossx64  -iTOlinux  This would seem to be a fairly simple build option. What am I doing wrong? thx. ---------------------------------------------------------------------- Handoko · 2017-10-06 15:52 I am confused, I remember you previously want to cross compile from Windows but now from Linux. But that's okay, I don't know how doing cross compile from Windows but I know from Linux. 01. cd /usr/share/fpcsrc/3.0.2 02. sudo make clean all OS_TARGET=win32 CPU_TARGET=i386 03. sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr 04. sudo ln -sf /usr/lib/fpc/3.0.2/ppcross386 /usr/bin/ppcross386 Note: - Those steps above works for Linux to Win32, I never try to target Win64 - You need to change the "3.0.2" to the version you're using. After doing the things above, you must rebuild your Lazarus: Lazarus main menu > Tools > Configure Build Lazarus > Build -edit- Have you try this: https://github.com/cpicanco/stimulus_control/blob/master/docs/compilin g/cross_compiling.md ---------------------------------------------------------------------- lazer · 2017-10-06 16:29 thanks for the reply. I never was intending to build on Win. Some confusion there. 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 cd /usr/share/fpcsrc/3.0.4sudo make clean all OS_TARGET=win64 CPU_TARGET=x86_64sudo make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=/usrsudo ln -sf /usr/lib/fpc/3.0.4/ppcrossx64 /usr/bin/ppcrossx64  Isn't that basically what I just posted above , it seems to be the same text I was going from ( at another URL ). I have a fresh trunk svn not the debian src package. I have found one issue, the Makefile is installing the 64 bit build ( Fed 26 on x86_64) files into /usr/lib not /usr/lib64 as with the distro 3.0.2 , so this does not match the paths in /etc/fpc/cfg. I've moved them across so I now have : 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 $ls /usr/lib64/fpc3.0.2  3.1.1  but  ... 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 /usr/lib64/fpc/3.1.1/ppcrossx64 /back/coredata/hello.pasFree Pascal Compiler version 3.1.1 [2017/10/06] for x86_64Copyright (c) 1993-2017 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling /back/coredata/hello.pasFatal: Can't find unit system used by HelloFatal: Compilation aborted  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 $ls /usr/lib64/fpc/*/units      /usr/lib64/fpc/3.0.2/units:x86_64- linux /usr/lib64/fpc/3.1.1/units:x86_64-win64  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 $ls -ail  /usr/lib64/fpc/*/units/*/rtl/system*1333486 -rw-r--r--. 1 root root  851472 Mar 27  2017 /usr/lib64/fpc/3.0.2/units/x86_64-linux/rtl/system.o1333487 -rw-r-- r--. 1 root root  873458 Mar 27  2017 /usr/lib64/fpc/3.0.2/units/x86_64-linux/rtl/system.ppu 946070 -rw-r-- r--. 1 root root 1341962 Oct  6 16:53 /usr/lib64/fpc/3.1.1/units/x86_64-win64/rtl/system.o 945978 -rw-r-- r--. 1 root root  886996 Oct  6 16:53 /usr/lib64/fpc/3.1.1/units/x86_64-win64/rtl/system.ppu  3.0.2 can build my hello.pas , 3.1.1 can not , complaining about unit system . Can you see the problem? thx ---------------------------------------------------------------------- lazer · 2017-10-06 16:33 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 /usr/lib64/fpc/3.1.1/ppcrossx64 -iTOlinux I think I was mis-reading this as being part of the  problem. it is the pre-compiler so IS running on linux. ---------------------------------------------------------------------- Handoko · 2017-10-06 16:45 You mention 3.1.1 and 3.0.2, do you install both them together on the same PC? I never use 2 versions together. If I want the other version then I will remove the current version first. And I remember I must restart my Linux or some buggy things may happen. After doing the cross compiling, I usually rebuild my Lazarus and compile the project using Lazarus, because some units may need to rebuilt to target to that platform. Manually compiling using Terminal (or Command Prompt) may work but it is easier using Lazarus. ---------------------------------------------------------------------- lazer · 2017-10-06 16:56 OK , I've found the main error, I still needed to add target and processor options to the command line. 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  /usr/lib64/fpc/3.1.1/ppcrossx64 -Twin64 -Px86_64 hello.pasFree Pascal Compiler version 3.1.1 [2017/10/06] for x86_64Copyright (c) 1993-2017 by Florian Klaempfl and othersTarget OS: Win64 for x64  I now have a win64 exe file. :phew: Do you know whether the "x64" covers all  64 CPU for the fpc compiler ?  I'm guessing it does, but not sure. I may need some more fiddling to get laz to use the right one but I'm half way there. ---------------------------------------------------------------------- Leledumbo · 2017-10-06 17:19 Quote from: lazer on October 06, 2017, 06:29:06 pmThen when I check the supposed cross-compiler it only supports linux target , which I did not ask for and does not support win64 target which I specified. -iTO doesn't list all targets, check with -i instead. Every single ppcXXX supports all OSes on that architecture. Remember this is only the compiler, rtl and packages are on the same requirement level but separated. Quote from: lazer on October 06, 2017, 06:29:06 pmI have found one issue, the Makefile is installing the 64 bit build ( Fed 26 on x86_64) files into /usr/lib not /usr/lib64 as with the distro 3.0.2 , so this does not match the paths in /etc/fpc/cfg. The distro packaged one is different then. If you build from source, it will always installs to /usr/lib. FPC directory structure is designed smart enough to install multiple cross compiler toolchain (including host one). Quote from: lazer on October 06, 2017, 06:29:06 pm3.0.2 can build my hello.pas , 3.1.1 can not , complaining about unit system . Call fpc with proper -T and -P (or only -T if you execute ppcXXX). Quote from: lazer on October 06, 2017, 06:56:30 pmDo you know whether the "x64" covers all  64 CPU for the fpc compiler ?  I'm guessing it does, but not sure. Yes, it does (back to my first answer). ---------------------------------------------------------------------- lazer · 2017-10-06 18:08 Thanks, I have the two versions in /usr/lib64 now, see above. That works for my hello.pas passing args -T and -P as you described, to fpc.  The fpc side seems sorted out now. I can use fpc from command line and the -P ensures it gets the right version. My problem is now with lazarus which seems to be implicitly calling. fpc 3.0.2 with the correct options but there is no account of $fpcversion when I change the project target in Lazarus I see it is doing essentially the right thing but not using my new build. 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 Info: (lazarus) Execute Title="Test: Compiling an empty file"Info: (lazarus) Working Directory="/tmp/"Info: (lazarus) Executable="/usr/bin/fpc"Info: (lazarus) Param[0]="-Twin64"Info: (lazarus) Param[1]="-Px86_64"Info: (lazarus) Param[2]="-MObjFPC"Info: (lazarus) Param[3]="-Scghi"Info: (lazarus) Param[4]="-O1"  do you know how I can configure the project options to include fpc version and reach the right libs? thx ---------------------------------------------------------------------- Leledumbo · 2017-10-06 18:44 Quote from: lazer on October 06, 2017, 08:08:37 pmMy problem is now with lazarus which seems to be implicitly calling. fpc 3.0.2 with the correct options but there is no account of $fpcversion ... do you know how I can configure the project options to include fpc version and reach the right libs? Did you symlink the ppcXXX to /usr/bin (ls -l to double check)? Essentially that's the way you change compiler version, fpc will call corresponding ppcXXX for given -P in directory where it resides. ---------------------------------------------------------------------- lazer · 2017-10-06 19:16 I did symlink but I forgot to update it when move it all to /usr/lib64. Good catch. Fixed. when I hit the test btn in project options dlg I get this: 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 HINT: using config file /etc/fpc.cfgERROR: compiled FPC unit not found: system.ppuERROR: compiled FPC unit not found: objpas.ppuERROR: compiled FPC unit not found: sysutils.ppuERROR: compiled FPC unit not found: classes.ppuERROR: compiled FPC unit not found: avl_tree.ppuERROR: compiled FPC unit not found: zstream.ppu  those files are present in /usr/lib64/fpc/3.1.1/units/x86_64-win64/rtl console: 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 Info: (lazarus) Param[8]="-Fu/usr/lib64/lazarus/packager/registration/"Info: (lazarus) Param[9]="-FU/usr/lib64/lazarus/packager/units/x86_64-win64/"Info: (lazarus) Param[10]="fcllaz.pas"TIDEFPCParser.ImproveMsgUnitNotFound FindUnitInAllUsesSections failed due to syntax errors or system is not used in /usr/lib64/lazarus/packager/registration/fcllaz.pasError: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 256"Error: (lazarus) [TMainIDE.DoBuildProject] PkgBoss.DoCompileProjectDependencies failed  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 cat /usr/lib64/lazarus/packager/units/x86_64-win64/*        The thing about not finding system unit was what I was seeing with the hello.pas before I got the libs under the same struction in /usr/lib64. ---------------------------------------------------------------------- Leledumbo · 2017-10-07 05:41 Quote from: lazer on October 06, 2017, 09:16:58 pmwhen I hit the test btn in project options dlg I get this: Can you still build thr project? If yes, then that test button handler code might need fixes. AFAIK, those messages don't come from the compiler. ---------------------------------------------------------------------- lazer · 2017-10-07 08:22 No the project will only build for the local platfrom. When I change TARGET_OS and attempt to build,  the message panel shows: 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 Compile package FCL 1.0.1: Exit code 256, Errors: 1Fatal: Cannot find system used by fcllaz of package FCL. and I get this on the console: 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 TIDEFPCParser.ImproveMsgUnitNotFound FindUnitInAllUsesSections failed due to syntax errors or system is not used in /usr/lib64/lazarus/packager/registration/fcllaz.pasError: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 256"Error: (lazarus) [TMainIDE.DoBuildProject] PkgBoss.DoCompileProjectDependencies failed[WARNING] invalid source position for vertical gradient[WARNING] invalid source position for vertical gradient  Neither seems to be actual compiler output. This seems to be the same problem I had with hello.pas when the libs were in the wrong place ( /usr/l.ib rather than /usr/lib64 as indicated in fpc.cfg ). It seems odd that command line fpc now finds the correct cross compiler and the system.ppu for win64 but Lazarus does not. Each tree only has one platform's libraries, so this error suggests that it may not be calling the correct fpc version. Is there any means of getting more direct output ? If I could run a command line it may give a direct indication of the problem. thx ---------------------------------------------------------------------- lazer · 2017-10-10 08:08 OK, bottom line is that it seems Lazarus can not find the system libs if the cross-compiler is not the save version as the ppc native compiler. Neither can it sort it self out to build them as it is supposed to do when they are needed. This means you need to build both ppc and ppcross and set the appropriate symlinks. You can then no long rebuild either because of the version lock on building fpc  Similarly if I wanted to build the distro ppcross to keep it in sync with the disto fpc I would need to go and find fpc 2.6 to build that !  It's all a bit a run around. If Lazarus is to be able to cross compile without all this jiving around it needs to be able to cope with native fpc calling different versions of ppc and ppcross, which is what fpc will do in this situation. It currently seems to assume both are the same and goes looking in the wrong place for system.ppu and friends. It also does not build them when the cross TARGET is selected in the GUI, which is what it is advertised as being able to do. I have now been able to create my win54 exe file but it took a LOT of time to find out what was happening and what was needed. The resulting exe falls on its arse anyway, but that's another issue. [EDIT]  Thanks to some help on the mailing list this now runs perfectly on win64. The key factor was to compiler with win32 gui , not gtk2.