[Ctk-developers] DCMTK_DIR is found incorrectly
Csaba Pinter
csaba.pinter at queensu.ca
Thu Oct 10 19:13:46 UTC 2013
Hello,
I tried the NO_DEFAULT_PATH idea Jc was suggesting (see below), and now I could successfully build CTK with DCMTK.
As we have the same issue from time to time with CTK in Slicer (but finally we could reproduce it, see [1]), I propose adding this flag to FindDCMTK.cmake in the CTK master, at least until the DCMTKConfig.cmake change is not integrated to DCMTK.
As my CMake knowledge is limited, I don't know if this change causes any problem on other operating systems though.
I'd appreciate to hear your opinions about this.
Thank you,
csaba
[1] https://www.assembla.com/spaces/slicerrt/tickets/325#/activity/ticket
From: Jean-Christophe Fillion-Robin [mailto:jchris.fillionr at kitware.com]
Sent: October 4, 2013 18:34
To: Csaba Pinter
Cc: Andras Lasso; CTK mailing list
Subject: Re: [Ctk-developers] DCMTK_DIR is found incorrectly
Hi Csaba,
As illustrated in the enclosed screenshot, build tree can be exported into the CMake package registry. As some point, the DCMTK build tree has probably been exported [1][2][3].
Since when building CTK, it is expected that there are no DCMTKConfig.cmake available, the first should be failing. In your case, it seems not to be failing because it resolves to that previous build added to the registery.
I would suggest to try adding the parameter "NO_DEFAULT_PATH" to the FindDCMTK.cmake module available in CTK. See [4]
Hth
Jc
[1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export
[2] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html
[3] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263
[4] https://github.com/commontk/CTK/blob/f64b68acd717dab060db41e8bee3f0f30df1a58f/Utilities/CMake/FindDCMTK.cmake#L42
On Fri, Oct 4, 2013 at 5:39 PM, Csaba Pinter <csaba.pinter at queensu.ca<mailto:csaba.pinter at queensu.ca>> wrote:
Hi Jc,
I tried building CTK in many ways, but the result is always the same, so the problem is completely reproducible, at least on my computer (I haven't tried it elsewhere yet, but I plan to). As we have been struggling with this issue for quite a while, but haven't been able to consistently reproduce it, this is a great opportunity to fix it once and for all.
I did some digging and this is what I found:
- FindDCMTK.cmake finds DCMTKConfig.cmake, but it is in the incorrect directory that is used later (in one of my slicer builds)
- The reason why the DCMTK downloaded by the superbuild is not found is most probably that it is a version that doesn't have DCMTKConfig.cmake (as you described earlier)
- The same thing (finding the wrong DCMTK) happens if I add NO_CMAKE_BUILDS_PATH to the find_package call in FindDCMTK.cmake
Now I don't have any idea how to get the superbuild to use its own DCMTK.
Also even if I can do a workaround and have a good build of CTK on my machine, this is an issue that other people who want to build CTK on Windows while already having a Slicer build have to face.
Cheers,
csaba
From: Jean-Christophe Fillion-Robin [mailto:jchris.fillionr at kitware.com<mailto:jchris.fillionr at kitware.com>]
Sent: October 4, 2013 12:07
To: Andras Lasso
Cc: Csaba Pinter; CTK mailing list
Subject: Re: [Ctk-developers] DCMTK_DIR is found incorrectly
Hi Csaba, Andras,
Within the file FindDCMTK.cmake [1] provided by CTK, where would you suggest to add the NO_CMAKE_BUILDS_PATH ?
Let's also note that the FindDCMTK.cmake provided by ITK would have to patched also ...
If you can reproduce the problem, with a combination of clearing cache + adding some "message()" statement, you should be able to find out or confirm what is the source of the problem.
Jc
[1]
https://github.com/commontk/CTK/blob/master/Utilities/CMake/FindDCMTK.cmake
On Wed, Oct 2, 2013 at 1:42 PM, Andras Lasso <lasso at queensu.ca<mailto:lasso at queensu.ca>> wrote:
I have this annoying issue during Slicer builds as well: my nightly slicer builds usually break after a few days because after I configure other projects in CMake CTK finds DCMTK of another project instead of its own.
It may be due to the find_package path finding rule 5: "Search project build trees recently configured in a CMake GUI. This can be skipped if NO_CMAKE_BUILDS_PATH is passed. It is intended for the case when a user is building multiple dependent projects one after another." (http://www.cmake.org/cmake/help/v2.8.10/ctest.html). Probably CTK should rely on rules 1-4 or disable rule 5 - or it may be possible that something else goes wrong and that's why the rule 5 kicks in.
Andras
From: ctk-developers-bounces at commontk.org<mailto:ctk-developers-bounces at commontk.org> [mailto:ctk-developers-bounces at commontk.org<mailto:ctk-developers-bounces at commontk.org>] On Behalf Of Jean-Christophe Fillion-Robin
Sent: Wednesday, October 02, 2013 11:39 AM
To: Csaba Pinter
Cc: CTK mailing list
Subject: Re: [Ctk-developers] DCMTK_DIR is found incorrectly
Hi Csaba,
In CTKConfig, the variable "CMAKE_MODULE_PATH" is a CMake global variable that is empty by default. On the other hand "CTK_CMAKE_UTILITIES_DIR" should not be empty as illustrated below:
$ cat ../CTKConfig.cmake | ack -i "set\(CTK_CMAKE_UTILITIES_DIR"
SET(CTK_CMAKE_UTILITIES_DIR "/home/jchris/Projects/CTK/Utilities/CMake")
Otherwise, you will find below the result of my experiment. When configured, CTK found the expected DCMTK.
On Ubuntu 13.04 using CMake 2.8.11.2, after installing the package "python2.7-dev" doing so the following works.
Note that I didn't enable CTK_ENABLE_ALL since I didn't the build system to build VTK or ITK components. Instead, I passed the following options:
-DCTK_ENABLE_Python_Wrapping:BOOL=ON
-DCTK_ENABLE_DICOM:BOOL=ON
-DCTK_BUILD_EXAMPLES
$ git clone git at github.com:commontk/CTK<mailto:git at github.com:commontk/CTK>
$ mkdir CTK-Debug
$ cd CTK-Debug
$ cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/bin/qmake -DCTK_ENABLE_Python_Wrapping:BOOL=ON -DCTK_ENABLE_DICOM:BOOL=ON -DCTK_BUILD_EXAMPLES:BOOL=ON ../CTK
[...]
-- Enabling [CTK_LIB_DICOM/Core] because of [ CTK_ENABLE_DICOM:1 OR ( CTK_ENABLE_DICOMApplicationHosting:0 AND CTK_BUILD_EXAMPLES:1 )] evaluates to True
-- Enabling [CTK_APP_ctkDICOM] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOM2] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMIndexer] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMDemoSCU] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMQuery] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMRetrieve] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMQueryRetrieve] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkCommandLineModuleExplorer] because of [ CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkDICOMObjectViewer] because of [ CTK_ENABLE_DICOM:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Enabling [CTK_APP_ctkSimplePythonShell] because of [ CTK_ENABLE_Python_Wrapping:1 AND CTK_BUILD_EXAMPLES:1] evaluates to True
-- Generated: /home/jchris/Projects/CTK-Debug/DGraphInput-alldep.txt
-- Generated: /home/jchris/Projects/CTK-Debug/DGraphInput-alldep-withext.txt
-- Enabling option [CTK_LIB_DICOM/Widgets] required by [ctkDICOM]
-- Enabling option [CTK_LIB_Widgets] required by [ctkDICOM]
-- Enabling option [CTK_LIB_CommandLineModules/Frontend/QtGui] required by [ctkCommandLineModuleExplorer]
-- Enabling option [CTK_LIB_CommandLineModules/Frontend/QtWebKit] required by [ctkCommandLineModuleExplorer]
-- Enabling option [CTK_LIB_CommandLineModules/Backend/LocalProcess] required by [ctkCommandLineModuleExplorer]
-- Enabling option [CTK_LIB_CommandLineModules/Backend/FunctionPointer] required by [ctkCommandLineModuleExplorer]
-- Enabling option [CTK_LIB_CommandLineModules/Core] required by [ctkCommandLineModuleExplorer]
-- Enabling option [CTK_LIB_Scripting/Python/Widgets] required by [ctkSimplePythonShell]
-- Enabling option [CTK_LIB_Scripting/Python/Core] required by [ctkSimplePythonShell]
-- Found PythonInterp: /usr/bin/python (found version "2.7.4")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so<http://libpython2.7.so> (found version "2.7.4")
-- Generated: /home/jchris/Projects/CTK-Debug/DGraphInput.txt
-- Generated: /home/jchris/Projects/CTK-Debug/Project.xml
-- Found Git: /usr/bin/git (found version "1.8.1.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jchris/Projects/CTK-Debug
$ make -j6
[...]
[ 90%] Performing configure step for 'CTK-Configure'
[...]
-- Found PythonInterp: /usr/bin/python (found version "2.7.4")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so<http://libpython2.7.so> (found version "2.7.4")
-- Generated: /home/jchris/Projects/CTK-Debug/CTK-build/DGraphInput.txt
-- Generated: /home/jchris/Projects/CTK-Debug/CTK-build/Project.xml
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - failed
-- Trying to find DCMTK relying on FindDCMTK.cmake
-- Looking for include file pthread.h
-- Looking fothe r include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found DCMTK: /home/jchris/Projects/CTK-Debug/CMakeExternals/Install/include/dcmtk/config
-- Trying to find DCMTK relying on FindDCMTK.cmake - ok
-- CTKCore: BFD support disabled
-- Configuring done
-- Generating done
[...]
-- Build files have been written to: /home/jchris/Projects/CTK-Debug/CTK-build
[...]
[100%] Built target CTKWidgetsCppTests
[100%] Built target CTK-build
$ cd CTK-build
$ $ cat CMakeCache.txt | ack DCMTK_DIR\:PATH
DCMTK_DIR:PATH=/home/jchris/Projects/CTK-Debug/CMakeExternals/Install
Let's note that DCMTK couldn't be found using DCMTKConfig.cmake, this is explained by the fact the official DCMTK didn't integrate yet our latest and greatest contribution [1]
Hth
Jc
[1] https://github.com/commontk/DCMTK/commit/f461865d1759854db56e4c840991c81c77e45bb9
On Wed, Oct 2, 2013 at 10:18 AM, Csaba Pinter <csaba.pinter at queensu.ca<mailto:csaba.pinter at queensu.ca>> wrote:
Hi all,
I'm trying to build CTK separately, but I have problems with linking DCMTK.
The way I build CTK:
- Turn on CTK_BUILD_ALL
- Turn on CTK_ENABLE_DICOM (I need this as I want to merge and test my changes in the CTK/Core/DICOM project)
- Set the qmake executable
- Configure
- CMake complains about python paths, I set those manually
- Configure, Generate
- Build superbuild
Then DCMTK is downloaded and built by the superbuild, but later on, CTK projects find a completely different DCMTK directory (in my Slicer nightly build directory). I tried to manually add the DCMTK directory to CMake, but this variable does not exist in the superbuild (it is also not passed down), and setting it to the inner CTK project doesn't work.
Basically no matter what I do, the DCMTK path is set to whatever find_project finds. This is what I found in CTKConfig.cmake:
# Update CMake module path so that calling "find_package(DCMTK)" works as expected
# after calling "find_package(CTK)"
# Ideally projects like DCMTK or PythonQt should provide both "Config" and "Use" files.
set(CMAKE_MODULE_PATH
${CTK_CMAKE_UTILITIES_DIR}
${CMAKE_MODULE_PATH}
)
Now the problem with this is that ${CMAKE_MODULE_PATH} is empty, so there is no chance DCMTK is found correctly.
Can someone please help with this?
Thanks a lot,
csaba
________________________________
Csaba Pinter
Medical Software Systems Engineer
Laboratory for Percutanous Surgery
School of Computing
Queen's University
Kingston, ON, Canada
Email: csaba.pinter at queensu.ca<mailto:csaba.pinter at queensu.ca>
Web: http://perk.cs.queensu.ca
_______________________________________________
Ctk-developers mailing list
Ctk-developers at commontk.org<mailto:Ctk-developers at commontk.org>
http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers
--
+1 919 869 8849<tel:%2B1%20919%20869%208849>
--
+1 919 869 8849<tel:%2B1%20919%20869%208849>
--
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20131010/353effc3/attachment.htm>
More information about the Ctk-developers
mailing list