[kde-edu]: kdeedu4 4.4.0 does not compile under OS X

Alexander Neundorf neundorf at kde.org
Fri Mar 5 19:33:10 CET 2010

On Friday 05 March 2010, Jan Gosmann wrote:
> Hi,
> I posted the following message already at the kde-edu mailing list. But
> it seems that they are there not able to help me and they pointed me to
> kde-buildsystem mailing list.
> Building kdeedu4 4.4.0 under Mac OS X 10.6.2 fails with the following
> output:
> <snip>
> make -f
> kalzium/libavogadro-kalzium/src/CMakeFiles/avogadro-kalzium.dir/build.make
> kalzium/libavogadro-kalzium/src/CMakeFiles/avogadro-kalzium.dir/build
> Linking CXX shared library ../../../lib/libavogadro-kalzium.dylib
> cd
> /opt/local/var/macports/build/_Volumes_Home_blubb_Public_ports_kde_kdeedu4/
>work/build/kalzium/libavogadro-kalzium/src && /opt/local/bin/cmake -E
> cmake_link_script
> CMakeFiles/avogadro-kalzium.dir/link.txt --verbose=1
> /usr/bin/g++-4.2   -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk
> -mmacosx-version-min=10.6 -O2 -arch x86_64  -fno-common
> -Woverloaded-virtual -fvisibility=hidden -fvisibility-inlines-hidden -O2
> -DNDEBUG -DQT_NO_DEBUG -dynamiclib -headerpad_max_install_names
> -single_module -multiply_defined suppress -L/opt/local/lib
> -current_version 0.9.3 -o ../../../lib/libavogadro-kalzium.0.9.3.dylib
> -install_name /opt/local/lib/libavogadro-kalzium.0.dylib
> CMakeFiles/avogadro-kalzium.dir/avogadro-kalzium_automoc.o
> CMakeFiles/avogadro-kalzium.dir/animation.o
> CMakeFiles/avogadro-kalzium.dir/atom.o
> CMakeFiles/avogadro-kalzium.dir/bond.o
> CMakeFiles/avogadro-kalzium.dir/boxcontrol.o
> CMakeFiles/avogadro-kalzium.dir/camera.o
> CMakeFiles/avogadro-kalzium.dir/color.o
> CMakeFiles/avogadro-kalzium.dir/colorbutton.o
> CMakeFiles/avogadro-kalzium.dir/cube.o
> CMakeFiles/avogadro-kalzium.dir/cylinder.o
> CMakeFiles/avogadro-kalzium.dir/elementtranslate.o
> CMakeFiles/avogadro-kalzium.dir/engine.o
> CMakeFiles/avogadro-kalzium.dir/extension.o
> CMakeFiles/avogadro-kalzium.dir/filetreeitem.o
> CMakeFiles/avogadro-kalzium.dir/fragment.o
> CMakeFiles/avogadro-kalzium.dir/glgraphicsview.o
> CMakeFiles/avogadro-kalzium.dir/global.o
> CMakeFiles/avogadro-kalzium.dir/glpainter.o
> CMakeFiles/avogadro-kalzium.dir/glwidget.o
> CMakeFiles/avogadro-kalzium.dir/idlist.o
> CMakeFiles/avogadro-kalzium.dir/line.o
> CMakeFiles/avogadro-kalzium.dir/mesh.o
> CMakeFiles/avogadro-kalzium.dir/meshgenerator.o
> CMakeFiles/avogadro-kalzium.dir/molecule.o
> CMakeFiles/avogadro-kalzium.dir/navigate.o
> CMakeFiles/avogadro-kalzium.dir/neighborlist.o
> CMakeFiles/avogadro-kalzium.dir/painter.o
> CMakeFiles/avogadro-kalzium.dir/periodictableview.o
> CMakeFiles/avogadro-kalzium.dir/plotaxis.o
> CMakeFiles/avogadro-kalzium.dir/plotobject.o
> CMakeFiles/avogadro-kalzium.dir/plotpoint.o
> CMakeFiles/avogadro-kalzium.dir/plotwidget.o
> CMakeFiles/avogadro-kalzium.dir/plugin.o
> CMakeFiles/avogadro-kalzium.dir/pluginmanager.o
> CMakeFiles/avogadro-kalzium.dir/point.o
> CMakeFiles/avogadro-kalzium.dir/primitive.o
> CMakeFiles/avogadro-kalzium.dir/primitiveitemmodel.o
> CMakeFiles/avogadro-kalzium.dir/primitivelist.o
> CMakeFiles/avogadro-kalzium.dir/protein.o
> CMakeFiles/avogadro-kalzium.dir/residue.o
> CMakeFiles/avogadro-kalzium.dir/sphere.o
> CMakeFiles/avogadro-kalzium.dir/textrenderer.o
> CMakeFiles/avogadro-kalzium.dir/tool.o
> CMakeFiles/avogadro-kalzium.dir/toolgroup.o
> CMakeFiles/avogadro-kalzium.dir/undosequence.o
> CMakeFiles/avogadro-kalzium.dir/zmatrix.o
> CMakeFiles/avogadro-kalzium.dir/engines/bsdyengine.o
> CMakeFiles/avogadro-kalzium.dir/colors/elementcolor.o
> -F/opt/local/libexec/qt4-mac/lib -L/opt/local/lib
> /opt/local/lib/libopenbabel.dylib -framework QtOpenGL -framework
> -lOpenGL -framework -lAGL -framework QtGui /opt/local/lib/libpng.dylib
> -framework Carbon -framework AppKit -framework QtCore -lpthread
> /opt/local/lib/libz.dylib -framework ApplicationServices -framework AGL
> -framework OpenGL -lOpenGL -lAGL -framework QtGui
> /opt/local/lib/libpng.dylib -framework Carbon -framework AppKit
> -framework QtCore -lpthread /opt/local/lib/libz.dylib -framework
> ApplicationServices -framework AGL -framework OpenGL
> ld: framework not found -lOpenGL
> collect2: ld returned 1 exit status
> make[2]: *** [lib/libavogadro-kalzium.0.9.3.dylib] Error 1
> make[1]: ***
> [kalzium/libavogadro-kalzium/src/CMakeFiles/avogadro-kalzium.dir/all]
> Error 2
> make: *** [all] Error 2
> </snap>
> The error message that the framework "-lOpenGL" was not found is
> correct, because the framework is just OpenGL without the -l prefix.
> Therefore the "-framework -lOpenGL" somewhere within the options should
> be replaced by "-framework OpenGL".
> Also there is somewhere a "-framework -lAGL" which has to be replaced by
> "-framework AGL" and, finally, there are occurrences of "-lAGL" and
> "-lOpenGL" (without the "-framework" before it) which have to be removed
> entirely from the command.

I think I found where it comes from.

kdeedu/kalzium/libavogadro-kalzium/src/CMakeLists.txt has the following:


target_link_libraries(avogadro-kalzium ${AVO_LINK_LIBRARIES})

And this is what you try to link against:

> /opt/local/lib/libopenbabel.dylib -framework QtOpenGL -framework
> -lOpenGL -framework -lAGL -framework QtGui /opt/local/lib/libpng.dylib
> -framework Carbon -framework AppKit -framework QtCore -lpthread
> /opt/local/lib/libz.dylib -framework ApplicationServices -framework AGL
> -framework OpenGL -lOpenGL -lAGL -framework QtGui
> /opt/local/lib/libpng.dylib -framework Carbon -framework AppKit
> -framework QtCore -lpthread /opt/local/lib/libz.dylib -framework
> ApplicationServices -framework AGL -framework OpenGL

So, /opt/local/lib/libopenbabel.dylib must be ${OPENBABEL2_LIBRARIES}.
At the end there is "-framework AGL -framework OpenGL", this must be 

In between there is:
-framework QtOpenGL -framework -lOpenGL -framework -lAGL -framework 
QtGui /opt/local/lib/libpng.dylib -framework Carbon -framework 
AppKit -framework QtCore -lpthread /opt/local/lib/libz.dylib -framework 
ApplicationServices -framework AGL -framework 
OpenGL -lOpenGL -lAGL -framework QtGui /opt/local/lib/libpng.dylib -framework 
Carbon -framework AppKit -framework 
QtCore  -lpthread /opt/local/lib/libz.dylib -framework ApplicationServices

So this must be ${QT_LIBRARIES}.

At the top the file says:


which means to include UseQt4.cmake, with OpenGL enabled.
This one collects the necessary Qt libraries into the ${QT_LIBRARIES} 
The various Qt libs are found via kdelibs/cmake/modules/FindQt4.cmake.
If you look there for "opengl" you find it only twice:

  SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools 
                 QtHelp QtWebKit QtXmlPatterns QtNetwork QtMultimedia
                 QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus 
QtScriptTools QtDeclarative)

This finds the Qt opengl library itself.
Later on, FindQt4.cmake does:


So let's look at this file.
There we have more.
It starts with this:

This file collects the additional dependencies of the Qt libs and concatenates 

If you look for QTCORE in that file, you'll see how zlib, pthreads and right 
at the end "-framework ApplicationServices" are added to 
"-framework QtCore  -lpthread /opt/local/lib/libz.dylib -framework 
ApplicationServices" part, which appears twice.

If you look for QT_QTGUI_LIB_DEPENDENCIES, you see how libpng, Carbon and 
Appkit are added to that, so we get the 
"-framework QtGui /opt/local/lib/libpng.dylib -framework Carbon -framework 
AppKit" part of the linker command.

Now to the interesting part. Looking for opengl, there is this:


QT_QUERY_QMAKE seems to return "-framework OpenGL -framework AGL". Then 
SEPARATE_ARGUMENTS() is called on this string. This turns it into a list: 
This is then appended to QT_QTOPENGL_LIB_DEPENDENCIES which is then later on 
used with TARGET_LINK_LIBRARIES(), which keeps the "-framework" arguments as 
they are, but adds a "-l" before the "OpenGL" and "AGL" arguments, and so you 
get a broken link command.

I'll do something so that on Mac with frameworks this is handled correctly.


More information about the kde-edu mailing list