[CMake] Fwd: cmake link against Qt4's OpenGL

Linge Bai lb353 at cs.drexel.edu
Fri Sep 26 17:15:45 EDT 2008


I set CMAKE_OSX_SYSROOT to /Developer/SDKs/MacOSX10.5.sdk and generated the
makefile. The QTOPENGL and QGLWIDGET are still not found. But they do exist.

I get these errors:
make
[ 33%] Building CXX object CMakeFiles/exe.dir/main.o
[ 66%] Building CXX object CMakeFiles/exe.dir/glwidget.o
[100%] Building CXX object CMakeFiles/exe.dir/window.o
Linking CXX executable exe
Undefined symbols:
  "GLWidget::zRotationChanged(int)", referenced from:
      GLWidget::setZRotation(int)   in glwidget.o
  "GLWidget::xRotationChanged(int)", referenced from:
      GLWidget::setXRotation(int)   in glwidget.o
  "GLWidget::yRotationChanged(int)", referenced from:
      GLWidget::setYRotation(int)   in glwidget.o
  "vtable for Window", referenced from:
      __ZTV6Window$non_lazy_ptr in main.o
      __ZTV6Window$non_lazy_ptr in window.o
  "Window::staticMetaObject", referenced from:
      __ZN6Window16staticMetaObjectE$non_lazy_ptr in window.o
  "vtable for GLWidget", referenced from:
      __ZTV8GLWidget$non_lazy_ptr in glwidget.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [exe] Error 1
make[1]: *** [CMakeFiles/exe.dir/all] Error 2
make: *** [all] Error 2


On Fri, Sep 26, 2008 at 4:59 PM, Michael Jackson <
mike.jackson at bluequartz.net> wrote:

> Set the CMAKE_OSX_SYSROOT to /Developer/SDKs/MacOSX10.5.sdk
>
> and try again. Also, you do actually have the MacOSX10.5.sdk available
> correct?
>
> The link line contains all the proper OpenGL (both apple and Qt)
> frameworks. You just need to get past the SDK setting first.
>
> Mike
>
>
> On Sep 26, 2008, at 4:52 PM, Linge Bai wrote:
>
>  Attached is a screen shot of running ccmake. It's MacOSX10.4u.sdk. And it
>> showed that QTOPENGL and QGLWIDGET are not found.
>>
>> make VERBOSE=1
>> /opt/local/bin/cmake -H/Users/lb353/Desktop/myQt/hellogl
>> -B/Users/lb353/Desktop/myQt/hellogl --check-build-system
>> CMakeFiles/Makefile.cmake 0
>> /opt/local/bin/cmake -E cmake_progress_start
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles/progress.make
>> make -f CMakeFiles/Makefile2 all
>> make -f CMakeFiles/exe.dir/build.make CMakeFiles/exe.dir/depend
>> cd /Users/lb353/Desktop/myQt/hellogl && /opt/local/bin/cmake -E
>> cmake_depends "Unix Makefiles" /Users/lb353/Desktop/myQt/hellogl
>> /Users/lb353/Desktop/myQt/hellogl /Users/lb353/Desktop/myQt/hellogl
>> /Users/lb353/Desktop/myQt/hellogl
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles/exe.dir/DependInfo.cmake
>> --color=
>> make -f CMakeFiles/exe.dir/build.make CMakeFiles/exe.dir/build
>> /opt/local/bin/cmake -E cmake_progress_report
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles 1
>> [ 33%] Building CXX object CMakeFiles/exe.dir/main.o
>> /usr/bin/c++   -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
>> -isysroot /Developer/SDKs/MacOSX10.4u.sdk
>> -I/usr/local/Trolltech/Qt-4.4.2/include
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtOpenGL
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtGui
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtCore
>> -F/usr/local/Trolltech/Qt-4.4.2/lib -L/usr/local/Trolltech/Qt-4.4.2/lib
>> -F/usr/local/Trolltech/Qt-4.4.2/lib  -o CMakeFiles/exe.dir/main.o -c
>> /Users/lb353/Desktop/myQt/hellogl/main.cpp
>> /opt/local/bin/cmake -E cmake_progress_report
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles 2
>> [ 66%] Building CXX object CMakeFiles/exe.dir/glwidget.o
>> /usr/bin/c++   -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
>> -isysroot /Developer/SDKs/MacOSX10.4u.sdk
>> -I/usr/local/Trolltech/Qt-4.4.2/include
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtOpenGL
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtGui
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtCore
>> -F/usr/local/Trolltech/Qt-4.4.2/lib -L/usr/local/Trolltech/Qt-4.4.2/lib
>> -F/usr/local/Trolltech/Qt-4.4.2/lib  -o CMakeFiles/exe.dir/glwidget.o -c
>> /Users/lb353/Desktop/myQt/hellogl/glwidget.cpp
>> /opt/local/bin/cmake -E cmake_progress_report
>> /Users/lb353/Desktop/myQt/hellogl/CMakeFiles 3
>> [100%] Building CXX object CMakeFiles/exe.dir/window.o
>> /usr/bin/c++   -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
>> -isysroot /Developer/SDKs/MacOSX10.4u.sdk
>> -I/usr/local/Trolltech/Qt-4.4.2/include
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtOpenGL
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtGui
>> -I/usr/local/Trolltech/Qt-4.4.2/include/QtCore
>> -F/usr/local/Trolltech/Qt-4.4.2/lib -L/usr/local/Trolltech/Qt-4.4.2/lib
>> -F/usr/local/Trolltech/Qt-4.4.2/lib  -o CMakeFiles/exe.dir/window.o -c
>> /Users/lb353/Desktop/myQt/hellogl/window.cpp
>> Linking CXX executable exe
>> /opt/local/bin/cmake -E cmake_link_script CMakeFiles/exe.dir/link.txt
>> --verbose=1
>> /usr/bin/c++    -isysroot /Developer/SDKs/MacOSX10.4u.sdk
>> -Wl,-search_paths_first -headerpad_max_install_names -fPIC
>> CMakeFiles/exe.dir/main.o CMakeFiles/exe.dir/glwidget.o
>> CMakeFiles/exe.dir/window.o  -o exe  -F/usr/local/Trolltech/Qt-4.4.2/lib
>> -framework QtOpenGL -framework OpenGL -framework AGL -framework QtGui
>> -framework Carbon -framework AppKit -framework QtCore /usr/lib/libz.dylib
>> -framework ApplicationServices
>> ld: library not found for -lcrt1.10.5.o
>> collect2: ld returned 1 exit status
>> make[2]: *** [exe] Error 1
>> make[1]: *** [CMakeFiles/exe.dir/all] Error 2
>> make: *** [all] Error 2
>>
>> Have I linked to QTOPENGL or not?
>>
>> Linge
>>
>> On Fri, Sep 26, 2008 at 4:43 PM, Michael Jackson <
>> mike.jackson at bluequartz.net> wrote:
>> run ccmake instead of cmake on your project. Look down the left hand side
>> of cmake variables. It should be listed.
>>
>> By default it should be 10.5.sdk so I am not sure what is really going
>> wrong.
>>
>> also, do the following:
>>
>> make clean
>> make VERBOSE=1
>>
>> in your build directory and lets examine the compile and link lines..
>>
>>
>> Mike
>>
>>
>>
>> On Sep 26, 2008, at 4:40 PM, Linge Bai wrote:
>>
>> my mac os x is 10.5.4, it's PPC. Xcode is version 3.1. I'm sorry that I
>> have no idea how to check CMAKE_OSX_SYSROOT.
>>
>> Linge
>>
>> On Fri, Sep 26, 2008 at 4:33 PM, Michael Jackson <
>> mike.jackson at bluequartz.net> wrote:
>> What is your OS X version, (PPC or Intel), Xcode toolset version, and what
>> are you setting the  CMAKE_OSX_SYSROOT value to? It should be
>> /Developer/SDKs/MacOSX10.5.sdk
>>
>>
>> Mike
>>
>>
>> On Sep 26, 2008, at 4:26 PM, Linge Bai wrote:
>>
>> so if I use cmake 2.6.1, with the following CMakeList.txt file:
>>
>> PROJECT ( COMBINED )
>> FIND_PACKAGE (Qt4 REQUIRED)
>> SET(QT_USE_QTOPENGL TRUE)
>> INCLUDE( ${QT_USE_FILE} )
>> ADD_EXECUTABLE(exe main.cpp glwidget.cpp window.cpp)
>> TARGET_LINK_LIBRARIES(exe ${QT_LIBRARIES})
>>
>> I am able to link to Qt4's OpenGL, but I have a link error:
>>
>> make
>> Scanning dependencies of target exe
>> Linking CXX executable exe
>> ld: library not found for -lcrt1.10.5.o
>> collect2: ld returned 1 exit status
>> make[2]: *** [exe] Error 1
>> make[1]: *** [CMakeFiles/exe.dir/all] Error 2
>> make: *** [all] Error 2
>>
>> I have no idea what this error means.
>>
>> Linge
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>> <Picture 2.png>
>>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080926/4d847851/attachment.htm>


More information about the CMake mailing list