¶Recompiling code for Windows 8 ARM
I've been a bit busy on non-coding stuff as of late, but I did manage to get some time to install the Windows 8 Developer Preview natively. Previously I had been running it on a VirtualBox VM, which worked but only supported non-accelerated video and was prone to heavy freezing for minutes at a time. After a few tries at installing before I figured out that the BIOS had to be forced to boot the DVD in UEFI mode to install on a GPT-formatted disk -- strangely, a problem I didn't have with Windows 7 x64 -- I got it installed and happily it runs much more smoothly on real hardware.
The last time I tried the Developer Preview, I compiled some small snippets with the Visual Studio 11 Express preview that was included. Loading a full Win32 project revealed a big problem: the VS11 Express preview doesn't have support for loading non-Metro C++ projects. I ended up installing the full Visual Studio 11 Developer Preview to fix that. After a few hours of download and installation -- and a bit of Disgaea 4 levelling in the meantime -- I loaded the solution I had previously converted to VS2010, upgraded it to the v110 toolset, and started an ARM build.
ARM build?
Truth be told, I don't know if I'll bother actually compiling anything for Windows 8 ARM. Between the current signed-only requirement for Metro apps, the uncertainly around whether Windows ARM will support desktop apps and whether WinRT can be used from desktop apps, what APIs will be able for ARM, and simply whether any of the Windows ARM devices will be worth buying it's not clear whether it'll be a hospitable environment for what I do. There's also the issue of actually having a device to test on, since code you can't run is virtually guaranteed broken. However, building for ARM has another beneficial side effect, which is to flush out unguarded x86-isms in a code base, and being able to do so with Visual C++ is much easier than doing so with another compiler or on another platform. I've done a decent amount of x64 and also some PPC, so I did have a good idea of what to expect going in. For the most part it went smoothly, but some problems I ran into:
- Installing VC11 DP over VC11 Express did something bad to Makefile project support: the IDE couldn't find nmake.exe even though it was installed. The VC11 DP installation I have on Win7 doesn't have this problem. Oh well, unload the projects and keep going.
- I had a bunch of code in the system library that assumed that !AMD64 => X86. Oops. Time to fix up a bunch of #ifdefs.
- Ran into a weird problem where the project system kept assuming that the build location was at the platform default location (solutiondir/platform/configuration) even though I had overridden it in the project settings in the IDE and the macro expansion for $(OutDir) in the UI was correct. The true nature of the problem didn't reveal itself until I jacked up the MSBuild verbosity and saw the old value showing through. It eventually resolved itself after some voodoo involving restarts and multiple builds.
- The Windows 8 Developer Preview comes with a link library for d3dx9_44.dll but doesn't actually include that DLL, and that version doesn't seem to be released yet -- the latest download on the DXSDK site has v43. I copied d3dx9_43.dll as d3dx9_44.dll into the build directory to get the build tool working. No, this is not a recommended fix.
- dxguid.lib was missing. That's fine, I expected to have to jettison the old DirectX lib usage at some point anyway and it can be worked around later.
The showstopper was when I got link errors on comctl32.lib, and then after fixing that shlwapi.lib. Game over, missing essential libs for a desktop app. Oh well. At least it only took a few minutes to get the main codebase building, since I had already done a lot of the gruntwork for AMD64/x64. What this tells me is that if you've done reasonable diligence to keep x86/x64isms low in your code, that rebuilding it for ARM with VC11 is going to be pretty painless. Availablility of APIs could potentially be a lot more painful but we won't know how much for sure until the official API list for Windows 8 ARM is released.