Recent

Author Topic: Cross Compile for Dos on Silicon Mac  (Read 478 times)

sitrucz

  • Newbie
  • Posts: 1
Cross Compile for Dos on Silicon Mac
« on: January 19, 2026, 03:49:01 pm »
Is it possible to cross compile for Dos on an M3 iMac?  I'd like to use my Mac for source code using VSCode.  Trying to compile out of the box I get the error below.

*  Executing task: fpc -Tdos -Parm8086 -O1 -Sg fdver.pas

Error: Illegal processor type "arm8086"

I installed arm64 Debian 13 in UTM on my Mac and fpc -i has no mention of dos or 8086 so what are my options at this point?

andersonscinfo

  • Full Member
  • ***
  • Posts: 156
Re: Cross Compile for Dos on Silicon Mac
« Reply #1 on: January 19, 2026, 03:49:40 pm »
Yes, it's possible to cross-compile for DOS on an M3 iMac, but you need to install the DOS targets in Free Pascal Compiler (FPC). The error occurs because the DOS target and 8086 processor support aren't compiled into FPC by default.

Here are your options:

1. **Rebuild FPC with DOS support**: You'll need to download the FPC source and compile it with DOS targets enabled. This involves configuring the build process to include the DOS target.

2. **Install DOS units separately**: If your FPC installation supports it, you might be able to install the DOS units separately through the FPC installer or package manager.

3. **Use an existing DOS-enabled FPC build**: Look for a pre-built version of FPC that includes DOS support. Some distributions provide packages with additional targets.

4. **Use the VM approach**: Since you already have Debian in UTM, you could install FPC in the VM with DOS support enabled. Inside the Debian VM, you can configure FPC to build DOS executables.

For option 4, inside your Debian VM, you would typically run:
```bash
fpc -Tdos -Parm -O1 -Sg fdver.pas
```

Note that you should use `-Parm` (for ARM) instead of `-Parm8086` when compiling in the ARM VM, but the target remains `-Tdos`.

The `-Parm8086` you're using is incorrect syntax - the processor type should be specified as `-Parm` for ARM architectures, and FPC will handle the DOS target translation internally when properly configured.

Att.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Cross Compile for Dos on Silicon Mac
« Reply #2 on: January 20, 2026, 08:57:06 am »
I would recommend a dedicated DosBox as VM:
It runs great through the Rosetta 2 translation layer on my M4 Mac mini. (Intel emulation)
You can cross-compile your code to a directory that you can subsequently mount as a driveletter in DosBox.
Cross-compiling with Freepascal works better/ to me the only option,  then running your app on DosBox works great. DosBox is nowadays just as good as running on real hardware.

This should work on any M hardware, not only my M4.

https://doesitmac.com/app/dosbox

Note it did take me some time - longer than on Linux or Windows - to get fpc working natively on my M4, but it works and I am not a real expert: The mini M4 is a toy, not in daily use here.
« Last Edit: January 20, 2026, 09:08:07 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Cross Compile for Dos on Silicon Mac
« Reply #3 on: January 20, 2026, 09:19:24 am »
Oh: the arm8066 does not exist: should be AARCH64 NOT ARM and the cross compiler should be build for DOS 8086. I will add instructions if you want.

The screenshot is NOT from the Mac, but the screen for fpcupdeluxe would be almost the same.
Will add that later if you need it, have to fire it up.
If you have already a native compiled fpc (aarch64/darwin) I can also give instructions to build the cross compiler manually, without fpcupdeluxe.

The workflow is:
1) make sure you have a Darwin AARCH64/Darwin running.
2) build the cross-compiler from there (CROSSOPT CROSSINSTALL)
« Last Edit: January 20, 2026, 09:42:53 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

PascalDragon

  • Hero Member
  • *****
  • Posts: 6311
  • Compiler Developer
Re: Cross Compile for Dos on Silicon Mac
« Reply #4 on: January 20, 2026, 10:54:36 pm »
Yes, it's possible to cross-compile for DOS on an M3 iMac, but you need to install the DOS targets in Free Pascal Compiler (FPC). The error occurs because the DOS target and 8086 processor support aren't compiled into FPC by default.

First, the forum software does not support MarkDown. Use its BBCodes for formatting.

Second, your reply is wrong. It is not possible to cross compile from non-x86 to x86, because the non-x86 targets don't support the Extended precision which is in fact required when building for the target. So you'll need to use Rosetta 2 to run the x86 variant of the compiler to build the i8086 cross compiler.

 

TinyPortal © 2005-2018