There is a myth. The myth goes “Windows is complicated. Macs are really easy – they just work.”
Like most myths this may have started from an original truth, but is now a lie. I am it’s latest, but I suspect far from only, victim.
Let me explain. For over a year now I have been developing a plugin for the RAW developer Bibble and it’s recent successor, Corel AfterShot. These plugins are developed using c++ and the Nokia QT framework, which theoretically allows the same code and user interface design to compile and run on Windows, Linux and Mac.
As a died in the wool Windows developer, that’s where I started. There’s a QT add-in to Visual Studio, so with a bit of juggling I managed to get one of the examples to load into VS, build, and run using Bibble as the target executable, and I was off. I was on a fairly steep learning curve in respect of the programming model, but I had very few problems compiling and running things.
When it got to the stage that I had something to share with the Bibble community I published the Windows version, and another member of the community kindly cross- compiled for the other platforms. There was another learning curve to make sure my code compiled cleanly on the other platforms, but nothing too drastic. For over a year I sent code updates to Jonathan, and got compiled Linux and Mac libraries back.
Although Jonathan still provides a very helpful service, it became apparent that if I wanted to have full control over the application versions I support, and be able to verify my plugin’s portability, I needed the ability to compile and run each version myself. I wasn’t prepared to buy and carry extra hardware around, but maybe VM technology would work.
I started with Linux. I had a couple of false starts but quickly found a site which has pre-built VMs for most Linux distributions (http://www.trendsigma.net/vmware/), and homed in on Lubuntu – based on Ubuntu but with a quite Windows-like shell. I downloaded and installed AfterShot and QT Creator, loaded up a copy of my code, and clicked “build”. And it worked first time! Getting a completely slick solution took a bit more effort, but it works so well I don’t now even copy the Windows code, I just open the same directory from my Linux VM and run the Linux builds in place.
So far so good. Now for the Mac. What could go wrong?
Apple’s antipathy to virtualisation is well known (see https://www.andrewj.com/blog/2012/mac-osxa-third-class-os/), and strictly speaking you’re not allowed to run OSX on non-Apple hardware. However, I got a legal copy of Snow Leopard, and found advice on the web on how to run up an OSX VM. You have to be patient, especially as it can take a couple of goes to boot the VM cleanly or install software, but generally it works pretty well.
First challenge: installing software. Unlike Windows or Linux, where non-trivial software has to be installed by a program which does useful things like error checking, on the Mac you often just simply drag a package of files to “Applications”. When it works, this is nice and easy. But if it fails, and I’ve now experienced this several times, it does so silently leaving you with a broken installation, which may not be obvious until things don’t work.
Eventually I manage to install Bibble, ASP, QT and, adding 30% to the size of the OS, XCode, the Mac development environment. I open QT Creator, and try to open my project. The first problem is that QT puts platform-specific settings in a small file alongside the main project files, and this has a fixed name, so you can store either the Linux or the Mac settings, but not both. Sigh, and copy the files from Windows to a local directory on the Mac.
After a bit of juggling, I got the plugin to compile. I then had to set up the deployment steps, renaming and copying files. Cue the next annoyance. Deployment configuration requires copying and adjusting complex filenames and paths. On Windows, you right-click any file or folder and there’s an option to copy the path to the clipboard. I was delighted to find that exactly the same trick works on Linux. OSX has no such simple solution. In the end I found a page of instructions on the web, which involved setting up macros as the like, but it wasn’t “easy”.
So I’ve compiled and deployed my plugin. Start AfterShot. Half the plugins and tools are missing, including mine. Re-install AfterShot, reboot the vMac, and now the standard tools are there, but still no sign of my plugin. The files are there, but the log has a very cryptic message about how my plugin “does not contain any recognisable symbols”.
Cue about 5 days of testing, trying different things, emails and posts on the Bibble forums. To cut a long story to a tolerable length…
- No one seems to know how to compile successfully using QT Creator on the Mac, you have to convert to XCode,
- XCode can’t cope with spaces in your folder or filenames. Another reason why the code can’t be shared directly with Windows and Linux,
- When you’ve finished compiling, you have to do an extra step called “fixing the paths”. The QT/XCode combo manages to embed hard-coded pathnames in the executable files, which fail immediately you rename or move it. This doesn’t happen on the other platforms. Fortunately there are scripts available to perform the fix, but it’s certainly not obvious,
- It’s all very sensitive to precise choices of SDK versions and the like,
- Plugins for Bibble have to be compiled using a different QT version to those for ASP, and you can’t have more than one version installed on a Mac (ironically this restriction doesn’t apply on Windows or Linux, where there’s no problem just using the latest libraries for both). I had to use the “clone” feature of VMWare to create a “branched” VM with a different installation – on a physical machine I’d be sunk.
That’s not quite the end of it. One of the SDK features I use in AfterShot relies on an asynchronous processing model. On the other platforms and on a physical Mac my code runs fine, but on the “vMac” it returns invalid data. This is clearly a Bibble/Corel problem, but one for which no-one has yet offered an explanation or fix.
Now I accept that some of this may be down to my use of a VM, and some is definitely weaknesses in the Mac versions of the QT and Corel software. But setting those aside, the fact remains that the Linux exercise was genuinely quite easy, the Mac version far from it.
So there are lies, damn’ lies and statements about how “Macs are easy, they just work”. The next person to repeat that lie to me may suffer a painful injury to a soft part of their anatomy…