Compiling DCMTK for Ubuntu

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bnoeafk
Posts: 32
Joined: Fri, 2012-10-12, 08:05

Compiling DCMTK for Ubuntu

#1 Post by bnoeafk »

Hi all,
I'm not a programmer however I'm a firm believer in giving back to worthwhile projects like DCMTK and so I'm seriously considering setting up a public PPA for DCMTK for Ubuntu users. I'm not sure how many users out there use Ubuntu as there certainly seems to be a lot of Windows users, but I guess we'll wait and see.

So, that all being said, I'm obviously missing a few things as I've tried compiling the latest version a number of times and consistently get errors.

I download the support libraries (those found in the FTP Support folder) and compile them in the following order:
  1. zlib
  2. tiff
  3. libpng
  4. libxml
  5. libiconv
  6. openssl
For each of these libraries I:
  1. extract the file
  2. enter the folder
  3. run ./configure (./config for openssl)
  4. run make
  5. run make test (openssl only)
  6. run make install
There's a few warnings when compiling some of these libraries but those warnings are about variables not being used etc so I don't think there's any issues with them. libiconv states to libtool: warning: remember to run 'libtool --finish /usr/local/lib' (which I do).

Then I attempt to compile DCMTK as follows
  1. extract the file
  2. obtain my gcc version (7)
  3. create a folder according to my gcc version and enter that folder
  4. run cmake ../dcmtk-3.6.4 -DBUILD_SHARED_LIB=ON
  5. make -j8
  6. make DESTDIR=../final install
I don't get past (iv.) as I get the following error:
used as include directory in directory /home/dave/dcmtkTemp/dcmtk-3.6.4/dcmpmap/include
JPEG_LIBRARY (ADVANCED)
linked by target "dcmimage" in directory /home/dave/dcmtkTemp/dcmtk-3.6.4/dcmimage/libsrc
-- Configuring incomplete, errors occurred!
See also "/home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeOutput.log".
See also "/home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeError.log".
Inspecting CMakeOutput.log, nothing really looks amiss, whereas CMakeError.log contains a number of "failed recipes"
Performing C++ SOURCE FILE Test WITH_STDLIBC_ICONV failed with the following output:
Change Dir: /home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_6462e/fast"
/usr/bin/make -f CMakeFiles/cmTC_6462e.dir/build.make CMakeFiles/cmTC_6462e.dir/build
make[1]: Entering directory '/home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_6462e.dir/src.cxx.o
/usr/bin/c++ -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=
199506L -DWITH_STDLIBC_ICONV -o CMakeFiles/cmTC_6462e.dir/src.cxx.o -c /home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_6462e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6462e.dir/link.txt --verbose=1
/usr/bin/c++ -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=1
99506L -DWITH_STDLIBC_ICONV -rdynamic CMakeFiles/cmTC_6462e.dir/src.cxx.o -o cmTC_6462e
CMakeFiles/cmTC_6462e.dir/src.cxx.o: In function `main':
src.cxx:(.text+0x17): undefined reference to `libiconv_open'
src.cxx:(.text+0x3c): undefined reference to `libiconv'
src.cxx:(.text+0x48): undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_6462e.dir/build.make:97: recipe for target 'cmTC_6462e' failed
make[1]: *** [cmTC_6462e] Error 1
make[1]: Leaving directory '/home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_6462e/fast' failed
make: *** [cmTC_6462e/fast] Error 2

Source file was:
#include <iconv.h>
int main(){iconv_t cd = iconv_open("","");iconv(cd,0,0,0,0);iconv_close(cd);return 0;}
Performing C++ SOURCE FILE Test LIBICONV_SECOND_ARGUMENT_CONST failed with the following output:
Change Dir: /home/dave/dcmtkTemp/dcmtk-gcc-7/CMakeFiles/CMakeTmp
Now as stated, I'm not a programmer but it appears that (at least in this instance) the libiconv libraries weren't installed correctly. Am I not compiling libiconv correctly? When I run make install (for all libraries), I pipe the output to files and in reading the file from libiconv's "make install" command, I read that in order to link the libraries for use later on (which I presume I need to do) I have to use the libtool. I've tried

Code: Select all

libtool link /usr/local/lib/libiconv.so
which asks about a tag and ... then I start to go down a rabbit hole that perhaps I shouldn't...

I appreciate that once this works, I need to package it up which I'm pretty sure I can handle, but failing at this first hurdle is so de-moralizing...

Can anyone please give me some guidance?

J. Riesmeier
DCMTK Developer
Posts: 2496
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Compiling DCMTK for Ubuntu

#2 Post by J. Riesmeier »

Thank you for your work (so far) and your plan to contribute to our Open Source project!

My first question when reading your posting was: what's wrong with the official Ubuntu packages.
My second question was: why did you download the source code packages of the external libraries from the DCMTK ftp server instead of using the official Ubuntu packages (for zlib, libxml, etc.)

Regarding your linker errors: maybe, there is confusion between the iconv functions that are part of the glibc and those that are part of the libiconv. You can choose which version to use by setting the CMake variable DCMTK_ENABLE_CHARSET_CONVERSION appropriately.

bnoeafk
Posts: 32
Joined: Fri, 2012-10-12, 08:05

Re: Compiling DCMTK for Ubuntu

#3 Post by bnoeafk »

Herr Riesmeier,
To answer your questions in turn:
  1. I'd love to use the official Ubuntu packages, but they've always been a few versions behind. At the moment Ubuntu 18 only has v3.6.2 available (although Ubuntu 19 does have a package for 3.6.4) but there's a tendency to remain on the LTS versions of Ubuntu when you're potentially deploying a number of servers out into the field.
  2. I did that as I was under the assumption it would be considerably easier to obtain (potential) support for DCMTK if I used the packages that were supplied by Offis. Additionally, the versions of those libraries are - again - subject to the repos being in line with the same libraries that I assume Offis uses and I can only imagine that once one starts breaking away from the "approved" libraries, then you're kinda out on your own - which is not really where I want to be!
I'm in this for the long haul, so if you don't mind me asking more compiling questions, I'm more than happy to attempt to compile DCMTK with currently available libraries and see how far I get?

Additionally, I would love to know how many people utilize DCMTK around the world and the response that I've always received from this forum and your team has always been very prompt and precise. Although I can't really assist in developing etc, I can when it comes to testing and - as long as it's within my boundaries to do so - being able to provide more up to date packages for Ubuntu, then isn't that the very essence of Open Source? :smile:

J. Riesmeier
DCMTK Developer
Posts: 2496
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Compiling DCMTK for Ubuntu

#4 Post by J. Riesmeier »

Thank you for the background information. I was just wondering... now I know :D
I'm in this for the long haul, so if you don't mind me asking more compiling questions, I'm more than happy to attempt to compile DCMTK with currently available libraries and see how far I get?
Of course, please proceed!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest