So after looking at the -Ofast flags in that utterly unfair GCC 1.4 vs GCC 5.1, and 6.1Â , I thought I’d try to build Cockatrice III with it. Â Everything went well, and I had a build in no time.
I always hated how I had to massively downsample the audio so I could at least hear things, so I thought I’d try to put them back to 44100Khz, 16bit stereo. Â And while compiling, older GCC runs fine, while 6.1 throws this run error!
../SDL/audio_sdl.cpp:57:43: error: narrowing conversion of '-1404829696' from 'int' to 'uint32 {aka unsigned int}' inside { } [-Wnarrowing]
uint32 audio_sample_rates[] = {44100 << 16};
^
makefile:104: recipe for target 'obj/audio_sdl.o' failed
make: *** [obj/audio_sdl.o] Error 1
Well it turns out that it’s getting truncated as the audio_sample_rates are defined as an unsigned int, but it really want’s to be a regular integer. Â So I changed the type, and now I have high def audio! Â While I was in there, I fixed some stupid typos in the keyboard so I can actually use vi in MacMiNT.
It’s still in 256 colors, I’m missing something fundamental as to why it’s not working but I just don’t have enough time to mess with it today.
So while mixing and matching GCC on Windows, I ran into this issue with stdio.h of all things:
In file included from hi.c:1:0:
\mingw\include/stdio.h:191:65: error: unknown type name ‘size_t’
_CRTIMP int __cdecl __MINGW_NOTHROW setvbuf (FILE*, char*, int, size_t);
^~~~~~
Good grief how could stdio be all screwed up?
Well, it turns out it was my fault. Â I had not rebuilt things like SDL, or copied over pcap so I figured I could incorrectly just point a -I to my old includes, and the new gcc would post-pend all use -I stuff. Â NOPE it pre-pends them, meaning the old headers now take priority. Â And wouldn’t you know it, things have drifted between versions. Â So I just manually copied the files and libraries and all was well.
Googling around I did see other people with broken stdio.h but nobody posted the solution. Â I guess it’s to embarrassing, but here we are.
If you ever get this fun error while trying to exit or shell a program with DJGPP:
combinelo: memory fouled
free: memory fouled
You are mixing libraries built with a different version of the DJGPP runtime. Â In my case, I built the allegro library with GCC 2.7.2.2 to use the older binutils but I’m cross compiling with GCC 5, so it’s using the newer runtime.
In my case I just needed to replace the contents of the lib directory with djcrx202.zip, and I was good to go.  I guess I could re-compile allegro, but that takes the better part of forever on DOSBox, and once was good enough.
Since MS-DOS has it’s 6.1.0 I was dying to re-build stuff for 6.1.0.  As I don’t want to build it myself I did mange to find a version on equation.com
I rebuilt Cockatrice III, and that seems to be running fine.
D:\emx\demo\dhry>gcc610.exe
Dhrystone(1.1) time for 500000000 passes = 53
This machine benchmarks at 9433962 dhrystones/second
D:\emx\demo\dhry>gcc610_O.exe
Dhrystone(1.1) time for 500000000 passes = 18
This machine benchmarks at 27777777 dhrystones/second
D:\emx\demo\dhry>gcc610_O2.exe
Dhrystone(1.1) time for 500000000 passes = 16
This machine benchmarks at 31250000 dhrystones/second
D:\emx\demo\dhry>gcc610_Ofast.exe
Dhrystone(1.1) time for 500000000 passes = 13
This machine benchmarks at 38461538 dhrystones/second
As you can see the scores are actually slower than GCC 5.1.0. Â Well that was kind of surprising. Â Since I almost never read the manual, I did find out about -Ofast vs -O3/-O2, and yes, it is much faster! Â So I guess I should recompile everything with GCC 5.1.0 … But I do prefer the diagnostic messages in GCC 6, it’s very CLANG like.
This one should have been much easier to build, it has support for SDL built in, however the include files are a nested mess, and configure fails part of the way in the process leaving the source kinda messy. Â But a few hours over a couple of days, and here we are.
This version doesn’t run at warp speed, has sound, and is great. Â Â It wants a config file though. Â You can find the specs in the readme, but something like this:
works fine. Â This later (and seemingly last) branch of UAE Â incorporates lots from WinUAE, except for the JIT. Â It’s dated 2008, so it does include support for the 68030, 68040, and the 68881 and 68882. Â It doesn’t have MMU support, so things like Linux/AMIX/NetBSD/Enforcer are out of the question.
I can’t find any source of the 0.5 versions, and I had issues with 0.6.x  but with enough mashing of stuff around I did manage to get 0.7.6 to compile, then leaning more on the xwin.c source file I was able to get the SDL output working for 32bit depth (does anyone even have 8bit displays anymore?).  I suppose with this version working I can go back and take a stab at resurrecting 0.6.x
What is cool is that 0.7.6 (perhaps earlier versions of 0.7?) switched from a non commercial license to the GPL 2.0 license.
I managed to ‘fix’ the keyboard in this version so that not only does it not type too fast, but it’ll remember “sticky” keys like shift, control & meta. Â So now you can actually use the CLI, and change disks. Â Double clicking is an impossibility as it simply runs far too fast. Â I compiled in audio support but didn’t bother with the SDL end, as it would sound like noise with it running so fast.
I also updated UAE 0.4, with the fixed keyboard code, and it’s usable now as well, with the same caveat that it simply is just too fast. Â UAE is from an era where a 100Mhz computer was a luxury item. Â Now some $5 computer, you could pack in breakfast cereal has a 1Ghz processor.
For the 2/3 people who care, I put the binary & source tree on sourceforge here. UAE 0.4 & UAE 0.1 are also available for download, plus all the source code I’ve been able to find.
I know with all the talk of GCC 6.1.0 for MS-DOS, and other platforms, you must be thinking that all this talk of progress, and high versions numbers just isn’t right! I’ve just started to migrate code to GCC 5.1, and now you are telling me there is a GCC 6!
Where can I turn away from all this so-called progress! I don’t like my C compilers to be C++ programs that require massive HOURS to compile. Can’t we just go back to the good old days?
And the answer is YES, you can!
While looking for some libraries on another project, I came across this old defunct project called RSXNT. And it’s a port of EMX to Win32 platforms! Well isn’t that fantastic!
So, considering I was able to build GCC 1.40 and cross compile to Linux 0.11 from Windows, can we do something with this?
Well ancient versions of EMX are very difficult to track down. Somehow, I did manage to find this hybrid of 0.8B & 0.8C. The EMX runtime & binaries are from 0.8C, but the source code is from 0.8B. And the best thing is that the 0.8B is based around GCC 1.40! So with a little bit of tweaking the files, and messing around I got the assembler, linker, and C compiler to build with MinGW! Sadly the source code to EMXBIND, wasn’t included in the zips that I have, but the aformentioned RSXNT packages included a version of EMXBIND that will run on Windows! So I managed to mash them together, and for the fun of it, I’m using the old InfoTaskForce interpreter from 1987 to complete the vintage feel.
Compiling & Binding
Now with my executable, I can run it on MS-DOS & OS/2!
MS-DOS via DOSBox
and OS/2 2.0!
OS/2 (on Qemu)
Well isn’t that fantastic!
However when running RSXNT’s bind, NTBIND I got this error:
D:\emx_w32\infocom>..\bin\ntbind info2
No relocations in file:
you have not linked the NT library
Great. Some more digging around, and if you want to make Windows programs, you need to use the RSXNT includes & libraries. So I shifted the libraries around, and patched gcc to call the linker the same way RSXNT’s gcc driver calls it, and first go this error:
io.o: Undefined symbol __streams referenced from text segment
And looking at the stdio.h there is this:
extern struct _stdio _streams[];
No doubt, the headers & libraries are tied together. So now making both of the RSXNT versions, I can link the executable. (YES I did try declaring the structure anyways, and I get stdout, but stdin doesn’t work).
Running on Windows 10
Just like EMX before it, RSXNT, requires you to have the RSXNT.DLL file in your path, or in the same directory. I suppose it’s a fair trade off. Not that I expect there to be a surge of people cross compiling from Windows to OS/2, or even MS-DOS these days. GCC 1.40 is ancient, 1991 vintage, but even Linus Torvalds loved it!
For comparison, GCC 5.10 produces a 55,906 byte interpreter, while GCC 1.40 produces a 88,576 byte interpreter.
For an attempt at porting some code, I choose Nethack 1.3d, and used the MS-DOS based makefiles. It didn’t work so well, but I was able to patch in enough of the unix based termios logic, and thanks to EMX/RSXNT’s built in termios capabilities I was able to get a working version!
Nethack 1.3d on Windows 10 x64
I don’t know if there really was any advantage to compiling with GCC 1.40, but it was great to see that this 1991 compiler could handily compile the 1987 based code.
How about some speed comparisons? I dug out the ancient dhrystone.c, and gave it a shot. I had to define 500,000,000 passes, as my computer is fast. GCC 1.40 only offers -O for optimization, while GCC 5.1 offers many more levels, but for this quick experiment they really aren’t needed.
D:\emx\demo\dhry>gcc140.exe
Dhrystone(1.1) time for 500000000 passes = 57
This machine benchmarks at 8771929 dhrystones/second
D:\emx\demo\dhry>gcc140_O.exe
Dhrystone(1.1) time for 500000000 passes = 40
This machine benchmarks at 12500000 dhrystones/second
D:\emx\demo\dhry>gcc510.exe
Dhrystone(1.1) time for 500000000 passes = 43
This machine benchmarks at 11627906 dhrystones/second
D:\emx\demo\dhry>gcc510_O.exe
Dhrystone(1.1) time for 500000000 passes = 16
This machine benchmarks at 31250000 dhrystones/second
D:\emx\demo\dhry>gcc510_O2.exe
Dhrystone(1.1) time for 500000000 passes = 14
This machine benchmarks at 35714285 dhrystones/second
D:\emx\demo\dhry>gcc510_Ofast.exe
Dhrystone(1.1) time for 500000000 passes = 11
This machine benchmarks at 45454545 dhrystones/second
As you can see, GCC 1.40 produces the slowest code. While it’s optimized code did beat out GCC 5.10 with no optimizations, turning on optimizations did blow it away. And again GCC 5.1 beat out the older 1.40 for executable sizes.
And this time by over a 2x lead! It is fair to say that the new versions of GCC, despite being significantly larger do indeed produce smaller and faster code.
For anyone who’s read this far, I guess you want to take it out for a test drive? Remember it is still EMX based, which means is wants to live on the ROOT of your hard disk. I’m using the ‘D’ drive for myself, so if you are using C or whatever you’ll need to alter the environment vars.
This is announcement of an update of DJGPP port of GCC-6.1.0
GCC used to stand for the GNU C Compiler, but since the
compiler supports several other languages aside from C,
it now stands for the GNU Compiler Collection.
Build for DJGPP 2.03p2 is not and will not be available. *
Warning: DJGPP port of binutils-2.22 or newer is recommended.
Version 2.19 and 2.20 may work but are not tested
It is however recommended to use binutils-2.22
or newer
Use of DJGPP port of binutils-2.22 or newer is however required for
Binaries are built and tested mostly under Windows Vista Business (SP2)
Source RPMS needed for building Linux to DJGPP cross-compiler
Binary RPMs for both i686 and x86_64 are available. I built these binary RPMs
in CentOS 6.7 chroot under Fedora 23. Binaries are statically linked with GMP-6.1.0
MPFR-3.1.4 and MPC-1.0.3 to avoid unnecessary dependencies and increase
compatibility with other Linux distributions. For example they are expected
to work without problems in other reasonably recent Linux distributions
(like Fedora, RHEL-6 and newer, etc)
gcc610s2.zip is no more provided as patching GCC using DJGPP tools
has not been tested and even attempted by me for a long time.
DJGPP source file gcc610s.zip is a side product of building
gcc-6.1.0 Linux to DJGPP cross-compiler RPM packages. See source
RPM for patches applied to original FSF version of GCC-6.1.0.
You can find the same contents in the file
Cross-compiler binary RPMs (built under CentOS 5.11 i386, are expected to work on other recent enough RPM based Linux distributions, I myself have tried Fedora 19 x86_64):
I cannot promise however, that I’ll update it very often.
However new versions may appear there earlier (including ones not available
from ftp://ftp.delorie.com).