From quentan at gmail.com Mon Mar 16 16:22:21 2015 From: quentan at gmail.com (Quentan Qi) Date: Mon, 16 Mar 2015 20:22:21 +0000 Subject: [Ctk-developers] Link error with CTK and VTK Message-ID: <2D78115D-2782-473C-B777-E87F0352409E@gmail.com> Dear community members, I am new with CTK, and want to use the CTK-VTK widget with Qt. The example from the website works, but once VTK is added, a link error occurs, even though the cpp file has no change. I am quite confused about it, and want to find a solution. * `CMakeLists.txt` ``` cmake_minimum_required(VERSION 2.8) project(TEST_CTK) find_package(VTK REQUIRED) include(${VTK_USE_FILE}) find_package(CTK REQUIRED) include(${CTK_USE_FILE}) find_package(QT4 REQUIRED) include(${QT_USE_FILE}) set(SOURCE_FILES main.cpp) add_executable(TEST_CTK ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} ${CTK_LIBRARIES}) ``` * Error information ``` Scanning dependencies of target TEST_CTK Linking CXX executable TEST_CTK ld: library not found for -lvtkCommon clang: error: linker command failed with exit code 1 (use -v to see invocation) CMakeFiles/TEST_CTK.dir/build.make:90: recipe for target 'TEST_CTK' failed gmake[3]: *** [TEST_CTK] Error 1 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/TEST_CTK.dir/all' failed gmake[2]: *** [CMakeFiles/TEST_CTK.dir/all] Error 2 CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/TEST_CTK.dir/rule' failed gmake[1]: *** [CMakeFiles/TEST_CTK.dir/rule] Error 2 Makefile:110: recipe for target 'TEST_CTK' failed gmake: *** [TEST_CTK] Error 2 ``` * Environment: OS X 10.10 Thank you very much! Regards, Quentan -------------- next part -------------- An HTML attachment was scrubbed... URL: From jchris.fillionr at kitware.com Thu Mar 26 00:30:59 2015 From: jchris.fillionr at kitware.com (Jean-Christophe Fillion-Robin) Date: Thu, 26 Mar 2015 00:30:59 -0400 Subject: [Ctk-developers] Link error with CTK and VTK In-Reply-To: <2D78115D-2782-473C-B777-E87F0352409E@gmail.com> References: <2D78115D-2782-473C-B777-E87F0352409E@gmail.com> Message-ID: Hi Quentan, You are welcome ! I just fixed an issue preventing the Examples from being configured with the latest version of the CTK source. The fix has now been integrated. See [1] Few comments regarding the CMakeLists.txt you pasted above: 1: It should be "find_package(Qt4 REQUIRED)" instead of "find_package(QT4 REQUIRED)" 2: Since CTKConfig.cmake already define "VTK_DIR" and "QT_QMAKE_EXECUTABLE", you could simply the configuration of your project by including VTK and Qt after CTK. That way configuring your project would be as simple as: cd TEST_CTK-build cmake -DCTK_DIR:PATH=/path/to/CTK-build ../CTK_TEST All of that said, I wasn't able to reproduce your problem. Few questions: a) Did you build VTK yourself or let the CTK superbuild taking care of it ? b) How did you configure CTK ? Which configure option ? On my side I used the option detailed in [2]. Since I add already a build of VTK available, I re-used it. Hth Jc [1] https://github.com/commontk/CTK/commit/aee6addc33d5596026c0d47c8793270e91a95a2a [2] cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/jcfr/Support/qt-everywhere-opensource-release-build-4.8.6/bin/qmake -DVTK_DIR:PATH=/home/jcfr/Projects/Slicer-Debug/VTKv6-build/ -DCTK_ENABLE_Widgets:BOOL=1 -DCTK_LIB_Visualization/VTK/Widgets:BOOL=1 -DBUILD_TESTING:BOOL=0 ../CTK On Mon, Mar 16, 2015 at 4:22 PM, Quentan Qi wrote: > Dear community members, > > I am new with CTK, and want to use the CTK-VTK widget with Qt. The example > from the website works, but once > VTK is added, a link error occurs, even though the cpp file has no change. > I am quite confused about it, and want to find a solution. > > * `CMakeLists.txt` > > ``` > cmake_minimum_required(VERSION 2.8) > project(TEST_CTK) > > find_package(VTK REQUIRED) > include(${VTK_USE_FILE}) > > find_package(CTK REQUIRED) > include(${CTK_USE_FILE}) > > find_package(QT4 REQUIRED) > include(${QT_USE_FILE}) > > set(SOURCE_FILES main.cpp) > add_executable(TEST_CTK ${SOURCE_FILES}) > target_link_libraries(${PROJECT_NAME} ${CTK_LIBRARIES}) > ``` > > * Error information > > ``` > Scanning dependencies of target TEST_CTK > Linking CXX executable TEST_CTK > ld: library not found for -lvtkCommon > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > CMakeFiles/TEST_CTK.dir/build.make:90: recipe for target 'TEST_CTK' failed > gmake[3]: *** [TEST_CTK] Error 1 > CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/TEST_CTK.dir/all' > failed > gmake[2]: *** [CMakeFiles/TEST_CTK.dir/all] Error 2 > CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/TEST_CTK.dir/rule' > failed > gmake[1]: *** [CMakeFiles/TEST_CTK.dir/rule] Error 2 > Makefile:110: recipe for target 'TEST_CTK' failed > gmake: *** [TEST_CTK] Error 2 > ``` > > * Environment: OS X 10.10 > > Thank you very much! > > Regards, > Quentan > > _______________________________________________ > Ctk-developers mailing list > Ctk-developers at public.kitware.com > http://public.kitware.com/mailman/listinfo/ctk-developers > > -- +1 919 869 8849 -------------- next part -------------- An HTML attachment was scrubbed... URL: From quentan at gmail.com Fri Mar 27 10:58:46 2015 From: quentan at gmail.com (Quentan Qi) Date: Fri, 27 Mar 2015 14:58:46 +0000 Subject: [Ctk-developers] Link error with CTK and VTK In-Reply-To: References: <2D78115D-2782-473C-B777-E87F0352409E@gmail.com> Message-ID: Hi Jean, Thanks a lot for your detailed explanation! I recompiled CTK using the latest VTK 6.2.0 and it works well. No glitch complains from that example any more. But the Qt widgets `ctkVTKRenderView` and `ctkVTKSliceView`, which come from library file `Qt\plugin\designer\libCTKVisualizationVTKWidgetsPlugins.so`, fail to work and crash Qt Designer. All the other widgets work correctly. This may not be a serious problem. I?m now running on OS X 10.10 with VTK 6.2.0 and Qt 4.8.6. I also wonder when CTK can work with Qt 5, because VTK is quite compatible with it but I failed to compile CTK with VTK 6.2.0 bundled with Qt 5.2.1. My current cmake option is: ``` cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCTK_ENABLE_Widgets:BOOL=ON -DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON -DVTK_DIR:PATH=/usr/local/vtk/lib/cmake/vtk-6.2 ../CTKSource ``` Qt?s path can be found by cmake automatically. Cheers, Quentan > On 26 Mar 2015, at 04:30, Jean-Christophe Fillion-Robin wrote: > > Hi Quentan, > > You are welcome ! > > I just fixed an issue preventing the Examples from being configured with the latest version of the CTK source. The fix has now been integrated. See [1] > > Few comments regarding the CMakeLists.txt you pasted above: > > 1: It should be "find_package(Qt4 REQUIRED)" instead of "find_package(QT4 REQUIRED)" > > 2: Since CTKConfig.cmake already define "VTK_DIR" and "QT_QMAKE_EXECUTABLE", you could simply the configuration of your project by including VTK and Qt after CTK. > > That way configuring your project would be as simple as: > > cd TEST_CTK-build > cmake -DCTK_DIR:PATH=/path/to/CTK-build ../CTK_TEST > > > All of that said, I wasn't able to reproduce your problem. > > Few questions: > > a) Did you build VTK yourself or let the CTK superbuild taking care of it ? > > b) How did you configure CTK ? Which configure option ? On my side I used the option detailed in [2]. Since I add already a build of VTK available, I re-used it. > > > Hth > Jc > > [1] https://github.com/commontk/CTK/commit/aee6addc33d5596026c0d47c8793270e91a95a2a > > [2] cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/jcfr/Support/qt-everywhere-opensource-release-build-4.8.6/bin/qmake -DVTK_DIR:PATH=/home/jcfr/Projects/Slicer-Debug/VTKv6-build/ -DCTK_ENABLE_Widgets:BOOL=1 -DCTK_LIB_Visualization/VTK/Widgets:BOOL=1 -DBUILD_TESTING:BOOL=0 ../CTK > > > On Mon, Mar 16, 2015 at 4:22 PM, Quentan Qi > wrote: > Dear community members, > > I am new with CTK, and want to use the CTK-VTK widget with Qt. The example from the website works, but once VTK is added, a link error occurs, even though the cpp file has no change. I am quite confused about it, and want to find a solution. > > * `CMakeLists.txt` > > ``` > cmake_minimum_required(VERSION 2.8) > project(TEST_CTK) > > find_package(VTK REQUIRED) > include(${VTK_USE_FILE}) > > find_package(CTK REQUIRED) > include(${CTK_USE_FILE}) > > find_package(QT4 REQUIRED) > include(${QT_USE_FILE}) > > set(SOURCE_FILES main.cpp) > add_executable(TEST_CTK ${SOURCE_FILES}) > target_link_libraries(${PROJECT_NAME} ${CTK_LIBRARIES}) > ``` > > * Error information > > ``` > Scanning dependencies of target TEST_CTK > Linking CXX executable TEST_CTK > ld: library not found for -lvtkCommon > clang: error: linker command failed with exit code 1 (use -v to see invocation) > CMakeFiles/TEST_CTK.dir/build.make:90: recipe for target 'TEST_CTK' failed > gmake[3]: *** [TEST_CTK] Error 1 > CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/TEST_CTK.dir/all' failed > gmake[2]: *** [CMakeFiles/TEST_CTK.dir/all] Error 2 > CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/TEST_CTK.dir/rule' failed > gmake[1]: *** [CMakeFiles/TEST_CTK.dir/rule] Error 2 > Makefile:110: recipe for target 'TEST_CTK' failed > gmake: *** [TEST_CTK] Error 2 > ``` > > * Environment: OS X 10.10 > > Thank you very much! > > Regards, > Quentan > > _______________________________________________ > Ctk-developers mailing list > Ctk-developers at public.kitware.com > http://public.kitware.com/mailman/listinfo/ctk-developers > > > > > -- > +1 919 869 8849 -------------- next part -------------- An HTML attachment was scrubbed... URL: