Friday, 18 May 2007

(Not) Getting Carbide C++ to run on your amd64 Debian Etch. But you get CodeWarrior!

A while ago I decided I wanted to make a couple of nice little apps for my Nokia 6600.
  • Bluetooth AutoOff - disable Bluetooth and/or hide it after a configurable period of time
  • PicGodfather - automatically change the template by which photos are named in the camera app, based on date (I can't think of another reasonable schema)
After my successful adventure with pys60 I decided/realized that the Python API does not contain appropriate functions for what I need in my apps, so I decided to setup the development environment for C++ with Carbide C/C++ (the recommended IDE for S60 development for Nokia).

Of course, the IDE is a Windows application and the reason for which Nokia doesn't provide an IDE for Linux (is expected since they are developing maemo and are so into OS) eludes me.
On top of that, I have an Debian Etch amd64 installation[1], so that's more fun.

Fortunately, thanks to Robert Millan and Ove Kaaven, wine is installable from unstable on amd64 and a chroot is not needed[2] anymore.


Now let's see the dependency tree:
  • Carbide
    • ActivePerl
      • ScriptHost
        • mfc42.dll
    • correct mix of native and built-in dlls in wine configuration
Yes, that is all ... summarized. And you can imagine I went though leaps and bounds and wasted a night with this to find out the hard way.

If you don't care about the reasons/story, you can skip to the paragraph where I ran into license issues.

So, first Carbide needs Active Perl. Not any version, but ActivePerl-5.6.1.635. You will find out after you install Carbide c++.

Active Perl, by default, will refuse to install in wine. It relies on some Script Host support.
Good news: it is available on Microsoft's support pages. Bad news: the file is not provided until you go through some crazy scheme[3] to certify you have a genuine Windows installation.

Of course, the genuine stuff failed to work in wine, duh, but having a windows XP OS in qemu was really useful... to try to go further.

Now that I mentioned the Windows XP machine in qemu you might be wondering 'why didn't you installed Carbide c++ in there and start hacking in qemu?' . Well, I wish it was that simple! Believe it or not, the installation in the Windows virtual machine failed in a muuuuch earlier stage it initially did in Wine! It failed in the unpacking phase of the installation, while in Wine that part worked without problems (default config is for Windows XP emulation). Talk about irony!

After a while of trying, I took the risky path (maybe I should install an antivirus, as suggested by wine) and downloaded the kit for the script host stuff from some site on the net (shhh!). Good. I don't remember if I used cabextract or if it worked quite straight forward, but the special configuration entry in Wine Configurator suggests otherwise.

Back to Active-Perl. Now we can try again to install it.

wine msiexec ActivePerl-5.6.1.635-MSWin32-x86.msi

Guess what? The installation failed now, too. After some time of poking, I realised the bastard was looking for mfc42.dll in the installation. There was no word about that in the error message, only in the wine logs there were some hints. No wonder Windows users learn very early to ignore error messages (the error message was plain uninformative).

Where to get mfc42.dll from? The virtual machine! I tried to send them via email, but the link was too slow. Now I realised I could have used winscp, but I didn't thought of that at the time.

The rescue did come this time from M$, but with some effort. It appears that mfc42.dll is by default present on XP, so you only find it for download in some kit (vc6redistsetup_enu.exe) for Windows 9x. That works (lost some time to figure that out, too) since the kit contains a mix of 9x, NT and independent dlls. I think this installation didn't work and I had to cabextract the files by hand and copy them in system32. I registered the mfc42.dll module, after copying it in windows/system32.

wine msiexec /y mfc42.dll

Well, now I have everything installed Carbide should start... Well, no! License issues! I got a message about not having a license for the installation. Ain't that great? I just installed the thing and is the free/handicapped version. What gives? Well, in Carbide C++ 1.2, the Express part of the kit is broken and doesn't install the license file.

So, I installed the professional version since it had a longer trial period, hoping that now I'll be able to see the IDE and start working.

After this, I tried several times to start Carbide itself, but it failed at different points in time. I "just"[4] configured wine for this app to set the order to 'native,builtin' for msvcrt, ole32, oleacc and shdocw and got further.

Hopeless attempts follow....

At this point I got stuck. There was still some error from ole32.dll (apparently), but I couldn't go further.

I tried to install the 1.1 trial version. Got stuck. In any way I couldn't start Carbide c++ :-(( .

GRAND FINALE!

In the end, I also tried the deprecated CodeWarior. Guess what? It installed and ran immediately. Although I am not sure if any of the previous poking had anything to do with it.



[1] I have some packages from unstable
[2] although I had one, I wanted to get rid of it, since gnash started to perform better in the latest versions - still not satisfactory, but OK
[3] some browser plugin WPGInstall.exe, iirc and some app which should send your privat^W^W^Wanalise your system to generate some code that should identify your system as genuine
[4] this also took me some time... start, identify the dll, change the order, restart...

1 comment:

Kasidit said...

This is truly AMAZING!

Just hope that Nokia would release a Carbide.C++ (express) for linux one day. Come on and vote
in this thread in the FN forums...