This is a very minor issue, that may not be worth any engineering/development time, but i wanted to report it.
The FreeDOS package for Free Pascal Compiler installs FPC which depends on Go32v2.
I wanted to build a 16-bit FPC compiler on FreeDOS (i.e. a compiler that did not depend on Go32v2).
Using the directions on
https://wiki.freepascal.org/DOS, I downloaded the FPC source files and unzipped them on FreeDOS. There were some errors unzipping (I think due to total path name length, or long file name issues), but that is not the issue and the unzipping errors may not be fixable. I then attempted to build a cross compiler with the command:
make clean all OS_TARGET=msdos CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=-WmSmall BINUTILSPREFIX= PP=C:\my\path\to\ppc386.exe
The build did not succeed. The issue I ran into and the issue I am reporting is that ppc386.exe uses the CFGFILE environment variable to point to its configuration file. This is all well and good, however, FreeDOS *also* uses the CFGFILE environment variable to point to the location of FDCONFIG.SYS. So, on FreeDOS, when ppc386.exe reads the config file specified by CFGFILE, it loads FreeDOS's FDCONFIG.SYS file. This results is strange errors when building (e.g. 'Illegal parameter: 345?SHELL=C:\FreeDOS\BIN\COMMAND.COM ...', which is a line that appears in FreeDOS's FDCONFIG.SYS).
As I said, this is a very minor issue and may not be worth the time to fix. It's easy enough to just 'set CFGFILE=', which clears the environment variable before building.
I eventually used the pre-built cross compiler on Linux. Thank you to whoever supplied them.