Building Qemu 0.15.1 on OS X 10.5.8

End of the line for the PPC

So I was wanting to build Qemu for my somewhat new G5.  After going through some hardware hell, of a bad hard disk, ram, and having to reseat the video card (should have figure it’d get shaken in the transit) and blowing out all the gunk, my G5 is now in action! … But silly me I wanted to play with OS/2 and while I do have Virtual PC for OS X (yeah MSDN) I wanted to play with Qemu.

I didn’t feel like dealing with 1.0.1, I thought I’d take a stab at the older stable branch, 0.15.1 .. And what a joy that was.

So first off I installed OS X 10.5 from the nicely provided install DVD.  That went fine with good RAM (shockingly with bad memory it gets corrupted and has all kinds of errors, if only the RAM test from the boot ROM was worth anything…. but it makes a nice chime noise).  So I found out much to my amazement after unpacking and going to build 10.15.1 that it requires.. glib-2.0 .  Well damn, this puts me in the same build hell that made Qemu 1.0+ in Win32.

But I figured OS X being a UNIX it may be somewhat easier to build… Somewhat.

So I started with glib-2.30.2, which of course dies because there is no pkg-config.  I download pkg-config-0.26 which won’t build because… yes, there is no glib-2.0 …. GRRRR!!!!  So I try pkg-config-0.18.1 and it actually builds!  One thing to keep in mind is that you *MUST* have the environment variable “PKG_CONFIG_PATH” set to something like this:

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

or it won’t work. I tried to build glib again, and now it fails because there is no libffi.  I try libffi-3.0.10 and it won’t build with some weird error of:

$ make
MAKE powerpc-apple-darwin9.8.0 : 0 * all-all
make: *** [all-all] Error 1

And yes it still did it after I was able to build glib2 (spoiler!?)…

Thankfully, libffi-3.0.4 did build, and installed fine.  So I try to build glib2 again, and now I fail because it wants gettext, so I went ahead and was able to build and install gettext-0.18.1.1 .  I went to build glib-2 and was totally shocked when it not only configured, but actually compiled!

I installed it, and was able to build Qemu 0.15.1, I just did the i386-softmmu target with the NE2000 fixed to be 0x300,IRQ 10, and enabled the AdLib!  And it compiled!

Now I’m sure some of the things that I’m fighting is that I’m on a PowerPC (G5!) and needless to say this version has been pretty much abandoned by everyone. I’m also using the dev tools that came on the 10.5 DVD, gcc version 4.0.1 (Apple Inc. build 5465) Which is great because they don’t seem to let you download any of the old X-Code stuff anymore..

The good news is that I could boot up my OS/2 disk image, the TCP/IP worked, however the mouse was all screwed up, left clicking just jumps the mouse like crazy, but it seems to track correctly, it just doesn’t click correctly… However the sound works GREAT!

Doom 1.1 on OS/2 2.0 via Qemu 0.15.1 on OS X

I know it isn’t much to look at, but it actually runs!

So here, for my fellow PowerPC OS X refugees, here is Qemu 0.15.1, I just built it for the i386. Doom in OS/2 on it is quite playable, but I’ve got a 2.5Ghz G5 so…. Your millage may vary.  Greatly.

And for the real daring people, here is Qemu 1.0.1 for the PowerPC.  I haven’t done much of any testing outside of loading up OS/2 2.0 from an image I had on my Windows 8 PC, connecting to the internet, and then loading up the shareware version of Doom 1.1

Internet Explorer 5.2.3 for OS X

Internet Explorer

So I was looking for an old favorite of mine, Internet Explorer for OS X, and I found this site, internetexplorermac.org

While it doesn’t have a lot of information about this old abandoned and PowerPC only release, it does maintain a download for this old browser.

For all of you, running Intel OS X, without rosetta you can’t run this. Although if you still have Tiger, or Leopard, then yes you can run IE 5.2.3 for OS X.

10 years of OS X 10.0 !

So today is 10×10 or … ten years of OS X 10.0

I know that is confusing, but the 1.0 version of OS X was released in 1999. I should have saved the receipt, but I still have the box.

It does go without saying that OS X changed apple, as it FINALLY integrated the NeXTSTEP OS onto the consumer level machines, and propelled Apple to the #1 spot for the Unix market. Yeah take a step back with me here, and look at the market like this. Apple ships more computers in any given year then HP/SUN(Oracle)/IBM ship that come preloaded with a UNIX. Not to mention Apple also loads their UNIX is the core of the iPhone, iPad, and some of the iPods. Wow imagine that, Apple brought UNIX everywhere. And made it so buried under a UI 99% of the users don’t even know it’s there.

