Forum > Linux

Compiling Linux project to Windows platform

(1/3) > >>

pascal111:
Hello everyone!

I'm Linux Mint user, and I'm a beginner generally to Pascal language and particularly to Lazarus IDE. I succeeded to convert some traditional BASIC command-line games into Lazarus freePascal, and some other users who are using Windows like to try these small games, but I didn't understand the idea how to compile the projects to Windows exe files.

I googled for this topic and found this document but I didn't get the idea how to do it on my installed Lazarus, I didn't find same folders with the same names in my Lazarus version.

https://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Linux

trev:
Have you done the two steps described in this step on the Wiki page you cited?

dbannon:
 > I didn't find same folders with the same names in my Lazarus version.

OK, firstly, please understand when you are setting up a cross compiler, its FPC stuff you are doing, at least initially. Lazarus does not come into it until you start using the cross compiler.  So, by saying that you cannot find the "same names", you probably mean the FPC folder names ? Please tell us what names you are looking for ?

My one notes as to how I setup my cross compilers say this -

--- Code: ---# Setup 32bit and 64 bit Windows
cd /usr/share/fpcsrc/$FPCVER
make clean all OS_TARGET=win32 CPU_TARGET=i386
make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
ln -sf /usr/lib/fpc/$FPCVER/ppcross386 /usr/bin/ppcross386

make clean all OS_TARGET=win64 CPU_TARGET=x86_64
make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=/usr
ln -sf /usr/lib/fpc/$FPCVER/ppcrossx64 /usr/bin/ppcrossx64

# Make sure its all there (we should see ppcross386, ppcrossx64)
echo "watch for ppcross386, ppcrossx64"
ls -la /usr/lib/fpc/$FPCVER/ppcross*
ls -la /usr/bin/ppcross*
--- End code ---

The wiki does not seem as complete as my notes, strange as they were based on the wiki some time ago.  Please step through those notes, watching carefully for an error message and tell us what you find.  If it works as I expect it to, I better update the wiki (I am unsure because I don't use a deb installed FPC anymore and I assume you, and most new users will).

If you do have a deb installed FPC (either Mint repo of SourceForge) your FPC is installed in root space, that means, sadley, you need to run the compiler build as root, otherwise you will not be able to save files in the right place.

Mint will probably have an older FPC in its repos (based on Ubuntu 18.04 from memory) and thats likely to be 3.0.4, maybe you should consider updating to FPC 3.2.0 but its not critical. (Installing FPC from a Tarball and Lazarus from source ends up with all you code in user space and does make life a little easier).

Please let us know how it all goes.

Davo

pascal111:
I found this error when I tried to do the same like the wiki page instructions:


--- 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";}};} ---pascal@pascal-Lenovo-ideapad-330-15AST:~$ cd /usr/share/fpcsrc/3.0.4pascal@pascal-Lenovo-ideapad-330-15AST:/usr/share/fpcsrc/3.0.4$ sudo make clean all OS_TARGET=win32 CPU_TARGET=i386[sudo] password for pascal:                  make: *** No rule to make target 'clean'.  Stop.pascal@pascal-Lenovo-ideapad-330-15AST:/usr/share/fpcsrc/3.0.4$  

trev:
Odd. What is the output of this command in the 3.0.4 directory:


--- Code: Text  [+][-]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";}};} ---$ grep -i ^clean Makefile

Navigation

[0] Message Index

[#] Next page

Go to full version