* * *

Author Topic: cross compilation win32 --> linux i386  (Read 1039 times)

Bazic

  • Newbie
  • Posts: 4
cross compilation win32 --> linux i386
« on: October 05, 2017, 02:56:58 pm »
I digged out but did not find current & working  info nowhere...

Please can somebody give step by step info what files from what place should I copy?

I installed:
1. on win32 lazarus1.6.4
2. on linux debian corresponding .deb packets: fpc, fpc-src, lazarus-project downloaded fresh from here..

There is no exact "copy list" to do from linux host do windows machine to be able cross compiling win32-->linux-i386

I have no clue how to avoid linker error on win32 side. (I copied some crti.o, ... etc files, but after this the error still persists but without any specific file missing)

Handoko

  • Hero Member
  • *****
  • Posts: 1771
  • My goal: build my own game engine using Lazarus
Re: cross compilation win32 --> linux i386
« Reply #1 on: October 05, 2017, 04:06:54 pm »
Maybe I'm stupid. It took me months of gathering information everywhere, testing and learning to be able to cross compile from Linux to Win32. %)

And then I was surprised how easy you can cross compile using CodeTyphon.
http://www.pilotlogic.com/sitejoom/index.php/codetyphon

CodeTyphon is great, you should at least give it a try. I don't use it because CT is not fully compatible with Lazarus, which I already feel convenient with.

engkin

  • Hero Member
  • *****
  • Posts: 1758
Re: cross compilation win32 --> linux i386
« Reply #2 on: October 05, 2017, 06:28:30 pm »
Fpcupdeluxe is what you need. According to its Readme.TXT:
Quote
Prerequisites
=============

- Windows
=========
- none, *but* an SVN installation in your path (e.g. TortoiseSVN) is recommended
You can build Lazarus without an svn.exe in your path, but the Lazarus tool
svn2revisioninc won't work and you won't get an SVN revision number in your
Help/About box.
If needed, the tool will download all needed binaries (bootstrap compiler,
binutils, svn executable)

...

Cross compiler extensions
=========================
fpc(laz)up has a facility to extend its functionality using cross compiling modules.
These are classes that inherit from the fpcup TCrossInstaller class defined
in m_crossinstaller.pas

An example is the Windows 32=>Windows 64 cross compile unit in m_crosswin64.pas.
Note that this is a simple version, as there is no need for separate binutils and library paths.
A similar module is the *nix=>Windows 32/64 modules in
m_anyinternallinker_to_win386.pas and m_anyinternallinker_to_win64.pas
These modules get registered automatically (using the unit's initialization
section) when compiled into the fpcup code.
You do need to add the unit to the fpcup.lpr project uses clause though.

To use them, you would specify
--cputarget= (e.g. i386, x86_64... the way FPC defines the CPU names)
See fpcup -h for possible values
--ostarget= (e.g. freebsd, win32,...... the way FPC defines the OS names)

What you want to build e.g.
--only=FPCCleanOnly,FPCBuildOnly
(or leave this parameter for building FPC and the Lazarus LCL)

If there's a cross compiler available for the combination source+target OS/CPU,
it will run. Otherwise you will get an error message.

For any platform that has an internal linker in FPC (FreeBSD, Linux,..)
you can run a Windows cross compiler: 32 bit:
--cputarget=i386 --ostarget=win32 --only=FPCBuildOnly,LazarusBuildOnly
or Windows 64 bit:
--cputarget=x86_64 --ostarget=win32 --only=FPCBuildOnly,LazarusBuildOnly
When that is done, you can cross compile to Windows using Lazarus.

See fpcup.html for more details on implementing your own cross compilers and other extensions to fpcup.

Edit:
See this post.
« Last Edit: October 05, 2017, 07:03:12 pm by engkin »

lazer

  • New member
  • *
  • Posts: 25
Re: cross compilation win32 --> linux i386
« Reply #3 on: October 06, 2017, 05:25:53 pm »
Maybe I'm stupid. It took me months of gathering information everywhere, testing and learning to be able to cross compile from Linux to Win32. %)

And then I was surprised how easy you can cross compile using CodeTyphon.
http://www.pilotlogic.com/sitejoom/index.php/codetyphon

CodeTyphon is great, you should at least give it a try. I don't use it because CT is not fully compatible with Lazarus, which I already feel convenient with.

Thanks for the tip.  Having spend two days already I can understand how long it took you.

Sadly a tool which requires the user to basically become a memner of %wheel makes a joke of linux security.  I may as well just go back to using Windows XP and stop worrying about cross-compilation.

http://www.pilotlogic.com/sitejoom/index.php/wiki/135-wiki/codetyphon-host-oses/522-ct-on-redhat-enterprise-7-3
Quote
add at the end of /etc/sudoers the line:

username ALL=(ALL) NOPASSWD: ALL


 >:(

cpicanco

  • Sr. Member
  • ****
  • Posts: 414
    • My Portfolio
Re: cross compilation win32 --> linux i386
« Reply #4 on: October 06, 2017, 05:32:54 pm »
Thanks to Handoko I am able to cross compile from linux64 to win32 and win64 (see stimulus_control repository down here). The missing piece for what I want is linux64 to android (with fpGUI).


engkin

  • Hero Member
  • *****
  • Posts: 1758
Re: cross compilation win32 --> linux i386
« Reply #6 on: October 06, 2017, 05:53:17 pm »
@cpicanco Win32 to Linux32 is a click of a button:
It is already possible. I use fpcupdeluxe to download several Lazarus/FPC combos (trunk/stable) on the same pc, and everything needed to cross compile from one of them (Win32) to Win64/Lin32/Lin64 at a click of a button.

cpicanco

  • Sr. Member
  • ****
  • Posts: 414
    • My Portfolio
Re: cross compilation win32 --> linux i386
« Reply #7 on: October 07, 2017, 03:47:31 pm »
@engkin, win32 is not libre nor open.

engkin

  • Hero Member
  • *****
  • Posts: 1758
Re: cross compilation win32 --> linux i386
« Reply #8 on: October 07, 2017, 05:31:32 pm »
@engkin, win32 is not libre nor open.

True.  :(

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: cross compilation win32 --> linux i386
« Reply #9 on: October 07, 2017, 05:57:01 pm »
Thanks for the tip.  Having spend two days already I can understand how long it took you.

(I did my first try in 1998, from Linux to Freebsd. It failed because FreeBSD was not a target yet. After I fixed that I tried again and some of the experiences of a second round of testing in 2003 were the fundament for the buildfaq)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: cross compilation win32 --> linux i386
« Reply #10 on: October 07, 2017, 06:00:08 pm »
@engkin, win32 is not libre nor open.

Windows 10 is not free, but  win32/win64 is debatable since Win32 applications run on Wine, ReactOS etc.

Win32/64 is the application  target, and while the kernel is not free, you are not forced to use the kernel, you can use additional free substitutes (reactos, wine).

Windows 7/8/10 is certainly not free, but win32/win64 might.

cpicanco

  • Sr. Member
  • ****
  • Posts: 414
    • My Portfolio
Re: cross compilation win32 --> linux i386
« Reply #11 on: October 08, 2017, 12:37:08 am »
Quote
Windows 7/8/10 is certainly not free, but win32/win64 might.

Hopefully they will become at least open (as in open source). They are already doing something in this way: https://msdn.microsoft.com/en-us/commandline/wsl/about

But free as in GPL... I afraid to say: never.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus