Mac OS 9 Lives

Classic Mac OS Software => Virtual Machine & Emulation => Topic started by: Jubadub on May 27, 2022, 10:01:35 AM

Title: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: Jubadub on May 27, 2022, 10:01:35 AM
Using Classic mode on OS9 to run BSD apps is great. ;) Just tried out MachTen for the first time ever today. LOVE IT!

Now we update all tools.

Then we run QEMU-PPC.

 ::)

Once someone is bored enough, or determined enough, to try this, please let us know. I plan to try this, too, but not now. Too involved with Bochs already.
Title: Re: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: teroyk on May 27, 2022, 01:15:43 PM
Using Classic mode on OS9 to run BSD apps is great. ;) Just tried out MachTen for the first time ever today. LOVE IT!

Now we update all tools.

Then we run QEMU-PPC.

Once someone is bored enough, or determined enough, to try this, please let us know. I plan to try this, too, but not now. Too involved with Bochs already.

Good that you try make new version of Bochs before QEMU, because Bochs is originally programmed with Code Warrior.
I remember testings with OSX that Code Warrior made 30% faster code than Xcode with gcc...and I think that Code Warrior is best to optimize code for PPC,
but it is not 100% gcc compatible (because it is better, I think). But gcc is not standard anyway, although some unix guys think so.

But about topic Power MachTen it is good to run GNU-stuff without x86-emulation in MacOS9 with it, but of course the best if program is converted and compiled
directly to plain Mac OS 9.
Title: Re: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: Jubadub on May 27, 2022, 03:12:01 PM
But about topic Power MachTen it is good to run GNU-stuff without x86-emulation in MacOS9 with it, but of course the best if program is converted and compiled
directly to plain Mac OS 9.

Exactly. The UNIX tools in it also allow me to run a shell script (called "configure" script) that generates a C header file to be used on the source code of Bochs with CodeWarrior on the Mac side. It's also possible to skip this step and do things more manually just on Mac side, but I think it's likely I will be compiling Bochs multiple times (I hope I succeed), which means I should probably make good use of some of the automation, especially because we have Power MachTen... And no need to reboot to OS X and then reboot back to OS 9, either, or use a separate machine.
Title: Re: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: Jubadub on May 28, 2022, 02:35:21 PM
So, in case anyone wants to get the ball rolling, here are the official instructions on how to compile most of the (older) versions of QEMU under UNIX systems, which are (were) listed as having the same steps as GNU/Linux:

https://web.archive.org/web/20080203073227/http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC76
https://web.archive.org/web/20150928012001/http://qemu.weilnetz.de/qemu-doc.html#compilation (this one doesn't mention anything about GCC versions)

Code: [Select]
6. Compilation from the sources
6.1 Linux/Unix
6.1.1 Compilation

First you must decompress the sources:

cd /tmp
tar zxvf qemu-x.y.z.tar.gz
cd qemu-x.y.z

Then you configure QEMU and build it (usually no options are needed):

./configure
make

Then type as root user:

make install

to install QEMU in `/usr/local'.

6.1.2 GCC version

In order to compile QEMU successfully, it is very important that you have the right tools. The most important one is gcc. On most hosts and in particular on x86 ones, gcc 4.x is not supported. If your Linux distribution includes a gcc 4.x compiler, you can usually install an older version (it is invoked by gcc32 or gcc34). The QEMU configure script automatically probes for these older versions so that usually you don't have to do anything.

For most of the duration of QEMU's existence, that is how it was documented.

In more recent years, they changed it here and there, although the same general idea applies:

https://wiki.qemu.org/Hosts/BSD
https://www.qemu.org/download/

In the past, they used to say that GCC 4 was "too new" and instead an earlier version was preferred (which is great for us). However, it seems to suggest that QEMU might want GCC 3.2.x or GCC 3.4.x, and Power MachTen might be stuck with gcc 2.8.1: According to Cameron Kaiser from Floodgap (from Classilla/TenFourFox/Talospace fame), he was unable to upgrade to GCC 3 or GCC 4, although he did not specify which exact version he tried, nor if he tried building GCC 2.95.x or even rebuilding 2.8.1 to try things out. So honestly, there's still a lot to explore in terms of updating GCC in Power MachTen.

Kaiser's page talking about GCC: http://www.floodgap.com/retrotech/machten/base.html
GCC versions in release order: https://gcc.gnu.org/releases.html

Finally, here you can find the official downloads for the source code of most QEMU versions:

https://download.qemu.org/

You can dig for even earlier versions' source codes if you want, over here:

https://web.archive.org/web/20030601085257/http://fabrice.bellard.free.fr/qemu/
https://web.archive.org/web/20050220020835/http://fabrice.bellard.free.fr/qemu/index.html
https://web.archive.org/web/20071018041459/http://fabrice.bellard.free.fr/qemu/index.html

Note how the versioning numbers only changed in very recent years (version 3 onwards). That's because they decided to change how they do version numbering itself, and not because they suddenly made breakthrough after breakthrough more than ever in the past. So it's confusing what they did, but it's no big deal.

One question that remains is: what versions will build with gcc 2.8.1? It seems fair to estimate that QEMU 1.x.x versions are a good place to start.
Another route is to try multiple GCC versions, exact versions, and see how that goes. Maybe see what needs patching, and where, and why. And of course, not to assume, for example, that if GCC 3.4 doesn't work, that then no 3.x.x version will work, or any other hasty conclusion like that.

There might be other dependencies to keep an eye out for besides GCC, but it is the only dependency that I saw the old docs focus so much attention to.

Ok, now back to Bochs. :)
Title: Re: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: teroyk on May 30, 2022, 02:52:43 AM
Maybe little offtopic, but it might be nice that Power MachTen X-window gets look refresh like this:
http://photos1.blogger.com/x/blogger/4409/2312/1600/923457/FreeBSD_241104.jpg
more about how that done in FreeBSD: http://oesediez.blogspot.com/2007/01/os-x-wanna-be-on-freebsd.html
And it compile some OSX stuff for Power MachTen then it would be "OSX Classic" for Mac OS 9  ;D
Title: Re: Power MachTen kicks ass. Can we compile QEMU for it?
Post by: teroyk on June 05, 2022, 05:01:54 AM
How far Power MachTen compatibility is from Darwin OS? Could it be use as compatibility layer to compile Darwin 1-5 apps to Mac OS 9 with MachTen?
from wikipedia (https://en.wikipedia.org/wiki/Darwin_(operating_system)):
"Up to Darwin 8.0.1, Apple released a binary installer (as an ISO image) after each major Mac OS X release that allowed one to install Darwin on PowerPC and Intel x86 systems as a standalone operating system.[10] Minor updates were released as packages that were installed separately. Darwin is now only available as source code."
or will it be better try x86 version in VirtualPC? What is last Darwin version that doesn't need SSE?