Cross-Compiling from Suse 15.2 to Win64 lazarus / 1-Linux ---------------------------------------------------------------------- diogenes · 2021-07-11 09:56 Hello, I read the article https://wiki.freepascal.org/Cross_compiling_for_Win32_under_Linux but I can't find a version directory for free pascal in /usr/share/fpcsrc/. Instead, I find packages/ and rtl/. Did I do something wrong when installing (from official repos, by the way). Do I have to re-install after cleaning up? I have no idea. ---------------------------------------------------------------------- lucamar · 2021-07-11 10:23 There should be a version directory (see image); if I were you I would deinstall (and clean-up) and reinstall ---------------------------------------------------------------------- diogenes · 2021-07-11 11:28 Oh. What do you mean with clean-up, by the way? ---------------------------------------------------------------------- diogenes · 2021-07-11 12:00 Re-installed, now from SourceForge's RPMs. If there are problems with cross-compiling, I'll come back again. ---------------------------------------------------------------------- diogenes · 2021-07-11 12:52 It just had to be. I could run the three commands recommended by the site, tried the cross-compile with my little project, and now I get another error: the compiler could not find db used by fcllaz. I tried to find the windows compilates on ym computer to set an additional unit path, and found nothing. Where does the the problem sit if not between keyboard and chair? ---------------------------------------------------------------------- dbannon · 2021-07-11 13:27 diogenes, where have you installed FPC from ?  By that I mean, is it from a SUSE repo ?  Or did it come from SourceForge ? Distributions like to package up the FPC (and Lazarus) in ways that they consider correct but conflict with what people on this forum expect. If its a Distro package, you may have issues building the cross compilers.  So, lucamar's advice may be particularly helpful, uninstall and then reinstall using the SourceForge packages. I have not used the RPMs to install FPC recently so cannot be sure of the installed directory structure but it did use to be as described in the wiki. Davo ---------------------------------------------------------------------- diogenes · 2021-07-11 13:35 I did install the SourceForge packages. Only after that the building of the cross-compiler worked. Maybe I didn't configure the cross-compiling as such correctly? Perhaps you can help me on that. ---------------------------------------------------------------------- Fred vS · 2021-07-11 14:26 Hello. Instead of cross-compiling, you may use the original fpc.exe compiler via the wine Windows-emulator. When wine is installed on your computer, download the Windows fpc installer: https://sourceforge.net/projects/freepascal/files/Win32/3.2.2/ Then install fpc for Windows on your Linux machine: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ wine fpc-3.2.2.win32.and.win64.exe Then, to compile your source for Windows, just do: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ wine fpc.exe yourapp.pas I use this since ages and it works perfectly. The other advantage with wine emulator is that you may test yourapp.exe on your Linux machine. [EDIT] I just test to install Lazarus for Windows via wine on Linux 64 bit and it works perfectly too. Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ wine /home/fred/Downloads/lazarus-2.0.12-fpc-3.2.0-win64.exe Fre;D ---------------------------------------------------------------------- diogenes · 2021-07-11 15:11 Sounds like an idea. Are there wine config problems? ---------------------------------------------------------------------- diogenes · 2021-07-11 15:26 Works great! Thanks a lot, @Fred vS! ---------------------------------------------------------------------- dbannon · 2021-07-12 01:15 Sorry diogenes, what you say here does not make sense to me - Quote from: diogenes on July 11, 2021, 03:35:10 pmI did install the SourceForge packages. Only after that the building of the cross- compiler worked. So, its all working now then ? Quote from: diogenes on July 11, 2021, 03:35:10 pmMaybe I didn't configure the cross-compiling as such correctly? Perhaps you can help me on that. If you are still having problems now, as your last sentence might indicate, can you please tell us at what stage the process fails ?  Setting up Windows cross compile from Linux is a step by step process, if you tell us at what step you are having problems, maybe we can help. Generally, once setup, its quite reliable.  And being able to directly generate Windows binaries from your Linux install is quite convenient. Please tell us what version of FPC you are using, what step in the wiki instructions you are aware that things have failed, in what directory you are at that time, what error message you receive, and, perhaps a list  of the files in that directory, at that time. (Sorry, the batteries in my crystal ball are flat  ) Davo ---------------------------------------------------------------------- diogenes · 2021-07-12 12:03 Well then  FPC 3.2.0 and Lazarus 2.0.12 I created the cross-compiler and set the softlink successfully. I set the target of the project to windows 64 and the target processor family to x86_64 This is where I stand. Where do I find the units, and so on? ---------------------------------------------------------------------- dbannon · 2021-07-13 06:48 You are the master of the short message diogenes !  But use of this forum is free, you are not charged per word posted. Are you asking about a Wine based install or a normal cross compile install ? If the later, I might be able to help if you answer more of the questions in my previous post. Davo ---------------------------------------------------------------------- diogenes · 2021-07-13 14:01 Sorry  However, I'll not discuss compiling per Wine. I got that, and this works perfectly, if a bit slow, which is probably nobody's fault. Now, I therefore got problems with normal cross-compile. Let''s tell a little story I followed the Wiki article as long as possible, and managed to compile the cross-compiler using the following commands: 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 OS_TARGET=win64 CPU_TARGET=x86_64make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=/usrln -sf /usr/lib/fpc/3.0.0/ppcrossx64 /usr/bin/ppcrossx64 Then, I switched compile target to win64 and processor family to x86_64 as in this screensho as in attachment 1 Trying to compile yieldf attachment 2 The error message reads in English: "fcllaz.pas(11,3) Fatal: Couldn't find db Kann db used by fcllaz of Package FCL". End of story. Good question how to make the compiler find that unit. ---------------------------------------------------------------------- dbannon · 2021-07-14 02:34 Great bug report diogenes !  Now we are getting somewhere. fcllaz is a lazarus package that pulls in FPC "libraries".  In this case, its looking for db, and that should be in the FPC source directory. In my case (and I have a different FPC install than you) its in /fpc-3_2_0/packages/fcl-db/src/base/db.pas.  So, first question, you have installed the FPC Source package that you found along side the compiler ?  Hmm, RPMs ?  You probably used https: //sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20x86_64%20RP M/Lazarus%202.2RC1/fpc-src-3.2.2-1.x86_64.rpm/download ? Thats FPC-3.2.2, if you have FPC-3.2.0 use a src package from there please. If you do already have the FPCSRC, has Lazarus found it ?  Did it give you a warning on first start ?  It could still be looking in the place where the SUSE install put the src.... If still reading, maybe you need to find that db.pas file yourself, in the IDE,  to prove its there ? The IDE will have highlighted the fcllaz.pas line that looks like 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 uses db, .... click on the word, 'db' and press ALT-UpArrow, (or just hover your mouse over it) - that should take you to the unit in question. If not, its most certainly a case of the IDE not being able to find FPC Source. From memory, in a package install, its in /usr/share/FPC...... or something similar. Anyway, you do need both the FPC compile package AND the FPC source package. (Oh, and sorry for the bite, I did not realise you were not a native english speaker! My bad...) Davo ---------------------------------------------------------------------- diogenes · 2021-07-17 06:33 Apart from having been sick for a few days, I was busy elsewhere. Sorry 1) Indeed use FPC 3.2.0 2) When I look for the unit by Alt+Up, I get the (translated) message, "fcllaz.pas (11,3) Fatal: Cannot find db used by fcllaz from Package FCL. " 3) I found db.pas in /usr/share/fpcsrc/3.2.0/packages/fcl-db/src/base/ but when I include this, I get the same results ---------------------------------------------------------------------- dbannon · 2021-07-17 11:10 Hmm, do you have this problem when compiling a 'native' app ?  That is one for Linux, 64bit ? Please go to Lazarus Tools->Options->Environment->Files That has a field, "FPC Source Directory", in your case it should be, perhaps "/usr/share/fpcsrc/3.2.0" - please confirm that. When you were doing your setup earlier, you did run "sudo make all OS_TARGET=win64 CPU_TARGET=x86_64" didn't you ?   I ask because the instructions on https://wiki.freepascal.org/Cross_compiling_for_Win32_under_Linux look a bit disjointed I must admit.  I use use my own notes that are specific to my install. I have just built a suse Leap 15.3 VM as part of my test process for my app, I think I have better do what you are trying there and document it from scratch. I'd assume FPC and Lazarus from sourceforge, as RPMs in this case and you wan to end up making windows binaries.  In the past, I have always found this easy, the hard part is getting the 64->32bit stuff ! Davo ---------------------------------------------------------------------- dbannon · 2021-07-17 13:04 Ah, diogenes, I have just built a system here on a SUSE VM and you will be very pleased to know that I can achieve exactly the same result, fcllaz - cannot find db unit ! Maybe you missed the instruction to add something to fpc config file to tell it your new windows units were compiled to  - Code: [Select]/usr/share/fpc/3.2.0/units/x86_64-win64/fcl-db/db.o   // and db.ppu that means you need to add a line into your fpc.cfg file that tells the compiler where to look for those units, you can either edit /etc/fpc.cfg as root or copy it to your home dir and call it .fpc.cfg  but either way, it needs a line, ideally just under this comment as shown Code: [Select]# searchpath for units and other system dependent things -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* That made it all work here. Please let us know if this solves your problem, the cross compiling page is a mess, it will make me do something about it .... Davo ---------------------------------------------------------------------- diogenes · 2021-07-18 07:55 Do you mean -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* literally or shall I replace the directories beginning with $ with explicit ones? By the way, I was tipped off in this thread for installing wine and the windows version of lazarus to make Windows binaries. Works well ---------------------------------------------------------------------- dbannon · 2021-07-18 11:19 Quote from: diogenes on July 18, 2021, 09:55:41 amDo you mean -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* literally or shall I replace the directories beginning with $ with explicit ones? By the way, I was tipped off in this thread for installing wine and the windows version of lazarus to make Windows binaries. Works well Exactly that line as shown. If you look in fpc.cfg, you will see lots of similar lines, at compile time the $something variables are resolved. I have replaced a lot of the old content of the wiki page on making a Linux->Windows cross compiler and I consider it a lot more readable. There was content about updating your fpc.cfg in there but it was so convoluted you can be well and truly be excused for missing it.   I would appreciate it if you had a quick look to see if you would have been more more successful if you used it instead. If using wine works for you, great !  But I use a set of cross compilers to release my application (and lots of pre-release test bundles) and do not regret the effort of setting it up. A lot might depend on what you are doing, if its a long term project.... I can spit out 64 and 32bit deb and rpm packages and two Windows executables with one script.  Davo