Page MenuHomePhabricator

Fix MSVS 2010 debug and release superbuild dcmtk problems
Closed, ResolvedPublic

Description

Currently when trying to do a MITK debug and release superbuild in MSVS 2010 one of the two fails to to a ITERATOR_DEBUG_LEVEL mismatch.

This is due to the install step of DCMTK installing the libraries twice (first release, then debug or vice versa) to the same install dir, thus overwriting one set.

This can be fixed by installing to lib/Debug and lib/Release respectively.

MITK and CTK then need to know where to look for the libs.

This has to be fixed in both toolkits.

See
https://github.com/CJGoch/CTK/tree/enable-debug-and-release-superbuild-with-dcmtk
for a suggested fix for CTK.

Related Objects

StatusAssignedTask
ResolvedNone

Event Timeline

Using the mentioned CTK branch it should work now. Tested on Windows and Linux for MITK superbuild and on Windows for MBI Superbuild.

Will merge as soon as the CTK changes are incorporated into the master.

See discussion
https://github.com/commontk/CTK/issues/229
for details about the CTK integration.

[bb8181]: Merge branch 'bug-12859-install-dcmtk-debug-and-release-libs-separatel

Merged commits:

2012-08-28 15:10:25 Sascha Zelzer [c49869]
Use CTK with an updated FindDCMTK.cmake for VS2010 compatibility.


2012-08-15 13:33:15 Caspar Goch [ae0e28]
Fix package dependencies for Projects using MITK and DCMTK


2012-08-14 16:38:03 Caspar Goch [303a8e]
Merged loops and rearranged libraries according to dependency


2012-08-13 16:39:50 Caspar Goch [645d6e]
Separated finding and including of libraries


2012-08-13 12:51:54 Caspar Goch [64ffbc]
debug and optimized flag work only on one lib


2012-08-08 12:29:35 Caspar Goch [2cd1ee]
DCMTK libs are now separated into Debug/Release

It has to be made certain, that the right ones are linked now

After the recent changes external projects (especially MBI) have configure errors when doing a debug or release only build on windows (such as dartclients usually do):

Could NOT find DCMTK (missing: DCMTK_ofstd_LIBRARY_DEBUG DCMTK_dcmdata_LIBRARY_DEBUG DCMTK_dcmimgle_LIBRARY_DEBUG)
CMake Error at D:/dart/nightly/MITK-MBI-Superbuild-Release-experimental/CMakeExternals/Source/MITK/CMake/PackageDepends/MITK_DCMTK_Config.cmake:14 (message):

DCMTK development files not found.

 Please check variables (e.g. DCMTK_DIR) for include directories and libraries.

You may set environment variable DCMTK_DIR before pressing 'configure'

Call Stack (most recent call first):

D:/dart/nightly/MITK-MBI-Superbuild-Release-experimental/CMakeExternals/Source/MITK/CMake/mitkMacroUseModule.cmake:51 (include)
D:/dart/nightly/MITK-MBI-Superbuild-Release-experimental/CMakeExternals/Source/MITK/CMake/mitkMacroCreateModule.cmake:117 (MITK_USE_MODULE)
Modules/DicomIndexer/CMakeLists.txt:4 (MITK_CREATE_MODULE)

This is due to either debug or release libraries not being found if only the other is build.

A possible solution is suggested in branch bug-12859-do-not-abort-if-only-one-set-of-dctmk-libraries-exists .

Any comments?

I wouldn't change the semantics of the DCMTK_*_LIBRARY_DEBUG variables by setting them to the release library (or vice versa).

The actual problem (in my opinion) is that in find_package_handle_standard_args at

https://github.com/MITK/MITK/blob/master/CMake/FindDCMTK.cmake#L166

both the DCMTK_*_LIBRARY_DEBUG and DCMTK_*_LIBRARY_RELEASE variables appear.

I would suggest to create another variable for each DCMTK library, containing both the debug and release libraries. E.g. replace

  1. Add libraries to variable according to build type

if(DCMTK_${lib}_LIBRARY_RELEASE)

list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE})

endif()

if(DCMTK_${lib}_LIBRARY_DEBUG)

list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG})

endif()
#-----------------------------------------------------

with

  1. Add libraries to variable according to build type

set(DCMTK_${lib}_LIBRARY)
if(DCMTK_${lib}_LIBRARY_RELEASE)

list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE})
list(APPEND DCMTK_${lib}_LIBRARY optimized ${DCMTK_${lib}_LIBRARY_RELEASE})

endif()

if(DCMTK_${lib}_LIBRARY_DEBUG)

list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG})
list(APPEND DCMTK_${lib}_LIBRARY debug ${DCMTK_${lib}_LIBRARY_DEBUG})

endif()
#-----------------------------------------------------

in FindDCMTK.cmake and use the new DCMTK_${lib}_LIBRARY variables instead of ther debug and release variants in the find_package_handle_standard_args call.

[1a884f]: Merge branch 'bug-12859-do-not-abort-if-only-one-set-of-dctmk-librarie

Merged commits:

2012-08-31 11:07:55 Caspar Goch [84b990]
Handle only debug or only release cases

Subprojects now get configured in regard to DCMTK appropriatly.


2012-08-30 15:45:13 Caspar Goch [1694e3]
Do not look for release and debug libraries separately for external projects


2012-08-30 14:11:55 Caspar Goch [f99f6d]
if not found replace either debug or release library path by the other