Recent

Author Topic: Cross compilation from Linux Debian to Windows32  (Read 6408 times)

gelinp

  • Full Member
  • ***
  • Posts: 114
Cross compilation from Linux Debian to Windows32
« on: October 07, 2015, 07:51:27 pm »
Hi,

I'm using lazarus 1.2.4+ with FPC 2.6.4 under Linux Debian. I understand that only FPC with linux binary was installed into this version of lazarus, but I'm not sure....

I would like to use cross compilation to produce windows binaries with debian. I followed Cross compiling for win32 under Linux but I failed to compil my test project. The error is that lazarus can't find system libraries, I suppose win32 system libraires.

This is probably because this tutorial is not complet. I think I have to build win32 binaries for FPC too... So I installed FPC 3.1.1 because for FPC 2.6.4 I understand I will need an older version of gnu make and I can't find it for debian (and also I don't know how to install with a newer version already installed).

So FPC 3.1.1 is a work in progress, and fpcbuild/install/INSTALL file show me I first have to creating *src.zip files. But make sourcezip command display an error message :

Code: Pascal  [Select][+][-]
  1. gelinp@inspiron:~/07_ADMINISTRATION_SYSTEME/DOSSIERS_PRODUITS/FPC/fpcbuild$ make sourcezip
  2. make: execvp: /usr/local/bin/pwd.exe: Permission non accordée
  3. Makefile:135: *** Compiler .exe not found. Arrêt.
  4.  

Why makefile is looking for windows pwd.exe under Debian ? I don't understand where is te problem.

By the way I try to compil win32 FPC binaries  and I need to use NOGDB=1 option. Why ?:
Code: [Select]
make all OS_TARGTE=win32 CPU_TARGET=i386 NOGDB=1
Thank you for your help !




My configuration is : Lazarus 1.6+dfsg-1 / FPC 3.0.0 / Debian Mint / x86_64-linux-gtk2

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Cross compilation from Linux Debian to Windows32
« Reply #1 on: October 07, 2015, 09:22:33 pm »
Hello gelinp. I'm not an expert in cross compiling, but I managed to make it work on my Ubuntu 64-bit.

Code: Pascal  [Select][+][-]
  1. cd /usr/share/fpcsrc/2.6.4
  2. sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
  3. sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
  4. sudo ln -sf /usr/lib/fpc/3.1.1/ppcross386 /usr/bin/ppcross386

Run the code above on your Terminal. You may need to change the folder name on line no. 1 and no. 4.

Good luck!

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Cross compilation from Linux Debian to Windows32
« Reply #2 on: October 08, 2015, 05:03:27 am »
I followed Cross compiling for win32 under Linux but I failed to compil my test project. The error is that lazarus can't find system libraries, I suppose win32 system libraires.
This can't be true, PE doesn't require target platform libraries to exist at compile time.
I think I have to build win32 binaries for FPC too...
Certainly no, it's not a cross compiling if it's true.
Why makefile is looking for windows pwd.exe under Debian ? I don't understand where is te problem.
No idea, I never (need to) execute `make sourcezip`.
By the way I try to compil win32 FPC binaries  and I need to use NOGDB=1 option. Why ?:
Code: [Select]
make all OS_TARGTE=win32 CPU_TARGET=i386 NOGDB=1
You don't need to if you have libgdb.a for win32. For 3.1.1, you can also pass GDBMI=1 for the IDE to use external gdb instead of embedding libgdb.a. It's kinda weird, though. My cross build FPC never builds any of the utilities including but not limited to the IDE, only the compiler.

gelinp

  • Full Member
  • ***
  • Posts: 114
Re: Cross compilation from Linux Debian to Windows32
« Reply #3 on: October 08, 2015, 04:52:00 pm »
Hi,

When you say :

Code: Pascal  [Select][+][-]
  1. cd /usr/share/fpcsrc/2.6.4
  2. sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
  3. sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
  4. sudo ln -sf /usr/lib/fpc/3.1.1/ppcross386 /usr/bin/ppcross386

I can't make clean because into /usr/share/fpcsrc/2.6.4 there is no Makefile ! There is Makefile only into the three sub folders  : compiler, package and rtl. So, do I need to repeat this compilation trhee times into this three sub folder ?

Thank you for your help !
« Last Edit: October 08, 2015, 04:54:00 pm by gelinp »
My configuration is : Lazarus 1.6+dfsg-1 / FPC 3.0.0 / Debian Mint / x86_64-linux-gtk2

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Cross compilation from Linux Debian to Windows32
« Reply #4 on: October 08, 2015, 05:34:55 pm »
That's strange. Some months ago, I tested to uninstall and reinstall Lazarus/FPC with the code above several times without any problem.

Have you tried to perform a clean installation? Also, have you tried the lastest release? Last time I run the code was on Lazarus 1.4.2, not sure if it also works on 1.2.4. Here if you want to download the latest version of Lazarus/FPC:
http://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%201.4.4/

Note: You have to install all the 3 packages or strange thing might happen.

So, do I need to repeat this compilation trhee times into this three sub folder ?

Not sure, but on my case, I only run the code once and everything works correctly.
« Last Edit: October 08, 2015, 05:51:07 pm by Handoko »