That’s pretty snazzy, isn’t it?

So 10 years ago today, Apple finally shipped 10.0.0 . And let me tell you it was rough around the edges. I had an iMac and at the time I LOVED it. In between the 1.0 & the 10.0 I had bought a G4 and was disappointed that 1.0 wouldn’t run on my beloved G4. I had no intention of running OS 9, but that’s all it could run. So in those fleeting months I managed to run windows 95 on SoftPC (SLOW!) and even got my hands dirty on OpenBSD for the PowerPC.

OS X really made a splash with usable applications that shipped with the OS. I know the nerds hate iTunes, but damn, it’s something a user can use. Same with Mail, and even Microsoft Internet Explorer.

So enough with the reminiscing, I’m sure you want to see it run under some kind of emulation, right?
Well the best (if not only) emulator for running PowerPC Macintosh stuff is PearPC. And version 0.4 is about as good as it gets. Mostly because of Stefan Weyergraf’s untimely death.

Which is sad, however I did find with a little playing around, 10.0.0 can boot single user mode from the CD.

PearPC 10.0 single user

PearPC 10.0 single user

PearPC 10.0 single user hostinfo

PearPC 10.0 single user hostinfo

One thing was for sure, at the time, 10.0.0 was so.. rough around the edges Apple did give everyone a free copy of 10.1 . And that version certainly better then 10.0! And it runs on PearPC!

PearPC 10.1 boot happy mac

PearPC 10.1 boot happy mac

The boot screen, notice the old style mac.

PearPC 10.1 boot thru motions

PearPC 10.1 boot thru motions

And the progress bar, just like NeXTSTEP. The more things change the more they stay the same..

PearPC 10.1 booted

PearPC 10.1 booted

And welcome to the desktop.

Well since it does run in single user mode, maybe it could be possible to manually place a 10.0 dump on the disk, but that may take a bunch of time… So for now enjoy 10.1!

gcc on the x86_64

Today I thought I’d isolate the portion of simh that crashes 4.X BSD, when SIMH is built with GCC. I managed to find that the “op_ldpctx” and “op_mtpr” procedures of vax_cpu1.c become unstable when built with -O2 flags.

So I extracted the two procedures so I could then built the remainder of SIMH with GCC’s O2 flags. Before going too far, I first went to verify that the results would be consistent with the i386/32bit binaries…

However the results were.. interesting. By default SIMH will build with -O0 flags for the VAX giving the following dhrystone benchmark in 4.3 UWisc BSD:

Dhrystone(1.1) time for 500000 passes = 24
This machine benchmarks at 20833 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 24
This machine benchmarks at 20833 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 24
This machine benchmarks at 20833 dhrystones/second

24 seconds, not so hot. Then the same thing with -O1 flags…

Dhrystone(1.1) time for 500000 passes = 18
This machine benchmarks at 27777 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 18
This machine benchmarks at 27777 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 18
This machine benchmarks at 27777 dhrystones/second

18 seconds! pretty good, thats a 33% increase! Now for my hybrid -O2/-O1

Dhrystone(1.1) time for 500000 passes = 17
This machine benchmarks at 29411 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 17
This machine benchmarks at 29411 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 17
This machine benchmarks at 29411 dhrystones/second

A 5% increase over the -O1 … Nothing too big, but still an INCREASE.

Now for the real fun, I re-ran these bulid factors with the x86_64 compiler.

The -O0/-O0 combination came in at 19 seconds!!

Dhrystone(1.1) time for 500000 passes = 19
This machine benchmarks at 26315 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 19
This machine benchmarks at 26315 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 19
This machine benchmarks at 26315 dhrystones/second

This is pretty amazing considering everything we do should make it faster… The next thing I tried was the -O1/-O1 combination and go the following:

Dhrystone(1.1) time for 500000 passes = 12
This machine benchmarks at 41666 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 13
This machine benchmarks at 38461 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 13
This machine benchmarks at 38461 dhrystones/second

A 12.5 second average! This blew the doors off of the -O2/-O1 on the i386! Naturally I was hoping for at least a 5% increase going to the -O2/-O1 flags on the x86_64, however I got this…

