Page MenuHomePhabricator

DCMTK won't build if Anaconda is installed
Open, Unbreak Now!Public

Description

Using the latest beta-branch the superbuild fails during linking of ofchrenc.obj in project DCMTK.
e.g.
ofchrenc.obj : error LNK2019: unresolved external symbol ucnv_convertEx_58 referenced in function "public: class OFCondition __cdecl OFCharacterEncoding::Implementation::convert

The reason for this seems to be that DCMTK_ENABLE_CHARSET_CONVERSION is defined inside bin\ep\src\DCMTK-build\config\include\dcmtk\config\osconfig.h. I suspect this has something to do with DCMTK_WITH_ICU being set to ON inside bin\ep\src\DCMTK\CMakeLists.txt.
This might happen when anaconda is installed, so it was finding the anacoda versions of binaries (ICU Conversion).

A possible solution would be to force the value to be OFF by using -DDCMTK_WITH_ICU:BOOL=OFF inside src\CMakeExternals\DCMTK.cmake

Related Objects

Event Timeline

kalali triaged this task as Normal priority.Oct 18 2018, 2:55 PM
kalali created this task.
franza added a subscriber: franza.May 30 2019, 12:37 PM

Thanks a lot, solution works for me. Is there any reason to not add the fix to the master?

I think this bug is quite critical, because anaconda is needed for many applications. I use it for Anser EMT (open source tracker) and pytorch.

franza raised the priority of this task from Normal to Unbreak Now!.May 30 2019, 12:38 PM
franza claimed this task.May 30 2019, 12:40 PM
kalali added a subscriber: nolden.Jun 3 2019, 11:12 AM

I can't think of any reason. I just stumbled upon this and suggested the fix. Since I have no experience with Anaconda or DCMTK I wasn't sure if this is the correct way to fix it or if there are any side effects. Maybe a review would have been a good idea. Maybe @nolden can help?

I think it is not the best idea to get rid of ICU as it has its purpose regarding Unicode handling. If building or finding ICU interferes with an installation of Anaconda, there are probably other ways of telling DCMTK through CMake to behave as expected.

nolden added a comment.Jul 2 2019, 2:23 PM

Sorry for jumping in late. I'm afraid currently we are anyway not testing any encoding stuff sufficiently.

You could test the following. Go to https://www.dclunie.com/ and look for this section:

"Internationalized character set test DICOM images and what the names should look like"

In general I would suggest we could change defaults to a more relaxed setting, but maybe for Release builds we should think about a solution how to include these libraries if it turns out they are necessary even for basic Umlaute handling

hettich added a subscriber: hettich.EditedJul 8 2019, 3:40 PM

Ich sah hier was ähnliches, beim MITK bauen auf meiner ubuntu-OpenStack-Instanz, allerdings ohne Anaconda, mit gcc 7 (g++-7/gcc-7 version g++-7 (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0): undefined reference to `ucnv_convertEx*'

[ 30%] Building C object src/CMakeFiles/hdf5-shared.dir/H5AC.c.o
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_SKIP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_getName_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_close_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_convertEx_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_open_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_getFromUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_setToUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `u_errorName_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_SKIP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_setFromUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_STOP_63'
collect2: error: ld returned 1 exit status
make[5]: *** [ofstd/tests/CMakeFiles/ofstd_tests.dir/build.make:430: bin/ofstd_tests] Fehler 1
make[4]: *** [CMakeFiles/Makefile2:307: ofstd/tests/CMakeFiles/ofstd_tests.dir/all] Fehler 2
make[3]: *** [Makefile:141: all] Fehler 2
make[2]: *** [CMakeFiles/DCMTK.dir/build.make:115: ep/src/DCMTK-stamp/DCMTK-build] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:327: CMakeFiles/DCMTK.dir/all] Fehler 2
make[1]: *** Es wird auf noch nicht beendete Prozesse gewartet....
[ 30%] Building C object src/CMakeFiles/hdf5-shared.dir/H5B.c.o
[  0%] Performing build step for 'DCMTK'
[  2%] Built target ofstd
[  2%] Linking CXX executable ../../bin/ofstd_tests
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_SKIP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_getName_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_close_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_convertEx_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_open_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_getFromUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_setToUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `u_errorName_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_SKIP_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `ucnv_setFromUCallBack_63'
/usr/bin/ld: ../../lib/libofstdd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_STOP_63'
collect2: error: ld returned 1 exit status
make[6]: *** [ofstd/tests/CMakeFiles/ofstd_tests.dir/build.make:430: bin/ofstd_tests] Fehler 1
make[5]: *** [CMakeFiles/Makefile2:307: ofstd/tests/CMakeFiles/ofstd_tests.dir/all] Fehler 2
make[4]: *** [Makefile:141: all] Fehler 2
make[3]: *** [CMakeFiles/DCMTK.dir/build.make:115: ep/src/DCMTK-stamp/DCMTK-build] Fehler 2
make[2]: *** [CMakeFiles/Makefile2:327: CMakeFiles/DCMTK.dir/all] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:339: CMakeFiles/DCMTK.dir/rule] Fehler 2
make: *** [Makefile:255: DCMTK] Fehler 2

Nach einem tieferen Blick in (...)/ep/src/DCMTK-build/ kam ich auf folgende Lösung: CMAKE_CXX_FLAGS:STRING=-Wno-error=deprecated-declarations

Update2:
Habe ep/src/DCMTK-*/ gelöscht und dann im MitkSuperBuild/ "cmake ." und "make DCMTK" aufgerufen und DCMTK hat einwandfrei korrekt gebaut, sowohl mit als auch ohne Conda auf dem build system.

Speculating:
Maybe that was a bash environment side effect, i cannot reproduce this error on my GNU/Linux system where I use tcsh instead of bash.
The tcsh environment does not contain anything "conda" related, while bash does, if (ana|mini)conda is installed.