Compile for linux under windows lazarus / 13-General ---------------------------------------------------------------------- candidate · 2009-05-29 06:13 I'm searching for a way to compile programs for linux under windows. After a lot of searching i came across this: http://www.optimasc.com/support/fpc/ Can any1 confirm if this will work and if not what actions i need to take to make it work under windows. ---------------------------------------------------------------------- Vincent Snijders · 2009-05-29 07:05 These are old compilers (more than 5 years), but in principle this is possible. The last time I tested was 3 years (fpc 2.0.0) ago ---------------------------------------------------------------------- Leledumbo · 2009-06-01 02:59 I've used it even until now (it sucks rebooting to linux just to generate binaries), basically you only need i386-linux-ld.exe (cross linker) and all units compiled for linux platform. From rtl / packages source directory, type: make OS_TARGET=linux. ---------------------------------------------------------------------- Zaher · 2009-06-01 13:29 It is hard to get "all units compiled for linux platform" ---------------------------------------------------------------------- Michael · 2009-06-01 23:24 I'm on the flip side, I write my software in Linux and often need to compile a Windows binary.  My solution was the use Sun VirutalBox.  I have a completely visualized Windows installation that I have Lazarus running on.  You can network the Guest OS (for me Windows) so that you can just file share the project. I hope this screen shot works: (http://photos-a.ak.fbcdn.net/hphotos-ak- snc1/hs085.snc1/4590_1041098760872_1627657638_30091216_6363497_n.jpg) ---------------------------------------------------------------------- cpalx · 2009-06-02 02:23 I do as Michael, i think it is the best choice, besides you can see how it looks in different environment (some controls looks different in other platform) an you can test it in other SO. ---------------------------------------------------------------------- Leledumbo · 2009-06-03 08:42 QuoteIt is hard to get "all units compiled for linux platform"Huh? Why is it so? It's not in my case... well, the .so dependencies are "a little" killing, but it's not THAT hard. ---------------------------------------------------------------------- Dibo · 2009-06-03 11:19 Quote from: Leledumbo on June 01, 2009, 04:59:15 amI've used it even until now (it sucks rebooting to linux just to generate binaries), basically you only need i386-linux-ld.exe (cross linker) and all units compiled for linux platform. From rtl / packages source directory, type: make OS_TARGET=linux. Some times ago I trayed to cross-compile to linux from Windows using this article: http://www.stack.nl/~marcov/crossnotes.txt, but I give up. This article is too vague for me. My problems was: 1. I really need linux-fpc source? Because in directory: C:\lazarus\fpc\2.2.5\source\rtl is folder Linux which contains necessary (I think) units like System. 2. When I copy make.exe from bin folder to package/rtl and try command "make clean all" or "make OS_TARGET=linux" I have error: "makefile:29: *** You need the GNU utils package to use this Makefile.  Stop." 3. "Project -> compiler options -> Target platform -> OS" is this same like "make OS_TARGET"? 4. Must I rebuild Lazarus for new target platform? Summary. I need tutorial for total lame ---------------------------------------------------------------------- Leledumbo · 2009-06-04 04:28 QuoteSome times ago I trayed to cross-compile to linux from Windows using this article: http://www.stack.nl/~marcov/crossnotes.txtThat was my starting point, it's a bit outdated now. But some things remain correct. Quote1. I really need linux-fpc source? Because in directory: C:\lazarus\fpc\2.2.5\source\rtl is folder Linux which contains necessary (I think) units like System.No, you already have it. FPC uses the same base source for all targets. Quote2. When I copy make.exe from bin folder to package/rtl and try command "make clean all" or "make OS_TARGET=linux" I have error: "makefile:29: *** You need the GNU utils package to use this Makefile.  Stop."Don't do so, the makefile depends NOT ONLY on make, but also pwd,  cp, rm, etc. Instead, add bin to your PATH environment variable. Quote3. "Project -> compiler options -> Target platform -> OS" is this same like "make OS_TARGET"?No. Projects don't have any makefile by default. Calling make will execute what's in the makefile in the current directory. Quote4. Must I rebuild Lazarus for new target platform?If only for building applications for other platforms, no. Remember that it's the compiler's job to deal with executable generation. The IDE just eases the process by providing nice GUI interface for it. ---------------------------------------------------------------------- Dibo · 2009-06-04 08:17 I add bin to environment variable but now I have this errors after "make clean" or "make OS_TARGET=linux": Code: [Select]Error makefile 8079: Command syntax error Error makefile 8080: Command syntax error Error makefile 8086: Command syntax error Error makefile 8087: Command syntax error Error makefile 8108: Command syntax error Error makefile 8119: Command syntax error *** 1148 errors during make *** ---------------------------------------------------------------------- Leledumbo · 2009-06-05 07:35 Something wrong with the supplied make? Do you have any cygwin or mingw (msys) installed (with make utility)? If their bin is listed in PATH before fpc's bin, their make will be used instead of fpc's one (which supposed to be OK, except you have a quite old version). Hmm... it's hard for me to test, since I compile both fpc and lazarus from source (I hate installers) and all GNU utilities come from my mingw + msys installation. ---------------------------------------------------------------------- Dibo · 2009-06-05 09:32 Yes, I forget that I had installed mingw some times ago (to compile own GDB) and their path stay in environment path. I clear this now but errors are still this same. ---------------------------------------------------------------------- Leledumbo · 2009-06-08 05:01 Can you rebuild Lazarus normally? If yes, please use the same make as configured in Environment Options.