Over the past three days, I’ve been trying to compile Qt 4.1.0. Compiling stuff is usually very easy, I know–I may lose my “Geek License” because of this.
Qt, the great cross-platform toolkit (which does everything from networking, to strings, to GUI that works almost everywhere) comes in the form of a 25MB tarball. “No problem”, I thought, “just run ./configure && make && make install.” Well, that probably would have worked, except for two things:
- libpng is broken
- ./configure doesn’t look in the right place for mysql.h.
Luckly, I caught both problems before I compiled everything. On Slackware, libpng does not link against libz, which is required. So, unless you manually pass -lz to gcc, you will get link errors. Oh, and I did get link errors. I’m not really sure if this is a Slackware or libpng problem, but I think it’s libpng–I don’t really see why Slackware would remove the -lz flag.
I just modified the libpng test in config.tests/unix/libpng/png.pro and ran qmake.
The other problem was the MySQL test didn’t look in /usr/include/mysql for mysql.h–in fact it didn’t even look anywhere! I just added the following to config.tests/unix/mysql/mysql.pro:
INCPATH += /usr/include/mysql
and reran qmake.
I also editing the src/sql/sql.pro, or whatever it’s called and reran ./configure.
(I should tell Trolltech about these–I guess I will sometime)
Anyway, make should have “just worked” and I should of had a static and shared version of Qt 4.1 on my computer in a few hours. Note all those “should”s in there…
Nobody told me how much space was required to build Qt 4. Apparently the answer is “lots.” First, I tried compiling in /home/taj, I had about 500MB available there, and I figured that that would be enough to compile a 25MB tarball. Boy was I wrong!
I got lots of errors about “final link failed” because of lack of disk space on my home partition. Ugg. After deleting or moving about 2GB of stuff, I still was getting the error. What to do? Well, it turns out I have a 16GB partition that was formatted as NTFS, and was used for storing WAV files from our music recording. I moved the recordings onto xenon, our storage computer, and reformatted the partition. I untarred Qt there, hacked the libpng and mysql test qmake files, and ran ./configure && make.
Guess what I got! “ld: final link failed, no space left on device.” That is on a new, empty 16GB partition! That is, 16GB of files were created from a single 25MB tarball. What was taking up all that room? `du` revealed that the examples/ and demos/ directories were taking up about 15GB! I ran `make install` just for the fun of it, and my / partition, which had about 2GB available on it, gave me “cp: cannot copy, no space left on device”. The examples directory was 2.1GB! That is, the binaries and source of the examples is ~2.1GB!
Wow, that’s a lot! I went back to hacking .pro files. I edited projects.pro and removed both the demos and examples subprojects and reran qmake–sweet! I then ran `make distclean` (for some reason `make clean` left a bunch of stuff sitting on my disk, about 10GB of it, in fact!) in both of those dirs, and reconfigured. ./configure is now chunking along nicely, and my fresh partition “only” has 2.2GB in use.
Yay, yet another compile of Qt, it seems like it takes forever to compile. When I use -j with make (runs multiple compiles at once), I always get linker errors because one part of Qt is done compiling, but it depends on another part which isn’t finished yet. *sigh*
Oh well, it’s worth the wait and screwing around–Qt rocks, and Qt 4 looks like it’s going to rock even more!