Cross Compiler for Linux to windows sort of working..need help lazarus / 1-Linux ---------------------------------------------------------------------- snorkel · 2014-02-21 23:57 Hi, I followed this guide: http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Lin ux (nothing is this doc was correct by the way, it forget to mention after you build the cross compiler from the FPC source you have to do a make crossinstall or you have to copy the binary files manually.  Which I had to do as the make crossinstall did not seem to work. is it just make crossinstall or do you need to specify the targets as parms? But I can't get the LCL part to compile and when I do: cd lazarus; make clean all OS_TARGET=win32 I get: Makefile:196: *** The Makefile doesn't support target x86_64-win32, please run fpcmake first.  Stop. The cross compiler works as I can compile a win32 command line app, when I compile a GUI project it stops here: RegisterFCL at the service manager line. Has anyone got cross compiling between linux and win32 to work? Thanks ---------------------------------------------------------------------- Leledumbo · 2014-02-22 03:14 QuoteWhich I had to do as the make crossinstall did not seem to work. is it just make crossinstall or do you need to specify the targets as parms?OS_TARGET (and CPU_TARGET if the target arch differs) must also be given, just like when you build it QuoteBut I can't get the LCL part to compile and when I do:Clearly you didn't specify CPU_TARGET when building: QuoteMakefile:196: *** The Makefile doesn't support target x86_64-win32, please run fpcmake first.  Stop.Win32 doesn't run on x86_64, there's only either i386-win32 or x86_64-win64 QuoteHas anyone got cross compiling between linux and win32 to work?I do. My host is i386-linux and I have arm-android, i386-win32, jvm- android, jvm-java and x86_64-win64 as my cross targets. ---------------------------------------------------------------------- snorkel · 2014-02-22 15:50 Thanks, I was just following the guide, which appears to be wrong. Iwill try again with your suggestions and if it all works I will update that wiki article with accurate information on the subject. What about mingw, do I need that to compile GUI apps? ---------------------------------------------------------------------- Leledumbo · 2014-02-22 17:15 QuoteWhat about mingw, do I need that to compile GUI apps?Nope, for both i386-win32 and x86_64-win64, fpc has internal assembler and internal linker. ---------------------------------------------------------------------- snorkel · 2014-02-22 19:50 Got further: Free Pascal Compiler version 2.6.2 [2014/02/22] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling fcllaz.pas Compiling registerfcl.pas Compiling lazaruspackageintf.pas registerfcl.pas(43,3) Fatal: Can't find unit ServiceManager used by RegisterFCL Fatal: Compilation aborted make[1]: *** [fcllaz.ppu] Error 1 make[1]: Leaving directory `/home/snorkel/lazarus_src/packager/registration' make: *** [registration] Error 2 ---------------------------------------------------------------------- snorkel · 2014-02-22 20:39 ok, I had to add this to the fpc.cfg in /etc -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/* After that I could compile everything. ---------------------------------------------------------------------- snorkel · 2014-02-22 20:50 I updated the wiki page: http://wiki.freepascal.org/Cross_compiling_for_Win32_under_Linux#Cross _compiling_the_LCL_and_lazarus_components Since you know more about this than I do, maybe you could take a look and see if it looks right? Thanks, Snorkel ---------------------------------------------------------------------- Leledumbo · 2014-02-23 02:07 QuoteNOTE: For this to work you also need to add: -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/* to the fpc.cfg in /etc (on ubuntu anyway)This is not always true. One can supply INSTALL_PREFIX to make to specify where to install the newly compiled FPC. If it's installed under the same fpc tree as the host (yes, it's possible and they won't interfere each other), then the new -Fu line is not needed. ---------------------------------------------------------------------- MHL · 2014-07-09 08:56 Hi, I'm writing here becouse I got similar problem with cross compiling. I'm using Lazarus 1.2.2, FPC 2.6.4 on Fedora 20 (64bit). I'm trying to compile my project (it's a dll library) to Windows 64bit. I can compile project without LCL to Win64 and it's fine. But I can't compile with LCL. When I doing:  Code: [Select]make clean all OS_TARGET=win64 CPU_TARGET=x86_64I got fatal error: Code: [Select]Hint: Start of reading config file /etc/fpc.cfg Hint: End of reading config file /etc/fpc.cfg Warning: Option "-Xr" is ignored for the current target platform. Free Pascal Compiler version 2.6.4 [2014/03/07] for x86_64 Copyright (c) 1993-2014 by Florian Klaempfl and others Target OS: Win64 for x64 Compiling fcllaz.pas Compiling registerfcl.pas Compiling lazaruspackageintf.pas registerfcl.pas(43,3) Fatal: Can't find unit ServiceManager used by RegisterFCL Fatal: Compilation aborted I'm add " -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/*" to fpc.cfg and it's still not working. What I'm doing wrong? On IDE I can find ServiceManager.pas (it's /usr/share/fpcsrc/packages/fcl-extra/src/win/ServiceManager.pas) (sorry for my poor english) ---------------------------------------------------------------------- marcov · 2014-07-09 09:32 Quote from: Leledumbo on February 22, 2014, 06:15:14 pmQuoteWhat about mingw, do I need that to compile GUI apps?Nope, for both i386-win32 and x86_64-win64, fpc has internal assembler and internal linker. (yes, for windres) ---------------------------------------------------------------------- MHL · 2014-07-09 10:43 Ok, I recompile mingw like that: Code: [Select]cd /usr/share/fpcsrc/packages/gdbint/ make all clean OS_TARGET=win64 CPU_TARGET=x86_64 make all clean ...and it's done well, then I do: Code: [Select]cd /usr/lib64/lazarus/ make clean all OS_TARGET=win64 CPU_TARGET=x86_64 ...and still same error like below Am I done that right? ---------------------------------------------------------------------- marcov · 2014-07-09 13:35 Quote from: MHL on July 09, 2014, 12:43:24 pmOk, I recompile mingw like that: Code: [Select]cd /usr/share/fpcsrc/packages/gdbint/ make all clean OS_TARGET=win64 CPU_TARGET=x86_64 make all clean So you recompiled the GDB static bindings for the textmode IDE, why do you do that? ---------------------------------------------------------------------- MHL · 2014-07-09 17:32 Sorry marcov, I am new in Lazarus. Tell me please, what your last answer mean? Quote"(yes, for windres)"If you mean to install mingw I done it (mingw-binutils-generic-2.23.52.0.1-2.fc20.x86_64.rpm) ---------------------------------------------------------------------- marcov · 2014-07-09 21:08 Quote from: MHL on July 09, 2014, 07:32:06 pmSorry marcov, I am new in Lazarus. Tell me please, what your last answer mean? Quote"(yes, for windres)" It means you need windres from binutils. QuoteIf you mean to install mingw I done it (mingw-binutils- generic-2.23.52.0.1-2.fc20.x86_64.rpm) Now you must make FPC find it by 1) specifying the path ($PATH or -FD/path parameter) 2) if the file has a simple prefix you can try to pass that knowledge to FPC with -XPa-prefix- 3) Otherwise you need to symlink.