gelinp

  • Full Member
  • ***
  • Posts: 114
Re: Cross compilation from Linux Debian to Windows32
« Reply #5 on: October 08, 2015, 09:03:56 pm »
Are you sure for the directory where looking for the Makefile ? Because there is /usr/lib/lazarus/1.2.4/ with one into... Do I need to recompile lazarus and FPC, or only FPC ?

I was lookking for /usr/share/fpcsrc/2.6.4/Makefile into package files list with synaptic and I couldn't find anything like this. There is only the three directories like I said : compiler, package and rtl, each one with a Makefile... So it's not a reinstall to correct it.
« Last Edit: October 08, 2015, 09:07:11 pm by gelinp »
My configuration is : Lazarus 1.6+dfsg-1 / FPC 3.0.0 / Debian Mint / x86_64-linux-gtk2

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Cross compilation from Linux Debian to Windows32
« Reply #6 on: October 08, 2015, 09:17:32 pm »
I've never used Lazarus 1.2.4, nothing I can say about it. I used Lazarus 1.4.2 when cross compiling.

I remember when I managed to cross compile to win32, I was so happy, so I copy-pasted and saved the steps immediately to a text file. And I tested the steps several times by uninstall and reinstall following the steps. Everything just run smoothly and the produced exe file run correctly on Windows.

I ever tried Lazarus installation provided by Ubuntu Software Center. But I found that their package was not the latest version and had many issues. So after that, I only use the installation provided by Lazarus website.
« Last Edit: October 08, 2015, 09:20:26 pm by Handoko »

gelinp

  • Full Member
  • ***
  • Posts: 114
Re: Cross compilation from Linux Debian to Windows32
« Reply #7 on: October 08, 2015, 10:29:10 pm »
So now I've installed all the stuff of last lazarus version. There is now a /usr/share/fpcsrc/2.6.4/Makefile ! It's great !!!

But there is a problem again :

Code: Pascal  [Select][+][-]
  1. gelinp@inspiron:/usr/share/fpcsrc/2.6.4$ sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
  2. make: execvp: /usr/local/bin/pwd.exe: Permission non accordée
  3. Makefile:135: *** Compiler .exe not found. Arrêt.
  4. gelinp@inspiron:/usr/share/fpcsrc/2.6.4$ sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
  5. make: execvp: /usr/local/bin/pwd.exe: Permission non accordée
  6. Makefile:135: *** Compiler .exe not found. Arrêt.
  7.  

It looks like Makefile is running with Windows platform environment ...  But I'm under Linux debian !

So, I tried to rebuild the Makefile with command :
Code: Pascal  [Select][+][-]
  1. sudo fpcmake

but nothing else... Do you have an idea ?
« Last Edit: October 08, 2015, 10:34:16 pm by gelinp »
My configuration is : Lazarus 1.6+dfsg-1 / FPC 3.0.0 / Debian Mint / x86_64-linux-gtk2

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Cross compilation from Linux Debian to Windows32
« Reply #8 on: October 09, 2015, 04:08:08 am »
Oh, it seems now the issue is about the Linux thing. Sorry I'm just a Linux common user, not much I can help. Perhaps you need to ask it on Linux forum. It really works smoothly on Ubuntu Linux.

gelinp

  • Full Member
  • ***
  • Posts: 114
Re: Cross compilation from Linux Debian to Windows32
« Reply #9 on: October 09, 2015, 07:01:37 am »
OK, thank you for your help ! I'm just continuing into FPC / general subject.
My configuration is : Lazarus 1.6+dfsg-1 / FPC 3.0.0 / Debian Mint / x86_64-linux-gtk2

dogriz

  • Full Member
  • ***
  • Posts: 126
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

JazzMazz88

  • Newbie
  • Posts: 5
Re: Cross compilation from Linux Debian to Windows32
« Reply #11 on: November 06, 2015, 11:10:26 am »
I think the instructions are buggered or something. What happened to the long list saying how to rebuild everything for everything? Those are the instructions we need.

And is Fedora copy f*d up somehow? I have only x64 binary and it wont build the 386 compiler needed to use the crosscompile feature. It only complains that the ppc386 file is missing. Why are distros allowed to repack our sources in such a way that rebuild or crossbuild is broken? Debian has a missing makefile in the root folder, that the official sources have. They say thats on purpose but Im not buying thier load of crap. They need to give us the sources as packaged HERE on the website, not however they want. Same with other distros. But oddly we have lazarus and fp and fpc working just fine. Dunno about yall, but I WANT multi-arch on my 64bit system. That should not be a disabled option. 32bit systems dont have to worry about this.

At a minimum though, install all mingw32* or mingw64* packages. That solves a lot of headaches.And yeah, for some reason you are trying to invoke a windows binary on a linux system there without using wine.I think thats a bug.

Thaddy

  • Hero Member
  • *****
  • Posts: 14213
  • Probably until I exterminate Putin.
Re: Cross compilation from Linux Debian to Windows32
« Reply #12 on: November 06, 2015, 11:37:30 am »
On most Debian it is enough to create some symlinks in /usr/bin that point to /usr/local/bin if that helps.
When compiling/installing you should be aware of the options.
Specialize a type, not a var.

 

TinyPortal © 2005-2018