View Issue Details

IDProjectCategoryView StatusLast Update
0002883Slicer4Core: Building (CMake, Superbuild)public2017-06-07 23:27
Reporterjcfr Assigned Tojcfr  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0002883: Fix FindDCMTK.cmake provided by ITKv4
Description

I also tried using CMake 2.8.10 and the error still occurs. Looking at the link line reported below [1], we can see that the path to the library "liboflog.a" and "libofstd.a" are incompelete. Indeed, these ones are referenced as:

/lib/liboflog.a
and
/lib/libofstd.a

If I manually "fix" the command, the library "libITKIODCMTK-4.4.dylib" is successfully linked.

There is probably an issue in either FindDCMTK.cmake, DCMTKConfig.cmake or in the way ITKv4 link the library libITKIODCMTK.

Adding some message statement in the FindDCMTK.cmake bundled with ITKv4, it turns out that the library are incorrectly discovered at that level. Since on the system I am building, the following library exists:

$ ls -als /lib
1504 -rw-r--r-- 1 kitware admin 769104 May 14 2012 /lib/liboflog.a
792 -rw-r--r-- 1 kitware admin 405336 May 14 2012 /lib/libofstd.a

This folder only contains these two libraries, I suspect that this folder has been created by mistake almost a year ago ... I just deleted the folder and the build seems to be continuing as expected.

The problem didn't occur because the FindDCMTK.cmake available within CTK doesn't search that location. See https://github.com/commontk/CTK/blob/master/Utilities/CMake/FindDCMTK.cmake#L69-79

I would recommend that the version available in CTK is used in ITKv4 ... it has been fixed and optimized for now few years. DCMTK maintainers even contributed. See https://github.com/commontk/CTK/commits/master/Utilities/CMake/FindDCMTK.cmake

@Steve: You have probably a similar issue on your workstation.

Hth
Jc

[1] $ make ITKIODCMTK/fast VERBOSE=1
make -f Modules/IO/DCMTK/src/CMakeFiles/ITKIODCMTK.dir/build.make Modules/IO/DCMTK/src/CMakeFiles/ITKIODCMTK.dir/build
Linking CXX shared library ../../../../lib/libITKIODCMTK-4.4.dylib
cd /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/ITKv4-build/Modules/IO/DCMTK/src && "/Users/kitware/Dashboards/Support/CMake 2.8-10.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/ITKIODCMTK.dir/link.txt --verbose=1
/usr/bin/c++ -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -O3 -DNDEBUG -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 1.0.0 -current_version 1.0.0 -o ../../../../lib/libITKIODCMTK-4.4.1.dylib -install_name /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/ITKv4-build/lib/libITKIODCMTK-4.4.1.dylib CMakeFiles/ITKIODCMTK.dir/itkDCMTKImageIO.cxx.o CMakeFiles/ITKIODCMTK.dir/itkDCMTKFileReader.cxx.o CMakeFiles/ITKIODCMTK.dir/itkDCMTKImageIOFactory.cxx.o CMakeFiles/ITKIODCMTK.dir/itkDCMTKSeriesFileNames.cxx.o /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmdata.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmimage.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmimgle.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmjpeg.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmnet.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmpstat.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmqrdb.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmsr.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libdcmtls.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libijg12.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libijg16.a /Users/kitware/Dashboards/Experimental/Slicer-Superbuild-Release-cmake-2.8.10.2-ITKv4/DCMTK-install/lib/libijg8.a /lib/liboflog.a /lib/libofstd.a ../../../../lib/libITKIOImageBase-4.4.1.dylib ../../../../lib/libITKCommon-4.4.1.dylib ../../../../lib/libitksys-4.4.1.dylib ../../../../lib/libITKVNLInstantiation-4.4.1.dylib ../../../../lib/libitkvnl_algo-4.4.1.dylib ../../../../lib/libitkv3p_lsqr-4.4.1.dylib ../../../../lib/libitkvnl-4.4.1.dylib ../../../../lib/libitkvcl-4.4.1.dylib ../../../../lib/libitkv3p_netlib-4.4.1.dylib -lm -lm

