Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

Finally got QEMU compiled for Windows—success assured

by Mike Levin SEO & Datamaster, 10/12/2012

Ugh! I knew compiling a curses-enabled version of QEMU for Windows was going to be harder than on Linux and Mac, but I had no idea how much harder! I probably won’t even be able to document precisely what the special cocktail mixture is right away, I tried so many different things.

But finally, I got it to work, after reaching out to both Stefan Weil who did the latest popularly distributed Windows QEMU binaries, and the mxe cross compiler listserv. I tried compiling it native on Windows 7, then cross compiling from Linux, then back to native again. The problem is that there are just so many moving parts that have to be aligned just-so. It was a real puzzler.

The keys to making it work was to REALLY have all the documented dependencies copied into location, and then a few that weren’t documented. And then finally, I had to use one version older than the latest of pdcurses and do a couple of edits to its include file. And even after all of that, the make procedure generates a ton of incompatible data type warnings that appears to have to do with string formatting, but still I got the Core Linux booted and running directly from the command line. So, success is assured.

Now, it’s just a matter of refinement. I am zeroing in on a clean Levinux Version 0.2 based on the latest QEMU 1.2.0 compiled for Mac, Linux and Windows and the latest text-based Tiny Core Linux. It’s going to be a remarkable little learning platform and code-preserver. I’m going to call it 0.2 because my earlier proof-of-concept Levinux based on a strange cocktail of whatever-worked binaries will be turned into version 0.1 and made available as a curiosity. I’ll release both as soon as I encapsulate the dependencies across all three platform and make it truly portable and install-less.

I had the moment of guaranteed success today. It’s like when the Wright brothers were trying to turn their gliders into motor-driven airplanes. They knew there was a magic ratio between the weight of the motor and the lift that they could produce. If they could produce enough lift to get the weight of the motor plus glider off the ground, they knew they could achieve flight, even though all the testing was in a wind tunnel. This is the moment of success assured. I had that moment today with Levinux. I did my third and final compile on Windows and booted Core Linux in text-only “curses” mode.

As my next step, I will be isolating all the dependencies that don’t come as default with the host system. For example, the Windows QEMU I just compiled works off of mscvrt.dll, which is a standard Windows library that’s been shipped with every system since Windows 2000. I therefore won’t bundle that in, but I will do all the other shared libraries that the Homebrew package management system put in it’s install location.

I will be faced with the choice of recompiling the each platform’s QEMU with better ./configure and make parameters to round-up and contain all those dependencies in a single directory. There are opportunities to tell it where to look for its files. But there are also stupid operating system tricks you can do after the fact to force it to look certain places—especially if you’re launching the program from a script-file, which I have to do in any case, because I’m running QEMU in text-only mode from a terminal command window. So by definition, it will be launched from a script, providing the perfect opportunity to do these stupid OS tricks.

Version 0.2 of Levinux will be doing exactly that, because I want to bank the success I currently enjoy of having working binaries across all three platforms. This project will iteratively improve over time, with me tackling a different optimization with each version, until the whole distribution is as teensy-tiny as it can be, and simultaneously more powerful.