Wilcox Development Solutions Blog

The Cross In Cross-Platform

April 15, 2004

This week I’ve been working on the outstanding issues for the Daedulus project. One of the smaller issues I finished up yesterday, and now I’m on to one of the bigger issues - taking this application cross-platform.

Since we’re using wxWidgets for this project, most of my code is ready to rock on other platforms - and with my new, production, PC I have a cross-platform environment in which to work.

You see, I installed Fedora Core on the PC, as well as installing all my favorite unix utilities on the Windows partition.

Here then are my thoughts…

Running on Fedora

I had my linux environment pretty much set up the way I like it - directory structure, utilities, etc. Off I go to compile wxWidgets… ok, not bad, standard stuff…

For those of you not as familiar with unix as I am, I’ll take a degression here. Unix, in one form or another, has been around since the beginning of time() - 1970 or so. Since then it’s branched off a bit, then Linux was created, and things got really messy (there are many many distributions of Linux, in addition to the multitude of distributions of unix that already existed). The differences between the distributions of unix are mostly philosophical - where things should be stored, how much functionality is provided at the core - technical things like that.

Luckily, all these distributions are based around (pretty much) the same tools - the same way to build programs, the same basic file commands, etc. The basic utilities have been around for 30 years now, so they’re pretty familiar to everyone.

So, even though the application is getting tested on at the client’s site with FreeBSD, if I can compile and run it with my Fedora install, he should be able to do the same with his FreeBSD install.

My plan of attack is formulated - download, build, and install wxWidgets, then try my hand at getting one of my C++ files to build.

I got one file to compile, finally, but wouldn’t it be nice if I had a record of the commands I used? A shell script, maybe, to compile these things. Hmmm… seems like a common thing to do… oh wait, what about make?

A makefile (the file that make reads from, hence the name) is composed of instructions - what files to compile, what compiler to use, things like that. It took me a minute (or 2, or 30) to understand make’s syntax enough to do what I wanted. I had an example file created for me, with the basics, I just had to figure out where to add my additional gcc flags.

After a bit of futzing, I got it working - make compiled all my files with gcc using my commands. Nothing’s linking just yet (I haven’t figured out the command for that), but everything is compiling. That seemed like a good stopping point, so I committed my changes and quit for the night.

Windows Compiling

Now I’m spending some time learning how to compile on Windows. For this project we’re using the free Dev-C++ IDE which hooks into the Cygwin version of gcc. Using another compiler is always a fun journey - setting up your paths, wondering where this or that setting is, hoping that your not missing something… knowing that you are. Oh, and lest we forget - all the custom key commands that are (by now) pretty much hard-wired into my brain.

On the other hang, using a graphical IDE is a lot more helpful than using straight command line tools. Thank you very much BloodShed Software!

Aptly Named Conclusion

I’ll be so glad when I can get back to my desk - the PC is on the workbench, I’ve been using a stool all day to sit on. I miss my back support.