Dhrystone(1.1) time for 500000 passes = 14
This machine benchmarks at 35714 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 13
This machine benchmarks at 38461 dhrystones/second
Dhrystone(1.1) time for 500000 passes = 12
This machine benchmarks at 41666 dhrystones/second

And I ran it numerous times, but the bottom line is that the O2 flags actually produces a SLOWER SIMH on OS X 10.6.4 then -O1 flags… The whole exercise is a tad perplexing to me, to say the least, but unless you bench it, you’ll never know if the compiler is getting confused somewhere, and going to throw a loop. I should also point out that SIMH will not run with full -O2 flags as there is something in the code that breaks under optimization so this very well may not hold true 100% of the time, but at the same point things still have to be tested…

Notes on fat binaries & OS X

I suppose this also applied to NeXTSTEP/OPENSTEP but I didn’t cross build that much between the m68k and i386…

So let’s start with a 3 way compile…

$ gcc -arch i386 -arch x86_64 -arch ppc7400 dhrystone.c -o dhrystone
$ file dhrystone
dhrystone: Mach-O universal binary with 3 architectures
dhrystone (for architecture i386): Mach-O executable i386
dhrystone (for architecture x86_64): Mach-O 64-bit executable x86_64
dhrystone (for architecture ppc7400): Mach-O executable ppc
$

This builds the single file for all 3 machine types of OS X..

For anyone that cares, this is my quad core box..

$ ./dhrystone
Dhrystone(1.1) time for 500000000 passes = 83
This machine benchmarks at 6024096 dhrystones/second

Ok, now let’s pull out the PowerPC executable, and run that….

$ lipo -extract ppc7400 dhrystone -output dpc
$ file dpc
dpc: Mach-O universal binary with 1 architecture
dpc (for architecture ppc7400): Mach-O executable ppc
$
$ ./dpc
Dhrystone(1.1) time for 500000000 passes = 214
This machine benchmarks at 2336448 dhrystones/second
$

Which isn’t too bad, seeing the emulator runs at 1/3rd speed of the native exe.. It’s no wonder that IBM bought transitive, and shut them down. This kind of technology would make it far too easy for everyone to move away from expensive CPUs…!

Now let’s extract the 32bit i386 exe.

$ lipo -extract i386 dhrystone -output di3

Nothing to really see here.

And for the final part, let’s combine the extracted PPC & i386 executables.

$ lipo di3 dpc -create -output dip
$ file dip
dip: Mach-O universal binary with 2 architectures
dip (for architecture i386): Mach-O executable i386
dip (for architecture ppc7400): Mach-O executable ppc

And there we have it.. Using this I guess I can try to find versions of Qemu that will hopefully cross build on my machine that I can stitch together so that some platforms (PPC) have *SOMETHING* to run at least…..

Or maybe it’ll help someone at least make a stub ‘we are sorry, nothing to see here’ vs an exe error.

VMWare Fusion 3.1 & KOTOR

Well let me be the first to say this is a little “modern” compared to all of my prior stuff, but anyways I’ve been enjoying life under OS X the last few days (along with crunch time @ work.. .sigh). As part of my day job I do still have to maintain some MS-DOS & Windows stuff, so while I do run Qemu under OS X, I’ve also purchased a copy of VMWare Fusion 3.1 (available online, and as a 30 day eval!). Ok so it’s $89 with the one year support, pretty snazzy stuff.

Now one thing that I find very interesting, is that unlike all the other more expensive versions of VMWare, Fusion for the MAC allows for SOME 3d apps to run!

I’m still kind of amazed at the stuff that does run and how cleanly it does so.

So I’ve installed good old Windows XP in a VM, then tried Fallout 3. No go. For the hell of it I tried Sims 3, and surprisingly it worked.. Even though it’s silly as there is an OS X version available.

So for today (I think it may be over in a few hours….) Steam is selling Star Wars Knights of the Old Republic for $2.50 USD!

Now KOTOR has been kind of finicky about what machines it’ll run on, in the past, but I have to say, much to my surprise the emulated 3d hardware ran KOTOR out of the box, without any modifications or anything!

So here it is, KOTOR in a ‘window’ on Windows XP in a Window on OS X.

KOTOR under XP VMWare Fusion in a window windowed

KOTOR under XP VMWare Fusion in a window windowed

And it’s playable at 1024×786.. and 1280×960, although at higher resolutions I’ve had issues with the mouse tracking.. .perhaps something about hardware/software mice support?

Anyways, emulation has now come to the point where 3d stuff really does run!