TagsITKv4

Relationships

related to 0002978 closedjcfr Build error & unstable executable on linux 
child of 0002007 closedjcfr Build against ITKv4 and remove ITKv3 

Activities

jcfr

jcfr

2013-01-24 05:44

administrator   ~0007729

From Hans:

Kent: Please investigate the option of using FindDCMTK.cmake from the Slicer CTK package for ITK. I would recommend that the version available in CTK is used in ITKv4 ... it has been fixed and optimized for now few years. DCMTK maintainers even contributed. See https://github.com/commontk/CTK/commits/master/Utilities/CMake/FindDCMTK.cmake

jcfr

jcfr

2013-01-24 11:18

administrator   ~0007733

From Kent:

So, I just spent a few hours on fixing the FindDCMTK.cmake from CTK to
work with ITK.

It worked, pretty much, as long as you only ever pointed CMake at an
INSTALLED version of DCMTK. It didn't work to point it at a DCMTK build
directory.

So to fix this, I had to go looking in the build directory for a
CMakeDirectoryInformation.cmake file, and include that to pickup the
source directory. This is required for an uninstalled build, because the
headers are all in the source directory.

Here's a fun fact: There are 4 versions of FindDCMTK.cmake in the ITK
source directory:
./Modules/ThirdParty/DCMTK/CMake/FindDCMTK.cmake
./Modules/ThirdParty/GDCM/src/gdcm/CMake/FindDCMTK.cmake
./Modules/ThirdParty/VNL/src/vxl/config/cmake/Modules/FindDCMTK.cmake
./Modules/ThirdParty/VNL/src/vxl/config/cmake/Modules/NewCMake/FindDCMTK.cm
ake

What's hilarious is that they're all different! To be fair one of the
files in VNL includes the other. The one in GDCM seems to have something
to do with making sure GDCM and DCMTK are inter-operable.

2013-01-24 11:18

 

From-kent-FindDCMTK.cmake (6,220 bytes)
jcfr

jcfr

2013-01-24 11:19

administrator   ~0007734

From Jc:

Hi Kent,

If I understand properly, you updated the one in CTK so that it could be integrated in ITKv4 to support both the discovery of DCMTK in an installed and a build tree. Is that correct ?

Should the enclosed file be dropped as a replacement for "./Modules/ThirdParty/DCMTK/CMake/FindDCMTK.cmake" so that we test it ?

Then, the idea would be to update "./Modules/ThirdParty/DCMTK/CMake/FindDCMTK.cmake".

Let me know what you think ? I think that would be a good first step. We should then work all together to improve DCMTK, fix the one in CMake, etc ...

Thanks

jcfr

jcfr

2013-02-12 11:18

administrator   ~0007904

Seems there are issue building some extension: http://slicer.cdash.org/viewBuildError.php?buildid=64053

For example:
cc1plus: error: /Users/kitware/Dashboards/Nightly/Slicer-build-64bits-QT4.7.4-PythonQt-With-Tcl-CLI-Release-nightly/DCMTK-install/lib/libdcmdata.a: not a directory

hjmjohnson

hjmjohnson

2013-02-23 11:46

developer   ~0008016

Kent Williams is working on patch in the InsightToolkit/DCMTK github that may remove the need for this.

jcfr

jcfr

2013-02-23 19:22

administrator   ~0008021

Fixed in r21772
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=21772

jcfr

jcfr

2014-03-06 05:15

administrator   ~0011050

Closing resolved issues that have not been updated in more than 3 months

jcfr

jcfr

2017-06-07 23:27

administrator   ~0014654

Fix committed to 2145-support-for-installing-extension-from-file branch.

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 3bcf451e

2013-02-24 00:16:35

jcfr

Details Diff
COMP: Update ITKv4 tag to ensure Slicer DCMTK libraries are used.

