KDE Libs on Qt/Mac

Getting kdelibs to compile on a Mac under Qt/Mac is a bit of a battle. Well, it isn't really, but getting everything to work properly is. Why would anyone try? Well, having switched from a linux box a while ago, I find myself missing my favorite linux app (and for that matter, music app on any platform) - Amarok. Truth be told, it kicks ass.

So I got down to work. This being my second attempt, the first having been a while ago with no Mac compiling experience and thus abandoned, it actually seemed to go really smoothly seeing as kdelibs 3.5 has been made to be largely platform independent (apart from just three outstanding X11 calls). Great. How? This is how:

I'm using Tiger so to start off with, I set gcc to version 3.3 with:

gcc_select 3.3

When I compiled this, I found it necessary to set libtool to use mac specific undefined link flags so I did this too when compiling the Mac kdelibs (this could be totally unnecessary).

The environment variables need to be set up properly, of course. Mine were as follows, bearing in mind that I wished to install KDE into /KDE , my Qt libs were at /Developer/qt and my Fink installation was at /sw

QTDIR=/Developer/qt
KDEDIR=/KDE
DYLD_LIBRARY_PATH=/sw/lib:/Developer/qt/lib:/KDE/lib
MACOSX_DEPLOYMENT_TARGET=10.4

It is important using Tiger, that the compiler/linker uses Apple's ImageIO Framework instead of Fink's jpeglib or libpng. The headers nevertheless are required from Fink. This can be done once Fink has installed the libraries by creating a symbolic link inside /sw/lib to the Framework libraries (one line):

ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/¬
Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /sw/lib/libjpeg.dylib

The same can be done for libpng.dylib. It is worth saving a backup of the Fink libraries first though, as they might come in handy later if problems crop up. After extracting the tarball, it was time to configure the compile process. I used the following:

LDFLAGS="-undefined dynamic_lookup" ./configure --enable-mac --without-arts --prefix=/KDE ¬
--with-extra-libs=/sw/lib --with-extra-includes=/sw/include

It is worth noting first though, that I have all the dependencies inside the /sw directory from Fink.

This should go smoothly, but if not, its because of missing dependencies.

Then comes the make process. Should be straightforwards enough, but as I mentioned there are I believe, 3 instances in which a few X11 calls have to be removed, but it is pretty easy to see where and how.

And thats how I compiled kdelibs using Qt/Mac. Now the question: does it work? Good for now. For example, KHotNewStuff runs and loads stuff from the internet (first putting it inside an application bundle). Also, kdeinit works very well, initialising dcop, etc.

khotnewstuff

Update 01/01/06 I have uploaded a patch. Get it here.

Comments

Number: 01

Date: 03.01.06

Brian E said:

Thanks for the instructions... quick question, where can I download the src tar of kdelibs?

Number: 02

Date: 03.01.06

Brian E said:

Thanks for the instructions... quick question, where can I download the src tar of kdelibs?

Number: 03

Date: 04.01.06

Khaitu replied:

Hey. The src tar for kdelibs can be found at:

http://kde.org/download/

The Kdelibs tarball can be downloaded from:

http://download.kde.org/stable/3.5/src/kdelibs-3.5.0.tar.bz2

Number: 04

Date: 23.01.06

f1again said:

i thought i finally found the time to try this by myself, but this is crazy:

checking for libtiff tiff... yes

checking for libjpeg6b... (cached) no

checking for libjpeg... (cached) no

configure: WARNING:

There is an installation error in jpeg support. You seem to have only one

of either the headers _or_ the libraries installed. You may need to either

provide correct --with-extra-... options, or the development package of

libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/

Disabling JPEG support.

checking for libpng... (cached) no

is this crazy? note that the replaced libpng fails aswell. i tried to stick as close as possible to the steps you mentioned and only changed the kde dir to /local/kdemac which seemed a tiny bit more reasonable to me.

i double checked and even rebuilt libjpeg and libpng3 (and re-replaced the .dylibs with symlinks).

this is my environemt:

DYLD_LIBRARY_PATH=/sw/lib:/Developer/qt/lib:/usr/local/kdemac/lib

KDEDIR=/usr/local/kdemac

LDFLAGS='-undefined dynamic_lookup'

MACOSX_DEPLOYMENT_TARGET=10.4

PATH=/Developer/qt/bin:/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/sbin:/opt/local/sbin:/usr/local/bin:/opt/local/bin:/usr/local/mysql/bin:/System/Library/Frameworks/Python.framework/Versions/2.3/bin

PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin

QMAKESPEC=/sw/share/qt3/mkspecs/darwin-g++

QTDIR=/Developer/qt

SGML_CATALOG_FILES=/sw/etc/sgml/catalog

(which makes me wonder if QMAKESPEC shouldn't point to '/Developer/qt/mkspecs/darwin-g++' although it can't be the problem yet... can it?)

thus, please excuse my noobish enthusiasm, but, do you have any idea what could be the reason for this to fail on me? :)

Number: 05

Date: 23.01.06

f1agaqin said:

i'm stuck. i just can't get that 'cached' away.

'make distclean' - still cached

'sudo find / -iname config.cache' - no results

remove build directory, reunzip, reuntar - still 'cached

Number: 06

Date: 23.01.06

f1again said:

arr. i only looked for (cached), not where it was.

well:

checking for libpng... no

checking for libjpeg6b... no

checking for libjpeg... no

configure: WARNING: There is an installation error in jpeg support. ...

still no luck.

Number: 07

Date: 23.01.06

Khaitu replied:

Are you running Tiger (10.4)? If you are not, then you will not have the OS X imageIO frameworks.

Nevertheless, this problem has happened to me in the past and has been rather frustrating. I think the way I sorted it out was to re-compile QT with the correct PATHs (yes, your QTMAKESPEC is incorrect) and try again. I really do not know what other advice to give.

Number: 08

Date: 13.03.06

Ryan said:

Hi, have you tried this with QT 4.0 or just 3.3.4?

Number: 09

Date: 13.03.06

Ryan said:

Hi, have you tried this with QT 4.0 or just 3.3.4?

Number: 10

Date: 13.03.06

Ryan said:

Hi, have you tried this with QT 4.0 or just 3.3.4?

Number: 11

Date: 14.03.06

Khaitu replied:

No. This is indeed 3.3.4

Number: 12

Date: 06.06.06

papo said:

Hello, first of all im useless with the terminal. But I NEED amarok my ibook. I cant stand itunes more. I´ve tried to install Kdelibs on Qt/Mac but I dont know what are the headers I need tu install from fink. Could anyone help me?

Second question: Am I crazy if I think of a working amarok.dmg for soon?

Thanks and keep working, please. ;)

Number: 13

Date: 06.06.06

Paul said:

I totally agree with papo! Is there anyone who can port amaroK to Mac?

Number: 14

Date: 06.06.06

Khaitu replied:

Papo. Its a little tricky getting the whole thing to compile and a little knowlege of the terminal and how all these things work is helpful. In any case, you need to compile and install Qt/Mac first and then the Kdelibs. You should download the sources from Trolltech and the Kde website respectively. Fink will not help you compile against Qt/Mac. Sorry.

As for the Amarok.dmg, I have recently reinstalled Tiger and have not got round to recompiling Amarok, Kde, etc yet. Also, it would have to be statically linked to everything and I'm not too sure about how to do that. But its a good idea.

Good luck!

Number: 15

Date: 06.06.06

Khaitu replied:

A port of Amarok to Cocoa would be amazing. Daunting but amazing. I would be more than willing to help out if such a project arose, but I have never programmed in Cocoa before. Anyone up for the challenge?

Number: 16

Date: 08.07.06

Khaitu replied:

So is Qt/Mac 3.3. The problem is that it is rather slow and clunky.

Number: 17

Date: 14.02.07

ehird said:

Patch is 404. :/ Please could you fix it? The amarok patch too would be nice but that's probably outdated by now.

Number: 18

Date: 20.01.09

RayFlower said:

Hey, i know this is quite old but..

I did install qt3-mac with macports:

port installed qt3-mac

The following ports are currently installed:

qt3-mac @3.3.8_0 (active)

Symlink libping and libjpeg and find a copy of kdelibs-3.5.0 and patch it but when i configure i get this:

checking for Qt... configure: error: Qt (>= Qt 3.3 and < 4.0) (headers and libraries) not found. Please check your installation!

For more details about this problem, look at the end of config.log.

Any ideas?

Number: 19

Date: 23.01.09

Khaitu replied:

You will need to use the native Qt3 for this to work. If you are using MacPorts , you may as well use the MacPorts Amarok.

Post a comment

Comment details
anti-spam code. you need to be able to view images to post a comment. sorry.