Recent

Author Topic: How to Lazarus Cross Compile Win32 to Linux ?  (Read 14159 times)

guest60499

  • Guest
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #15 on: November 27, 2017, 07:48:18 am »
I am ok with your opinion, but just out of curiosity: what is odd about it ?
It is a program purpose built to compile FPC, instead of a build configuration for a dedicated piece of software that does the same thing. Eventually languages get their own build system and/or package manager. Perhaps that time has passed, and Fpcupdeluxe is necessary or at least the best solution. Experience has shown me these solutions are inflexible, but Fpcupdeluxe has been around for some time. Perhaps I shouldn't worry.

My comment wasn't about the quality of the code in Fpcupdeluxe.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1447
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #16 on: November 27, 2017, 08:12:09 am »
Thanks for explaining !

My advice will always be to follow the official install instruction for FPC and Lazarus.

Fpcupdeluxe is just one of many tools that can help installing FPC and Lazarus.
It can be useful in situations where a standard install fails. Of for something special like cross-compiling.
Most programming efforts has been put into sandboxing an install by fpcupdeluxe and into the [sometimes dark] secrets of cross-compiling and the building of cross-tools.

So, fpcupdeluxe is neither necessary nor the best. But its the best fit in certain situations.

avra

  • Hero Member
  • *****
  • Posts: 2130
    • Additional info
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #17 on: November 27, 2017, 08:29:06 am »
Fpcupdeluxe is just one of many tools that can help installing FPC and Lazarus. It can be useful in situations where a standard install fails. Of for something special like cross-compiling.
+1 for easy cross compilation. I would also mention that it is very usefull to have many FPC/LAZ versions which do not interfere with official ones. I also like when everything is kept in a single directory, so I can easily copy it between computers (it works as long as dir path stays the same - otherwise shortcut needs adjustment).
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #18 on: May 10, 2018, 08:43:23 pm »
In fact, everything is very simple (tested on Lazarus 1.8.2 with Win32 FPC 3.0.4):
1) Download fpc-3.0.4.i386-linux.tar/download and unpack it with all attachments.
2) Among the unpacked folders, find "units" (will be here: {unpacked}\lib\fpc\3.0.4).
3) Copy them to Lazurus, to the folder "Lazarus\fpc\3.0.4".
4) Download binutils-2.15-win32-i386-linux.zip (binutils-2.21-win32-x86_64-win64.zip for compile x64 app) and unzip.
5) Copy content of "bin" folder to Lazarus ("Lazarus\fpc\3.0.4\i386-win32").
That's all, now in the project parameters it remains to specify "Terget OS: Linux" and "Target CPU: i386".
This scheme allows you to organize any cross-platform compilation, if only there were libraries for the platform (units) and the corresponding cross-compiler (bin).

UPD: In most cases, you just need to download and install the crosscompiler from here: https://www.freepascal.org/download.html
And if there is no suitable compiler, then read on: https://wiki.lazarus.freepascal.org/Cross_compiling
« Last Edit: April 06, 2021, 03:39:59 pm by Schrodinger Kater »

Thaddy

  • Hero Member
  • *****
  • Posts: 10784
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #19 on: May 10, 2018, 09:35:26 pm »
Yes you are alive and dead at the same time...
Point is that does not always work, fpcdeluxe is the next best thing although I only use it once every release (not even that, but it is good).
« Last Edit: May 10, 2018, 09:37:40 pm by Thaddy »

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #20 on: May 10, 2018, 11:03:00 pm »
you are alive and dead at the same time
Oh, yes, this is my invisible essence. :D

The example above will allow novice users to easily navigate in the necessary elements for the IDE, for organizing cross-compilation in general. For specific situations, in any case, an understanding of the principle of work and experience is required.

rick2691

  • Sr. Member
  • ****
  • Posts: 382
« Last Edit: May 12, 2018, 03:13:35 pm by rick2691 »
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #22 on: May 12, 2018, 08:05:32 pm »
@rick2691
I guess, you are right. The old link is a redirect and is left for compatibility. Fix the way in the first post, thanks. :D

Jungle

  • New Member
  • *
  • Posts: 18
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #23 on: April 05, 2021, 09:46:37 am »
I followed @Schrodinger Kater instructions, but get error when applying new target OS/CPU(err_i386-linux.png)
Do I need to change something in fpc.cfg or somewhere else?

When I try to compile default console project for i386-linux, I get error (compile_error_i386-linux.png). It points me to link.res:161 which is
Code: Pascal  [Select][+][-]
  1. INSERT AFTER .data;
Do I need updated binutils?

When I try to compile default console project for x86_64-linux, I get error (compile_error_x86_64-linux.png)
Do I need x86_64 binutils? And do they exist (I can't access ftp locations now due to restrictions)?

P.S. I have x64 Lazarus 2.0.12 on Windows 10 Pro
« Last Edit: April 05, 2021, 09:50:29 am by Jungle »

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #24 on: April 05, 2021, 11:33:47 am »
A lot of time was gon since then...
Most likely I can only explain the first message (err_i386-linux.png):
for cross-platform compilation, these directories
 Lazarus\fpc\3.0.4\fpmkinst
 Lazarus\fpc\3.0.4\units
must contain corresponding subdirectories
 i386-linux (Lazarus\fpc\3.0.4\units\i386-linux\rtl\system.ppu)
 i386-win32
 x86_64-win64

Jungle

  • New Member
  • *
  • Posts: 18
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #25 on: April 05, 2021, 12:55:40 pm »
\fpmkinst\i386-linux\ contains only *.fpm files
\units\i386-linux\rtl\ does contain system.ppu

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #26 on: April 05, 2021, 01:37:49 pm »
1) Download fpc-3.0.4.i386-linux.tar/download and unpack it.
On Windows, this package must be unpacked completely (including binary.i386-linux.tar together with the attached archives) - on Linux it is unpacked automatically.
After that, in "binary.i386-linux" four directories will appear:
 bin
 lib
 man
 share
from the catalog "lib" it is necessary to pick up
 lib\fpc\3.0.4\fpmkinst (contains *.fpm)
 lib\fpc\3.0.4\units (contains system.ppu and others)

Jungle

  • New Member
  • *
  • Posts: 18
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #27 on: April 05, 2021, 01:46:52 pm »
Yes, this is exactly what I've done
P.S. The only exception is FPC version (3.2.0)
« Last Edit: April 05, 2021, 01:49:43 pm by Jungle »

Schrodinger Kater

  • New member
  • *
  • Posts: 9
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #28 on: April 05, 2021, 02:14:56 pm »
fpc-3.2.0.i386-linux downloaded from here https://www.freepascal.org/down/i386/linux-canada.html, unpacked and checked,
the file is present fpc-3.2.0.i386-linux\binary.i386-linux\lib\fpc\3.2.0\units\i386-linux\rtl\system.ppu

Jungle

  • New Member
  • *
  • Posts: 18
Re: How to Lazarus Cross Compile Win32 to Linux ?
« Reply #29 on: April 05, 2021, 02:23:01 pm »
I know the file is here. And I have it in lazarus\fpc\... dir
Anyway I get the above mentioned error

 

TinyPortal © 2005-2018