Forum > Operating Systems

Can Project on Linux targeted to run On Windows?

(1/1)

incendio:
Hi guys,

I am using Lazarus on Linux Mint.

Can project build in Lazarus Linux compiled to run on Windows OS or it should compiled in Lazarus Windows?

I tried to compiled it in Linux with target OS Win32, but got an error.

Handoko:
Yes, Lazarus Linux can compile to get the binaries to run on Windows. I do not have Windows, I use Wine or my friend's Windows PC to test the binaries. It works.

This is my recipe to prepare the cross compiler:
# Cross Compile Win32
01. cd /usr/share/fpcsrc/3.0.4
02. sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
03. sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
04. sudo ln -sf /usr/lib/fpc/3.0.4/ppcross386 /usr/bin/ppcross386

You may need to change the text "3.0.4" to match your FPC version.

After you managed to build the cross compiler correctly, on your project option you need to select Win32 and i386.

incendio:
Hello,

Thanks a lot for your help. It worked fine.  :D

lucamar:
@Handoko: That's probably the simplest answer I've seen given to this question :)

Just one thing: Don't you need to compile also the LCL and Lazarus components? If so, any "as-easy-as" instructions?

I've been looking for something like this for ages, i.e. converting a normal installation into a cross-compiling one easily, but never dared risk my installations by dubious testing  :-[

dbannon:
No Lucamar, no changes are needed to Lazarus itself. As long as it can find the appropriate compiler (ProjectOptions), it will build what it needs as it needs it. Very nice.

For the record, this will add a 64bit windows -

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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/$FPCVER/ppcrossx64 /usr/bin/ppcrossx64
...And this will add 32bit linux (assuming we are on a 64bit platform) -

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---make all CPU_TARGET=i386make crossinstall CPU_TARGET=i386
But one thing I have noticed is that on three occasions now, Ubuntu has updated files in my /lib/i386-linux-gnu dir and left me with a broken symlink to libglib-2.0.so. That breaks the 32bit linux compile. So there is something unclean there ....

Davo


Navigation

[0] Message Index

Go to full version