[SOLVED] Problem with Cross Win in Kubuntu 10.04 and 12.04 lazarus / 1-Linux ---------------------------------------------------------------------- Joe · 2010-05-28 08:22 Hi There! I was using FPC & Lazarus since under Kubuntu about 5 month after I switched from Windows & Delphi. Currently, I need to compile for X86 Linux and Win32. In December 2009 (running Kubuntu 9.10) I installed FPC-2.2.4-3 via Synaptic and lazarus_0.9.28.2_i386.deb downloaded from http://sourceforge.net/projects/lazarus/files/ and fpc_crosswin32_2.2.4-091003_i386.deb also from sourceforge Compiling native for Linux and cross for Win32 works well with this configuration Now I updated my Kubuntu to 10.04 this also updated FPC to 2.4.0-2 - but just the native compiler and not the Win32 crosscompiler Because of the different versions of the native Linux and the cross Win32 compiler, crosscompiling wont work longer. After seaching a while, I'm unable to find something like fpc_crosswin32_2.4.0-xxxxxx_i386.deb Did I have to compile this myself (don't know how to do this)? Ok, I tried to downdate my FPC to 2.2.4 but after removing the 2.4.0 (using synaptic), /usr/bin/fpc is still present and "fpc -iV" echoes "2.4.0". And I also can see something in /usr/lib/fpc/2.4.0 Trying to install fp-compiler_2.2.4-3_i386.deb from fpc-2.2.4-3.i386.deb.tar results in a message like: "There is a newer version already installed." Any suggestions? Thanks in advance, Joe. ---------------------------------------------------------------------- JuhaManninen · 2010-05-30 10:30 I haven't done it myself but here are the instructions: http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Lin ux Juha ---------------------------------------------------------------------- Joe · 2010-05-30 15:03 Hi Juha, I'd tried to follow the instruction on http://wiki.lazarus.freepascal. org/Cross_compiling_for_Win32_under_Linux but finally I failed and give up. For me, it's looks a little unfortunate, that there is no fpc_crosswin32_2.4.0_i386.deb was offerered like it was for fpc 2.2.4. Isn't there anybody out who can provide that? Actually, I boot Windows to compile my Win32 binaries. Joe. ---------------------------------------------------------------------- Joe · 2010-06-08 22:56 Does anybody know who had build the fpc_crosswin32_2.2.4-091003_i386.deb and put it to SourceForge once upon a time? ---------------------------------------------------------------------- Vincent Snijders · 2010-06-18 19:48 If I remember correctly, Mattias build it. A new version will be built, when a new Lazarus version is released. The next Lazarus version will probably be built with fpc 2.4.2. ---------------------------------------------------------------------- Joe · 2013-06-01 11:10 Could anybody build a crosswin.deb, maybe Vincent or Matthias? ---------------------------------------------------------------------- BigChimp · 2013-06-01 11:59 Huh? Is that necessary? AFAIR, you can build to Win32 from Linux just by setting the widgetset type and OS type etc in project options... ---------------------------------------------------------------------- Joe · 2013-06-02 22:05 Hmm ok, testet with: Ubuntu 12.04 (32 Bit)Lazarus 1.0.8 / Fpc 2.6.2 (installed from .deb files) New Project -> Application Project Options -> Compiler Options -> Code Generation -> Target OS (-T) ->Win32-> fcllaz.pas(0,0) Fatal: Can not find unit system used by fcllaz.¿Don't know how to change the WidgetSet in the Compiler Options?  And then New Project -> Program Project Options -> Compiler Options -> Code Generation -> Target OS (-T) -> Win32-> project1.lpr(0,0) Fatal: Can not find unit system used by project1. Then trying from commandline (wrote a simple "Hello World" to Hello.pas): Code: [Select]fpc -Tlinux Hello.pas   -> works fpc -Twin32 Hello.pas   -> don't works (Can not find unit system...) Ok, now following http://wiki.freepascal.org/Cross_compiling_for_Win32 _under_Linux#Newer_FPCs_-_2.1.1_and_newer I perform Code: [Select]~$ cp -R /usr/share/fpcsrc .       ; # don't know if that's the prefered way? ~$ cd fpcsrc/2.6.2 ~/fpcsrc/2.6.2$ make all OS_TARGET=win32 CPU_TARGET=i386 ~/fpcsrc/2.6.2$ sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 Which works without errors (just some hints and warnings like "fpjson.pp(1917,15) Warning: Function result variable does not seem to initialized" ...). After that, I was able to compile my Hello.pas Code: [Select]fpc -Twin32 Hello.pas -> works :) Trying the same with Win64 failed - but I'd not dig deeper now Code: [Select]~/fpcsrc/2.6.2$ make all OS_TARGET=win64 CPU_TARGET=i386 Makefile:197: *** The Makefile doesn't support target i386-win64, please run fpcmake first. Ok, next step I try that with a simple gui application (http://wiki.fr eepascal.org/Cross_compiling_for_Win32_under_Linux#Cross_compiling_the _LCL_and_lazarus_components) Code: [Select]~$ cp -R /usr/share/lazarus . ~$ cd lazarus/1.0.8 ~/lazarus/1.0.8$ make clean all OS_TARGET=win32 make -C ide cleanide make[1]: Betrete Verzeichnis '/home/user/lazarus/1.0.8/ide' /bin/rm -f       ; # Wow, what's that?! /bin/rm -f /bin/rm -f /bin/rm -f ... Compiling lazaruspackageintf.pas registerfcl.pas(43,3) Fatal: Can't find unit ServiceManager used by RegisterFCL Fatal: Compilation aborted make[1]: *** [fcllaz.ppu] Fehler 1 make[1]: Verlasse Verzeichnis '/home/user/lazarus/1.0.8/packager/registration' make: *** [registration] Fehler 2 Note, that compiling Code: [Select]make clean all OS_TARGET=linuxcompletes at this point. So, I had 2 questions left: Might it a good idea, to start with copying /usr/share/fpcsrc & /usr/share/lazarus to my home directory?What's gone wrong while compiling lcl and lazarus components for win32?In the 1st part (fpc), the "sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386" seems to write some files to /usr/bin ... - ok, that's it is. I'm hopefully, that all these will be removed when I late deinstall fpc. But what about the 2nd part (lcl & lazarus), where to put the crosscompiled components? When I install additional packages (like Zeos or lNet), a new directory .lazarus is created in my home. Maybe that's a good place? Thanks in advance, Joe. ---------------------------------------------------------------------- marcov · 2013-06-02 22:10 Quote from: Joe on June 03, 2013, 12:05:19 am Trying the same with Win64 failed - but I'd not dig deeper now Code: [Select]~/fpcsrc/2.6.2$ make all OS_TARGET=win64 CPU_TARGET=i386 Makefile:197: *** The Makefile doesn't support target i386-win64, please run fpcmake first. (win64 is 64-bit specific windows, so only for CPU_TARGET=x86_64) ---------------------------------------------------------------------- Leledumbo · 2013-06-03 12:04 QuoteMight it a good idea, to start with copying /usr/share/fpcsrc & /usr/share/lazarus to my home directory?Up to you, it's for your convenience only. Just don't forget to update the path to FPC source in environment options. QuoteWhat's gone wrong while compiling lcl and lazarus components for win32?Something must be wrong in your fpc.cfg, please post -Fu lines in that file. The default config file generated by fpcmkcfg doesn't cover all units' folder. Normally you'll only need one in the form of: Code: [Select]-Fu/$fpcversion/units/$fpctarget/* Actually, you don't need to build Lazarus just to compile application for Win32, when you already have cross compiler and RTL/FCL cross compiled as well, doing the previous step (changing target OS in project options) should be enough. ---------------------------------------------------------------------- Joe · 2013-06-03 13:21 I'd performed the test on a nealy fresh installed Ubuntu 12.04 which hasn't seen a Lazarus/Fpc before. Below /etc, I found 3 files named fp*: Code: [Select]/etc/fpc.cfg /etc/fppkg.cfg /etc/fppkg/default -> attached to this post The content of /etc/fpc.cfg about -Fu: Code: [Select]# searchpath for units and other system dependent things -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl #IFDEF FPCAPACHE_1_3 -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/ #ELSE #IFDEF FPCAPACHE_2_0 -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20 #ELSE -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22 #ENDIF #ENDIF # searchpath for fppkg user-specific packages -Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/* I'd also scanned my hdd for occurences of ServiceManager: Code: [Select]$ find / -iname "ServiceManager*" 2>/dev/null /home/user/fpcsrc/2.6.2/packages/fcl-extra/src/win/ServiceManager.pas /home/user/fpcsrc/2.6.2/packages/fcl- extra/units/i386-win32/ServiceManager.ppu /home/user/fpcsrc/2.6.2/packages/fcl- extra/units/i386-win32/ServiceManager.o /home/user/fpcsrc/2.6.2/packages/fcl- extra/units/i386-win32/ServiceManager.rst /usr/local/lib/fpc/2.6.2/units/i386-win32/fcl-extra/ServiceManager.ppu /usr/local/lib/fpc/2.6.2/units/i386-win32/fcl-extra/ServiceManager.o /usr/share/fpcsrc/2.6.2/packages/fcl-extra/src/win/ServiceManager.pas and noticed, that nothing like /usr/local/lib/fpc is found in the fpc.cfg's -Fu settings. Seems, that the "make crossinstall" had copied them to this location? Joe. ---------------------------------------------------------------------- Leledumbo · 2013-06-03 13:39 QuoteSeems, that the "make crossinstall" had copied them to this location?Yep, in standard linux way of installation via make, everything you install compile and install manually will go to /usr/local/ by default, as opposed to /usr/ as if you're installing from package manager. In my automatic fpc build script, I pass INSTALL_PREFIX=/usr so both the cross compiler and its respective cross compiled units are installed into the same directory tree as the native compiler and units. They won't interfere each other, instead they will ease maintenance because you don't need to add any other -Fu. If you don't want to mess your current installation, simply add: Quote-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/*to your fpc.cfg (note the bold one). ---------------------------------------------------------------------- Joe · 2013-06-03 17:12 I'd tried both solutions and succeed with both. Thanx very lot for your great support ---------------------------------------------------------------------- Joe · 2013-06-03 17:21 In summary we might add a walk through to the wiki article. But for me, I am unsure whether it is a recommended way to start with copying /usr/share/fpcsrc to my home directory. ---------------------------------------------------------------------- Leledumbo · 2013-06-03 21:54 QuoteBut for me, I am unsure whether it is a recommended way to start with copying /usr/share/fpcsrc to my home directory.What about making the directory (and everything below) writable? I used to do that in the past along with lazarus (now I put it in a dedicated partition where I have write access).