Warning: Since the ITK version will now be 4.4 instead of 4.3. It is
recommended that developers should make sure to remove "4.3" related
library from their build tree.
On macosx/linux, one way of removing the libraries would be:
cd /path/to/Slicer-Superbuild/ITK-build
rm -rf lib/*4.3*

This commit intend to fix issue detailed in both Slicer
issue 2883 and issue 2978.

In a nutshell, a link error like the following was occurring:

Linking CXX executable ../../../lib/Slicer-4.2/cli-modules/DTIimport
/path/to/Slicer-build/ITKv4-build/lib/libITKIODCMTK-4.4.so.1: undefined reference to `OFFilename::OFFilename(char const*, bool)'
/path/to/Slicer-build/ITKv4-build/lib/libITKIODCMTK-4.4.so.1: undefined reference to `OFFilename::~OFFilename()'
collect2: error: ld returned 1 exit status
make[5]: *** [lib/Slicer-4.2/cli-modules/DTIexport] Error 1

In that specific case, the CMakeCache of ITK build was referencing
the wrong dcmdata library:
DCMTK_dcmdata_LIBRARY:FILEPATH=/usr/lib/libdcmdata.so

... whereas it should have been:
DCMTK_dcmdata_LIBRARY:FILEPATH=/path/to/Slicer-build/DCMTK-install/lib/libdcmdata.a


ITK commit 31bc608a [1] updated Modules/ThirdParty/DCMTK/CMake/FindDCMTK.cmake
so that default path are explicitly ignored when looking for DCMTK libraries.
This will ensure that the DCMTK library built by Slicer will be used.

The option NO_DEFAULT_PATH associated with the command "find_library" [2] is
now used.

Let's also note that the other "FindDCMTK.cmake" modules available in ITKv4
haven't been fixed and could lead to similar similar issue [3][4]. As of today,
this is probably not an issue within Slicer. Indeed, ITK is not built with
GDCM support and DCMTK seems not be used within VNL. (It means the associated
DCMTK cmake files should probably be removed.)

See http://www.na-mic.org/Bug/view.php?id=2883 and http://www.na-mic.org/Bug/view.php?id=2978
Fixes 0002883 and 0002978


[1] https://github.com/Kitware/ITK/commit/b9c473e241d46bc79d6750ffae73a112b0dcae7c
[2] http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:find_library
[3] ./Modules/ThirdParty/VNL/src/vxl/config/cmake/Modules/NewCMake/FindDCMTK.cmake
[4] ./Modules/ThirdParty/GDCM/src/gdcm/CMake/FindDCMTK.cmake

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21772 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_ITKv4.cmake Diff File

Issue History

Date Modified Username Field Change
2013-01-24 05:43 jcfr New Issue
2013-01-24 05:43 jcfr Status new => assigned
2013-01-24 05:43 jcfr Assigned To => jcfr
2013-01-24 05:44 jcfr Note Added: 0007729
2013-01-24 05:44 jcfr Assigned To jcfr => hjmjohnson
2013-01-24 05:44 jcfr Target Version => Slicer 4.3.0
2013-01-24 05:44 jcfr Tag Attached: ITKv4
2013-01-24 05:45 jcfr Relationship added child of 0002007
2013-01-24 11:18 jcfr Note Added: 0007733
2013-01-24 11:18 jcfr File Added: From-kent-FindDCMTK.cmake
2013-01-24 11:19 jcfr Note Added: 0007734
2013-02-12 11:18 jcfr Note Added: 0007904
2013-02-23 11:46 hjmjohnson Note Added: 0008016
2013-02-23 11:54 jcfr Relationship added related to 0002978
2013-02-23 19:22 jcfr Note Added: 0008021
2013-02-23 19:22 jcfr Status assigned => resolved
2013-02-23 19:22 jcfr Fixed in Version => Slicer 4.3.0
2013-02-23 19:22 jcfr Resolution open => fixed
2014-03-06 05:15 jcfr Note Added: 0011050
2014-03-06 05:17 jcfr Status resolved => closed
2017-06-07 23:27 jcfr Changeset attached => Slicer 2145-support-for-installing-extension-from-file 3bcf451e
2017-06-07 23:27 jcfr Note Added: 0014654
2017-06-07 23:27 jcfr Assigned To hjmjohnson => jcfr