Cross compilation from Linux Debian to Windows32 lazarus / 1-Linux ---------------------------------------------------------------------- gelinp · 2015-10-07 17:51 Hi, I'm using lazarus 1.2.4+ with FPC 2.6.4 under Linux Debian. I understand that only FPC with linux binary was installed into this version of lazarus, but I'm not sure.... I would like to use cross compilation to produce windows binaries with debian. I followed Cross compiling for win32 under Linux but I failed to compil my test project. The error is that lazarus can't find system libraries, I suppose win32 system libraires. This is probably because this tutorial is not complet. I think I have to build win32 binaries for FPC too... So I installed FPC 3.1.1 because for FPC 2.6.4 I understand I will need an older version of gnu make and I can't find it for debian (and also I don't know how to install with a newer version already installed). So FPC 3.1.1 is a work in progress, and fpcbuild/install/INSTALL file show me I first have to creating *src.zip files. But make sourcezip command display an error message : 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 gelinp@insp iron:~/07_ADMINISTRATION_SYSTEME/DOSSIERS_PRODUITS/FPC/fpcbuild$ make sourcezipmake: execvp: /usr/local/bin/pwd.exe: Permission non accordéeMakefile:135: *** Compiler .exe not found. Arrêt.  Why makefile is looking for windows pwd.exe under Debian ? I don't understand where is te problem. By the way I try to compil win32 FPC binaries  and I need to use NOGDB=1 option. Why ?: Code: [Select]make all OS_TARGTE=win32 CPU_TARGET=i386 NOGDB=1 Thank you for your help ! ---------------------------------------------------------------------- Handoko · 2015-10-07 19:22 Hello gelinp. I'm not an expert in cross compiling, but I managed to make it work on my Ubuntu 64-bit. 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/2.6.4sudo make clean all OS_TARGET=win32 CPU_TARGET=i386sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usrsudo ln -sf /usr/lib/fpc/3.1.1/ppcross386 /usr/bin/ppcross386 Run the code above on your Terminal. You may need to change the folder name on line no. 1 and no. 4. Good luck! ---------------------------------------------------------------------- Leledumbo · 2015-10-08 03:03 Quote from: gelinp on October 07, 2015, 07:51:27 pmI followed Cross compiling for win32 under Linux but I failed to compil my test project. The error is that lazarus can't find system libraries, I suppose win32 system libraires. This can't be true, PE doesn't require target platform libraries to exist at compile time. Quote from: gelinp on October 07, 2015, 07:51:27 pmI think I have to build win32 binaries for FPC too... Certainly no, it's not a cross compiling if it's true. Quote from: gelinp on October 07, 2015, 07:51:27 pmWhy makefile is looking for windows pwd.exe under Debian ? I don't understand where is te problem. No idea, I never (need to) execute `make sourcezip`. Quote from: gelinp on October 07, 2015, 07:51:27 pmBy the way I try to compil win32 FPC binaries  and I need to use NOGDB=1 option. Why ?: Code: [Select]make all OS_TARGTE=win32 CPU_TARGET=i386 NOGDB=1You don't need to if you have libgdb.a for win32. For 3.1.1, you can also pass GDBMI=1 for the IDE to use external gdb instead of embedding libgdb.a. It's kinda weird, though. My cross build FPC never builds any of the utilities including but not limited to the IDE, only the compiler. ---------------------------------------------------------------------- gelinp · 2015-10-08 14:52 Hi, When you say : Quote from: Handoko on October 07, 2015, 09:22:33 pmCode: 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/2.6.4sudo make clean all OS_TARGET=win32 CPU_TARGET=i386sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usrsudo ln -sf /usr/lib/fpc/3.1.1/ppcross386 /usr/bin/ppcross386 I can't make clean because into /usr/share/fpcsrc/2.6.4 there is no Makefile ! There is Makefile only into the three sub folders  : compiler, package and rtl. So, do I need to repeat this compilation trhee times into this three sub folder ? Thank you for your help ! ---------------------------------------------------------------------- Handoko · 2015-10-08 15:34 That's strange. Some months ago, I tested to uninstall and reinstall Lazarus/FPC with the code above several times without any problem. Have you tried to perform a clean installation? Also, have you tried the lastest release? Last time I run the code was on Lazarus 1.4.2, not sure if it also works on 1.2.4. Here if you want to download the latest version of Lazarus/FPC: http://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64% 20DEB/Lazarus%201.4.4/ Note: You have to install all the 3 packages or strange thing might happen. Quote from: gelinp on October 08, 2015, 04:52:00 pmSo, do I need to repeat this compilation trhee times into this three sub folder ? Not sure, but on my case, I only run the code once and everything works correctly. ---------------------------------------------------------------------- gelinp · 2015-10-08 19:03 Are you sure for the directory where looking for the Makefile ? Because there is /usr/lib/lazarus/1.2.4/ with one into... Do I need to recompile lazarus and FPC, or only FPC ? I was lookking for /usr/share/fpcsrc/2.6.4/Makefile into package files list with synaptic and I couldn't find anything like this. There is only the three directories like I said : compiler, package and rtl, each one with a Makefile... So it's not a reinstall to correct it. ---------------------------------------------------------------------- Handoko · 2015-10-08 19:17 I've never used Lazarus 1.2.4, nothing I can say about it. I used Lazarus 1.4.2 when cross compiling. I remember when I managed to cross compile to win32, I was so happy, so I copy-pasted and saved the steps immediately to a text file. And I tested the steps several times by uninstall and reinstall following the steps. Everything just run smoothly and the produced exe file run correctly on Windows. I ever tried Lazarus installation provided by Ubuntu Software Center. But I found that their package was not the latest version and had many issues. So after that, I only use the installation provided by Lazarus website. ---------------------------------------------------------------------- gelinp · 2015-10-08 20:29 So now I've installed all the stuff of last lazarus version. There is now a /usr/share/fpcsrc/2.6.4/Makefile ! It's great !!! But there is a problem again : 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 gelinp@inspiron:/usr/share/fpcsrc/2.6.4$ sudo make clean all OS_TARGET=win32 CPU_TARGET=i386make: execvp: /usr/local/bin/pwd.exe: Permission non accordéeMakefile:135: *** Compiler .exe not found. Arrêt.gelinp@inspiron:/usr/share/fpcsrc/2.6.4$ sudo make clean all OS_TARGET=win32 CPU_TARGET=i386make: execvp: /usr/local/bin/pwd.exe: Permission non accordéeMakefile:135: *** Compiler .exe not found. Arrêt.  It looks like Makefile is running with Windows platform environment ...  But I'm under Linux debian ! So, I tried to rebuild the Makefile with 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 sudo fpcmake but nothing else... Do you have an idea ? ---------------------------------------------------------------------- Handoko · 2015-10-09 02:08 Oh, it seems now the issue is about the Linux thing. Sorry I'm just a Linux common user, not much I can help. Perhaps you need to ask it on Linux forum. It really works smoothly on Ubuntu Linux. ---------------------------------------------------------------------- gelinp · 2015-10-09 05:01 OK, thank you for your help ! I'm just continuing into FPC / general subject. ---------------------------------------------------------------------- dogriz · 2015-10-09 12:23 Compare your steps with this: http://dogriz.blogspot.rs/2014/10/lazarus-fpc-cross-compile-linux- windows.html ---------------------------------------------------------------------- JazzMazz88 · 2015-11-06 10:10 I think the instructions are buggered or something. What happened to the long list saying how to rebuild everything for everything? Those are the instructions we need. And is Fedora copy f*d up somehow? I have only x64 binary and it wont build the 386 compiler needed to use the crosscompile feature. It only complains that the ppc386 file is missing. Why are distros allowed to repack our sources in such a way that rebuild or crossbuild is broken? Debian has a missing makefile in the root folder, that the official sources have. They say thats on purpose but Im not buying thier load of crap. They need to give us the sources as packaged HERE on the website, not however they want. Same with other distros. But oddly we have lazarus and fp and fpc working just fine. Dunno about yall, but I WANT multi-arch on my 64bit system. That should not be a disabled option. 32bit systems dont have to worry about this. At a minimum though, install all mingw32* or mingw64* packages. That solves a lot of headaches.And yeah, for some reason you are trying to invoke a windows binary on a linux system there without using wine.I think thats a bug. ---------------------------------------------------------------------- Thaddy · 2015-11-06 10:37 On most Debian it is enough to create some symlinks in /usr/bin that point to /usr/local/bin if that helps. When compiling/installing you should be aware of the options.