Recent

Author Topic: Cross-compiling using official Lazarus 2.0.12 x86_64 into go32v2 DOS  (Read 3681 times)

Hydexon

  • Full Member
  • ***
  • Posts: 170
Hi, long time not see! :D

I was going back to Pascal to write an small game project of mine, got an simple basic prototype working using SDL2, and i wonder if i can crosscompile this to MS-DOS 386 using GO32V2, i'm completely aware SDL2 cannot run under extended DOS, so no need to mention it, so that's why i can replace it with alternatives (PTCPas comes to mind), so my main question is how to crosscompile to GO32V2 using a 64-bits installation of Lazarus IDE, i'm aware there's an GO32V2 crosscompiler for Lazarus but it's for 32-bits only, i can't use the toolchain in my native x64 version of Lazarus or there's another alternative which doesn't implies to download or mess with my main PC? :-[ or i have to install two versions of Lazarus (both 64 and 32 bits alongside on my system)

Thanks you!.
Lazarus 1.0.4 Stable - FPC 2.6.0 - gtk2 | Linux Mint 14 Nadia | GNOME Shell 3.6.2 - Awesome | Intel x86 | HP Mini 1020-LA Netbook (old)
Lazarus 2.0.2 Stable - FPC 3.0.2 - Windows | Lenovo IdeaPad Y

lucamar

  • Hero Member
  • *****
  • Posts: 4219
It's not the bitness of Lazarus that matters, but having a proper FPC cross-compiler. I've never done it but there should be no or little problem if you install a full Go32v2 tool-chain and point Lazarus to it, just as one can install, say, Lazarus Win 32bit + AddOn for 64 bit (and viceversa).

It might be problematic if your base install is a Linux or MacOS one, since then you'd have to build a proper DOS 32bit toolchain, but if you're in Windows it should be (almost) a snap.

HTH!
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
I was going back to Pascal to write an small game project of mine, got an simple basic prototype working using SDL2, and i wonder if i can crosscompile this to MS-DOS 386 using GO32V2, i'm completely aware SDL2 cannot run under extended DOS, so no need to mention it, so that's why i can replace it with alternatives (PTCPas comes to mind), so my main question is how to crosscompile to GO32V2 using a 64-bits installation of Lazarus IDE, i'm aware there's an GO32V2 crosscompiler for Lazarus but it's for 32-bits only, i can't use the toolchain in my native x64 version of Lazarus or there's another alternative which doesn't implies to download or mess with my main PC? :-[ or i have to install two versions of Lazarus (both 64 and 32 bits alongside on my system)

You didn't mention your host platform, so I assume Windows.

You can just as well use the 32-bit based cross compiler (the fpc frontend simply calls the corresponding platform specific backend which can be any bitness the host OS supports (*)). Install it and then move the content of %LazarusDir%\fpc\3.2.0\bin\i386-win32 to %LazarusDir%\fpc\3.2.0\bin\x86_64-win64 (but don't overwrite anything existing). You should then be able to select i8086 as the target CPU.

(*) This would mean that - if the port in FPC's trunk would work correctly already - on Windows on ARM64 a aarch64-win64 fpc.exe could call a i386-win32 ppc386.exe due to the OS emulating x86 binaries.

Hydexon

  • Full Member
  • ***
  • Posts: 170
Sorry i forgot i was on Windows x64, so yeah tried to research for myself but the only prebuilt cross-toolchain available is for the realmode i8086 target only and i'm not looking for that, so it's fine if i use the 32-bit version of Windows FPC official distribution for GO32v2?
Lazarus 1.0.4 Stable - FPC 2.6.0 - gtk2 | Linux Mint 14 Nadia | GNOME Shell 3.6.2 - Awesome | Intel x86 | HP Mini 1020-LA Netbook (old)
Lazarus 2.0.2 Stable - FPC 3.0.2 - Windows | Lenovo IdeaPad Y

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Sorry i forgot i was on Windows x64, so yeah tried to research for myself but the only prebuilt cross-toolchain available is for the realmode i8086 target only and i'm not looking for that, so it's fine if i use the 32-bit version of Windows FPC official distribution for GO32v2?

Simplest would be to install the GO32v2 distribution for Windows and then adjust the compiler path in the settings of Lazarus (you'd need to change it then if you switch to a non-GO32v2 project).

A bit more involved, but in the end more convenient would be the following approach (note: I have not installed the GO32v2 distribution, so the directories might be off):
  • install GO32v2 distribution
  • copy units from %GO32v2%\units\i386-go32v2 to %LazarusDir%\fpc\3.2.0\units\i386-go32v2
  • copy any binary from bin\i386-go32v2 not already contained in %LazarusDir%\fpc\3.2.0\bin\x86_64-win64 (!) (yes, that means that if there already is a ppc386.exe you don't replace that; each ppcX binary can compile for all of the supported targets for X)

Now your default FPC for Lazarus should be able to use i386-go32v2 as well (you can then uninstall the no longer required GO32v2 distribution).

 

TinyPortal © 2005-2018