posted by Thanh Ly on Mon 30th Jun 2003 16:08 UTC
IconOn the day of WWDC all people could think about was the new G5 PowerMacs, or Mac OS X 10.3 "Panther." While most news sites drowned in WWDC coverage, and then the whole debate over benchmarks, it was quite easy to miss this little gem. Trolltech released Qt 3.1.2 for OSX last Monday.

In all honesty, this piece of news is what I'm most excited about more so than anything that went on at WWDC, this includes those shiny new G5 systems or even the 64 bit MacOSX. The reason for this is because I believe that the Qt library has the greatest effect on the way I develop software on the Mac platform, and perhaps other developers will see it this way too.


I promise to make this a brief history lesson. I've been programming as a hobbyist for the past 5 years, the latter 2 years and to date I am programming professionally. I started out with Windows, teaching myself C++ and using MFC to design applications. Last year I had my first encounter with a modern Macintosh computer. I purchased an iMac2 flat panel in hopes of learning to develop for this platform. Between Carbon, Cocoa, and even Metrowerks' PowerPlant, I found this transition more trouble than it was worth for just a hobby that I might not make a career out of. So I set it down for a year now. This past April and May I revisited Linux, in particular Mandrake and Gentoo distributions, and continued my programming endeavors with Qt. Coming from an MFC background, I found Qt to be a very smooth transition. Then in June I made a come back to the Mac platform by purchasing an iBook. What prompted me to do this was that I had upgraded my iMac to OSX 10.2 and finally it was in a usable state that I felt comfortable with, albeit some issues still existed. I tried to un-brainwash myself from years of Windows programming in order to accept Objective-C and Cocoa. But as soon as I heard that Trolltech was going to release an updated Qt library for MacOSX, I abandoned Cocoa altogether.

How to get it

Now to get down to business. To download Qt/Mac Free Edition, visit Trolltech's website here. What do you get in this package?

- The source code to the Qt library.
- Documentation in HTML format (Qt Assistant is also included for additional documentation).
- Helper applications such as QT Designer, Assistant, Linguist, and command line tools such as qmake. qmake will be a very important tool, as you'll see later on.
- Plenty of example apps and their source.

I didn't actually have to wait for Trolltech to make this release, as Qt has been available for OSX for some time now. It can be obtained through Fink, but it does require that the user install an X server first. I did not bother to make this attempt because I didn't see the need to since I have a Linux box right next to me. The beauty of this Qt/Mac distribution from Trolltech is that it DOES NOT require an X server at all! Qt/Mac uses Carbon internally the same way Qt for Windows uses an API native to Windows. Trolltech had made Qt version 3.x for MacOS in the past but only with a commercial license, and if there was a free edition it was from the 2.x version. That's the significance of this new Qt/Mac release. It brings Qt for MacOS up-to-date and introduces the dual license structure: the free, GPL'ed, edition is exactly the same as the commercial edition in terms of source code.

Setting up

The installation document covers the procedure quite well, however there is one little problem that I encountered, and is repeatable. More on that in a minute. The first thing to do is obviously unpack the package. The install doc suggested I unpack everything into /usr/local/qt and that's exactly what I did. But since this folder is outside of my home directory I had to use the "sudo" command in order to access folders owned by root. It'll ask you for the admin password once and remember it for the rest of the Terminal session. But you do have to use sudo with every command that requires root privileges, and I did not know of a way to get such privileges in Finder so all file operations were done in Terminal. Compiling the Qt library is just as one would imagine, "./configure" then "make". Somewhere in the Makefile it creates the symbolic links to the lib file but it doesn't copy the sym-links into a location where it can be found by other software. This was the problem I spoke of earlier, after libqt-3.1.2.dylib was built Make proceeded to build all the other software that comes with this package - tools, sample apps, etc. Obviously they couldn't link to libqt so make errored out. It's possible to copy the libqt-3.1.2.dylib file into /usr/lib or just make a sym-link. The install guide also says you can place the sym-link in your home directory, placement of it in /usr/lib is only if you want all users of the computer to have access to Qt. After making the link I ran make again and it proceeded to compile the rest of the software. But as of that point I was ready to test out Qt with my own code.

Table of contents
  1. "Qt on the Mac, Page 1"
  2. "Qt on the Mac, Page 2"
e p (0)    66 Comment(s)

Technology White Papers

See More