success compiling kdelibs4 on OS X using cmake

Alexander Neundorf neundorf at kde.org
Wed Mar 1 19:09:01 CET 2006


Hi Adriaan, 

On Tuesday 28 February 2006 22:42, Adriaan Moors wrote:
> Hi,
>
> I'm quite excited to report that I got a checkout of trunk/kdelibs (24 feb
> 2006) to compile on Mac OS X. I figured it might be interesting to report
> on what I did (although I'm no KDE/CMake/OS X hacker by any means). I
> apologise for the long post, but I hope it's useful (at the very least it
> expresses my gratitude towards everyone who is working on this project).
>
> So, here's an overview of the steps I took. Some are probably pretty dumb,
> but I think the main message is that there's very little work left to do to
> get it to compile out of the box on a Mac. I'm running fink unstable on Mac
> OS X 10.4.5 and I compiled everything with Apple's stock gcc 4.0.
>
> 0) built QT/Mac 4.1.1 (applied
> http://websvn.kde.org/*checkout*/trunk/qt-copy/patches/0112-ksyntaxhighligh
>ter- rehighlight-document.diff?rev=512475)
>
> 1) in kdelibs/ did a ccmake .
>  1.1) provided full paths of *.dylib's (most of them from fink, in /sw/lib)
>    1.1.1) not sure whether this is correct, maybe I should just provide
> names suitable for -l linker flag (or is it ok/better to give full path?)

Did you try setting the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH environment 
variables ? This should help.
http://www.cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables

> 1.1.2) openexr has *.la's and not *.dylib's
>         -->  used  Imath IlmImf Iex Half

What la files ? On Linux they are only text files. There must be also "real" 
libraries available.

>  1.2) solved conflict between including libs from /usr/lib and /sw/lib
>     --> bz2 now from /sw/lib
>  1.3) resolv was not detected as dependency
>      changed the following variable (as a quick hack, couldn't figure out
> wat the real prob is):
>      //Where can the agg library be found
>     AGG_LIBRARIES:FILEPATH=/sw/lib/libagg.dylib;resolv


So libagg needs libresolv ? For which functions ?

>     (changing this didn't help, since it's automatically generated:
>       kdecore_LIB_DEPENDS:STATIC=-F/Users/adriaan/nospotlight/local//lib
> -framework QtCore;-lpthread;-framework Qt3Support;-framework
> QtGui;-lSM;-lICE;/usr/X11R6/lib/libX11.dylib;/usr/X11R6/lib/libXext.dylib;D
>COP;/ usr/lib/libz.dylib;-framework Carbon;/sw/lib/libbz2.dylib;-framework
> QtXml;/sw/lib/libagg.dylib;dl;resolv)


Ranger Rick, Tanner, what do you think about the following issues ?

> 2) a lot of cpp-sources in  kdelibs/kjs/ (ustring.cpp, operations.cpp etc)
> included operations.h without including math.h first
>  --> moved #include <math.h>
>     so that it occured before
>   #include "operations.h"
>   it's been a long time since I programmed in C++, so I don't know if this
> is a quirk in Apple's gcc 4.0  or...
>
> 3)  added JSImmediate.cpp to the list of source files in CMakeList.txt

This one is already in svn.

