Compiling QT and KDE on Solaris 2.6

by Simon Josefsson <>

This page guides you through compiling and installing QT and KDE on Solaris 2.6.

Compiler chosen was GCC (2.95.3, later ones do not yet compile kde correctly, it seems). X11 implementation is Sun OpenWin. OpenSSL, libxml, libxslt, PCRE is also required.

Note: Sun Workshop 5.0 CC compiler was tried before reverting to GCC, but Sun CC can't compile things properly in AFS/NFS, so it is useless for me.

Before you start


Make sure gcc is in your PATH (module add gcc/2.95.3 at NADA), as well as autoconf 2.53 and automake 1.5 (automake 1.6 doesn't work).


This uses preinstalled libjpeg, libz and libmng etc from /usr/local/hacks/lib.

cd $srcdir
export QTDIR=$PWD
export YACC='byacc -d'
make -f Makefile.cvs
./configure -no-stl -thread -qt-gif -system-nas-sound -system-libpng -system-libmng -system-libjpeg -system-zlib -plugin-imgfmt-mng -platform solaris-g++ -no-g++-exceptions -I/usr/local/hacks/include -L/usr/local/hacks/lib -R/usr/local/hacks/lib -prefix /usr/local/hacks/common/vol/kde2/3.0/qt-copy
make symlinks sub-src sub-tools

Obsolete Hint (Not needed in QT 3+): you need to edit configs/solaris-g++-shared and replace -I/usr/openwin/include with -isystem -I/usr/openwin/include, otherwise all hell break lose. (Alternate untested solution, from gis on #kde: add -fpermissive). Update: The file is moved to mkspecs/solaris-g++/qmake.conf and the variable is QMAKE_CFLAGS. Update: It is needed in QT 3+. -isystem does not work with GCC 3.0.4, use -fpermissive instead. Update: Well, since gcc 2.95.3 didn't work, I'm back to using -isystem.

Optional hint: Add -fno-exceptions to SYSCONF_CXXFLAGS to reduce memory footprint quite a lot. Update: QT 2.2.4+ has config option -no-g++-exceptions (used above).

-R Hint: The -R/pkg/gcc/2.95.2/os/lib is only needed if you have a broken g++ installation, see below. Obsolete hint follows: Trolltech said they will include a -R configure switch for the 2.2.0 release. Here's the patch meanwhile. Updated hint follows: They managed to break it for the 2.2.0 release, src/moc/moc need to be linked with proper -R's to work. I don't have time to fix this properly now, just re-compile moc manually. Qt 2.2.1 hint: same problem with uic, recompile it manually. Qt 2.2.4: still broken. Qt 3.0.1: I'm using LD_RUN_PATH above now, so I don't know if it works or not.

The -R/pkg/gcc/2.95.2/os/lib part is because of the broken g++ installation at NADA. If your C++ compiler produces working binaries without any switches or special environment variables, just skip that part.


Now, compile kdelibs. After that, you can compile the rest of the packages at the same time if your system permits. The following commands work for the kdelibs, kdebase, kdegraphics, kdegames, kdetoys, kdeutils, kdenetwork, kdevelop and koffice packages.

First, for CVS users, do this...

cd $srcdir
cvs update -r KDE_3_0_RELEASE
make -f admin/Makefile.common cvs-clean
make -f Makefile.cvs

...and then:

cd $objdir
CXX="g++ -isystem /usr/openwin/include" $srcdir/configure --enable-final --prefix=/usr/local/hacks/common/vol/kde/3.0 --with-extra-libs=/usr/local/hacks/lib:/usr/local/hacks/vol/audiofile/0.2.2/lib:/usr/local/hacks/vol/freetype/2.0.5/lib --with-extra-includes=/usr/local/hacks/include:/usr/local/hacks/vol/audiofile/0.2.2/include:/usr/local/hacks/vol/freetype/2.0.5/include/freetype2 --x-includes=/usr/openwin/include --x-libraries=/usr/openwin/lib --with-pam=dtlogin --with-ssl-dir=/usr/local/hacks/vol/openssl-0.9.6 --with-krb4=/pkg/kth-krb/1.0.6 --with-afs --with-ldap=/pkg/ldap/3.3
make -j 10
make install


kdelibs/kdewidgets/makekdewidgets assumes perl is installed in /usr/bin. Edit the file to correct this. (The correct solution is probably to create a file, and have the correct path be substituted into the makekdewidgets file.)

kdelibs/arts/mcop_mt and some other multithread related uses sem_init(), sem_*(), sched_yield functions that require -lposix4. Recompile the file with LDFLAGS=-lposix4. (The correct solution is probably to check if sem_*/sched_yield requires libposix4 in configure, and if so add it to LDFLAGS.)

kdelibs/arts/mcop/{connection,objectmanager,trader_impl,dynamicskeleton}.cc, kdelibs/arts/mcopidl/, kdelibs/arts/x11/ and kdemultimedia/arts/modules/freeverb/ need to be compiled with make CXX="g++ -g", otherwise you get this error:

/usr/ccs/bin/as: "/var/tmp/ccku2fxY.s", line 4071: error: can't compute value of an expression involving an external symbol

kdebase/ doesn't look for -lfreetype in --with-extra-libs. Add $USER_LDFLAGS to the temporarily used LDFLAGS in kdelibs/kcontrol/kfontinst/

kdebase/kcontrol/nics/nic.cpp needs SIOCGIFCONF etc which is defined in . #include it. However, the nics/ directory doesn't work anyway ("struct map" also defined in ), so comment it out.

The following was fixed in KDE 2.1: kdelibs/dcop/dcopc.c need to be compiled with make CC="gcc -ansi", otherwise you get this error:

/usr/local/hacks/src2/kde/kdelibs/dcop/dcopc.c:206: `sz_' undeclared (first use in this function)

Lots of C++ files complain about the OpenWin X11 headers lacking ANSI C parameter definitions. You can make g++ warn for that (instead of throwing an error) with `-fpermissive' but you can also fix the problem by adding `-isystem /usr/openwin/include'. I chose the latter. Update (Qt3/KDE3): I'm not doing this now, and things seem to work anyway.