Page MenuHomePhabricator

Superbuild GDCM > 2.0.15 and ITK 3.20 Linker errors
Closed, ResolvedPublic

Description

Traced down the linker errors with GDCM 2.015+ and ITK 3.2:

  • ITK CMakeLists.txt does a (line 811): FIND_PACKAGE(GDCM) IF(GDCM_FOUND) INCLUDE(${GDCM_USE_FILE})
  • However, variables that should then be defined are empty (GDCM_LIBRARY_DIRS, GDCM_LIBRARIES...)
  • Workaround:
  1. Set ITK_GDCM_LIBRARIES manually (line 831, 833):

SET(ITK_GDCM_LIBRARIES gdcmMSFF gdcmDICT gdcmIOD gdcmexpat gdcmDSED gdcmCommon gdcmzlib gdcmjpeg8 gdcmjpeg12 gdcmjpeg16 gdcmopenjpeg gdcmcharls itkjpeg8)

  1. Add library directory manually (835):

LINK_DIRECTORIES(${GDCM_DIR}/bin)

--> ITK compiles fine with all GDCM versions.
(Similar to MITK after setting the link directory)

Question is whether:
a) Implement workaround
b) Further look on why FINDPACKE/INCLUDE of GDCM fails (first compare showed no result)

Event Timeline

Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.

The actual reason for this is a missing line in GDCM's

CMake/ExportConfiguration/GDCMConfig.cmake.in

This file should export GDCM_LIBRARY_DIRS, which is used by UseGDCM.cmake. A line

SET(GDCM_LIBRARY_DIRS "@GDCM_LIBRARY_DIRS@")

is already included in gdcm's recent git master, but not in the 2.0.18 release yet.

We could wait until the next release, but actually I'm curious to use gdcm 2.0.18 with MITK, so I'll try to figure out a simple way to add that missing line for an MITK build with 2.0.18.

I could locally make a build of MITK with gdcm 2.0.18 work. This involves a minor patch step for the gdcm 2.0.18 tar.gz archive -- not actually patching but adding one line of source code.

Marco, Sascha, I will append the patch and would like you opinions on it.

If you have no objections, I'd make 2.0.18 the MITK default version of GDCM and change the library dependencies of MITK core so that they would work with both 2.0.14 and 2.0.18.

My arguments for gdcm 2.0.18 are

This patch assumes that there is an archive at

http://mitk.org/download/thirdparty/gdcm-2.0.18.tar.gz

Needs to be modified to a local path for experiments.

Options for gdcm support:

  • we make the build system work with anything between 2.0.14 and 2.0.18 (some more work to find out since when additional TARGET_LINK_LIBRARIES are needed
  • we make it work with EITHER 2.0.18 or 2.0.14, but no versions in-between (just another CMake if)
  • we make it work with 2.0.18 (no additional work needed)

My suggestion: only support gdcm 2.0.18

Small core change in cmake file -> flag +

[b6eed5]: Merge branch 'bug-8801-gdcm_2_0_18'

Merged commits:

2011-10-25 16:47:12 Daniel Maleike [d80874]
Add patch step for GDCM to support version 2.0.18

[641911]: Merge branch 'bug-8801-gdcm_2_0_18_fix-dashboard'

Merged commits:

2011-10-27 16:42:40 Daniel Maleike [d4cd01]
COMP: Support compilation with self-compiled GDCM versions that are not 2.0.18


2011-10-27 11:42:26 Daniel Maleike [ffb531]
COMP: Rename patch step for DCMTK for consistency


2011-10-27 11:42:11 Daniel Maleike [1cddd0]
COMP: Patch ITK 3.20 to work with GDCM 2.0.18

[008049]: Merge branch 'bug-8801-gdcm_2_0_18_fix-dashboard'

Merged commits:

2011-10-27 17:38:28 Marco Nolden [3830d7]
COMP: added zlib dependency to dcmtk

Tihs was probably provided by GDCM before.

[5bb8c1]: Merge branch 'bug-8801-gdcm_2_0_18_fix-dashboard'

Merged commits:

2011-10-27 18:54:48 Marco Nolden [9d7354]
COMP: adapt to new GDCM 2.0.18 interface

After some trouble getting the code compile on all platforms, MITK superbuild now

  • uses GDCM 2.0.18, ITK 3.20
  • only in this configuration ITK will links additionally needed libs, otherwise not (e.g. self-compiled ITK)

This change allows us to load some images in a more reliable way (e.g. not crashing because of failed assertions).