> 4)  -DBIND_8_COMPAT is needed for kio
>     (in  kio/misc/kpac/CMakeFiles/kded_proxyscout.dir/flags.make)
>     --> added to FindKDE4.cmake
>         if(APPLE)
>           set ( _KDE4_PLATFORM_DEFINITIONS -D__APPLE_KDE__ 
> -DBIND_8_COMPAT)
>
> 5) (don't know if this is serious:
>   /usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding may
> result in errors or different symbols being used)
>
> 6) (hack) in notifybypopup.cpp
>     changed
>     KPassivePopup *pop = new KPassivePopup( config->winId );
>     to
>     KPassivePopup *pop = new KPassivePopup(KPassivePopup::Boxed,
>                                            (WId) config->winId, 0 );
>     (I couldn't figure out the proper C++ syntax to disambiguate the
> call...)
>
> 7) incompatibility between fink's openexr (compiled with gcc 3.3) and kde 4
>    (which I'm compiling using gcc 4)
>   --> recompile openexr using gcc 4 (by hand -- exrdisplay won't link and
> fink package builds binaries and libs at same time)
>   7.1) the error I got was:
>      cd /Users/adriaan/nospotlight/src/kdelibs/kimgio
>     /usr/bin/c++  -bundle -multiply_defined suppress -o ../lib/kimg_exr.so
> "CMakeFiles/kimg_exr.dir/exr.o" 
> -L/Users/adriaan/nospotlight/src/kdelibs/lib -L/sw/lib -L/usr/X11R6/lib
> -L/usr/local/lib
> -F/Users/adriaan/nospotlight/local/lib -framework QtCore -lpthread
> -lkdecore -lImath -lIlmImf -lIex -lHalf -framework Qt3Support -framework
> QtGui -lSM -lICE -lX11 -lXext -lDCOP
> -F/Users/adriaan/nospotlight/local//lib -framework QtCore -lpthread -lz
> -framework Carbon -lbz2 -framework QtXml -lagg -lresolv -ldl
> -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ -lstdc++
>
>     /usr/bin/ld: Undefined symbols:
>    std::basic_string<char, std::char_traits<char>, std::allocator<char>>
>
> ::_S_empty_rep_storage
>
>    std::basic_string<char, std::char_traits<char>, std::allocator<char>>
>
> ::_Rep::_S_create(unsigned long, std::allocator<char> const&)
>
>     __ZNSaIcED4Ev
>     __ZNSt15basic_streambufIcSt11char_traitsIcEEC4Ev
>     __ZNSt15basic_streambufIcSt11char_traitsIcEED4Ev
>     std::__default_alloc_template<true, 0>::deallocate(void*, unsigned
> long) std::__default_alloc_template<true, 0>::_S_force_new
>     std::__default_alloc_template<true, 0>::_S_free_list
>     std::__default_alloc_template<true, 0>::_S_node_allocator_lock
>     __ZNSt24__default_alloc_templateILb1ELi0EE5_LockD4Ev
>     std::__default_alloc_template<true, 0>::allocate(unsigned long)
>     std::__default_alloc_template<true, 0>::_S_refill(unsigned long)
>     collect2: ld returned 1 exit status
>
>   7.2) so I did:
>     wget  http://savannah.nongnu.org/download/openexr/OpenEXR-1.2.2.tar.gz
>     tar xvzf OpenEXR-1.2.2.tar.gz
>     perl -pi -e
> 's,-L\$\(top_builddir\)\S+,,g;s,-l(IlmImf|Imath|Half|Iex),\$(top_builddir)/
>\1/ lib\1.la,g' `find . -name Makefile.in`
>     patch -p1 <
> /sw/fink/dists/unstable/main/finkinfo/graphics/openexr.patch ./configure
> --enable-shared=no --disable-imfexamples CC=gcc-4.0 CXX=g++-4.0 CPP=cpp-4.0
> MAKEFLAGS=-j1
>     # commented out parts of SUBDIRS in Makefile that didn't refer to the
>       libraries
>     make
>     sudo make install
>
> 8) now simply doing make ; sudo make install in kdelibs/ installed
> kdelibs!!
>
> 9) I did export MAC_DISPLAY=:0 (what's this supposed to be set to?),
> removed /sw/bin from the PATH and then did khotnewstuff --> which showed me
> a GUI (but no hot new stuff ;-( )
>
>
> I hope this was interesting to someone. I would be more than willing to
> perform other experiments (time permitting).

You're very welcome :-)
A good thing would be if you could setup a nightly build on your machine. 
Basically this means creating a cron job which executes "make Nightly" once 
per day.
The results will go here:
http://public.kitware.com/KDE/Testing/Dashboard/20060301-0100-Nightly/Dashboard.html

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list