Analytics Tracking Code

Thursday, October 8, 2009

Intel C Compiler, GTK and OpenBSD on Windows

I am currently working on the windows port of the Volume Management application that has consumed my waking moments for the past several months.

I wrote the application using GTK+ for a number reasons:
  • Wanted to learn GTK
  • Portabilty (Although a LOT of this is on my shoulders)
  • I wanted to learn to apply the Gnome HIG
  • I wanted to
  • I don't want to write it in
  • Because I can
This is all well and good while running on my linux desktop, however, as I knew from the beginning, I would need to port the application over to Microsoft Windows. Since I imagine that nearly ALL the target audience of this application uses Windows, this is REALLY important.

To make this happen, I have written a decent initial implementation of the application for my linux desktop, copied it to the Windows partition and opened it up inside of Visual Studio (with nice project files and all). Now comes the really quite hard part.

GTK is not native to Windows. So looking at the the GTK site, it is moderately evident that one is expected to build their Windows apps from within a linux(y) environment via some sort of cross-compiler voodoo.

Hmm, what to do.

I happen to own a rather expensive license to Visual Studio 2005 Professional. Shall I just leave it and head back to linux or, shall I try to get my program built against the mish-mash of binaries available from or should I go for broke and setup a complete build system for all of GTK and its dependencies?


A number of years ago I tried to do the whole dependency tree thing in an attempt to get FreeOrion built in Visual Studio. A great deal of time later and I was never able to get a binary which would actually start. Then again idea of compiling windows software in linux seems a bit silly, kind of in the realm of "just because you can does not mean you should". And this has me wondering about the quality of the binaries available at, they are probably fine except I have no real auditing trail for their construction.

So after an hour or so of deliberation, I have concluded that come hell or high water, I shall make my application run from the ground up building all the necessary binaries from scratch along the way. Visual Studio really shines here with built-in dependency management. If I change a dependency, it triggers a rebuild of all the dependent components right the way up the tree.

Next problem though is the compiler. While the C++ compiler in Visual Studio is getting markedly better with each release, the C compiler is rather out of date and is likely going to remain this way for ever and ever. Also the C runtime is currently missing a lot of the new goodness available these days. For instance asprintf (which gets rid of a lot of head aches, especially when customizing SQL calls).

The C runtime is something relatively easy to work with, as I can just create my own DLL of any missing functionality. OpenBSD provides what I consider to be the most desirable implementations for this kind of stuff, so I have pulled strlcpy, strlcat, asprintf and others into what is now bsdc.dll

And lastly is the compiler. I thought about this long and hard, and finally concluded that I really want to be able to use the latest innovations in C, so I bit the bullet and bought a license to the Intel C compiler. The installation is easy and switching compilers is straightforward from inside the IDE.

Assembling the project is nearly 50% complete at the time of this writing, and I will post with an update as to how it all goes together when I get my app finally running.

Also I will publish the build environment when it is ready as well in case there is anyone else out there who wants to do the same thing (inkscape? pidgin? evince? gedit?). It would really be nice to have a serious development environment available for this kind of thing.

No comments:

Post a Comment