Installed DCMTK on Mac OSX Lion (I think), now what?

Compilation and installation of DCMTK

Moderator: Moderator Team

Message
Author
coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

Installed DCMTK on Mac OSX Lion (I think), now what?

#1 Post by coach4ae »

Firstly, I have searched the forum for the answer to my question and have thus far come up with nil; I hope I'm not missing it. I suspect this is something very simple that I am just not educated/experienced enough yet to know.

I believe I install DCMTK correctly. I

Code: Select all

cd 
to the directory, run

Code: Select all

./configure
then

Code: Select all

make
then

Code: Select all

sudo make install
As far as I can tell everything runs correctly and DCMTK is installed. I can get to ../dcmtk-3.6.0/dcmdata/apps to find, for example, dcmdump.cc. My question is "how do I use this"? I have a Windows PC at my work that has this already installed and configured where the dcmdump is an executable file. I can run

Code: Select all

dcmdump.exe anyDicomFile > dump.txt
and it works. I cannot do this with the .cc files on my Mac. Is there another step I have missed, or perhaps an error I failed to notice?

I know I can use Fink, MacPorts, or Homebrew to get this installed, but my goal is to learn about this process and not just get to an end result.

Thanks in advance for any assistance to what I am sure (and I hope) is a very easy question.

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

dcmdump.cc is the source code file, i.e. this is what translated into computer-executable files by running make (which controls the compiler, on Mac this is gcc or clang).

When you call make install, all generated executables are copied to the directories on your system that are foreseen to hold program packages. The default on Mac should be /usr/local/ where make install creates some sub directories which hold the DCMTK files, including binaries. Since the source code files (.cc and .h) are not needed for that, you won't find them there.

Look into /usr/local/bin and you will find the binaries installed by make install (e.g. dcmdump).

When you enter dcmdump on the commandline, your Mac tries to find it in some directories set in an environment variable called PATH. If you enter "export" (not sure Mac), some variables including PATH will be shown. If /usr/local/bin is not part of the PATH variable value, your call to dcmdump would not work since the system would not find the binary.

HTH,
Michael

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#3 Post by coach4ae »

Thanks for the incredibly quick response!
Look into /usr/local/bin and you will find the binaries installed by make install (e.g. dcmdump).
When I look in /usr/local/bin I do not see any DCMTK binaries there.
When you enter dcmdump on the commandline, your Mac tries to find it in some directories set in an environment variable called PATH. If you enter "export" (not sure Mac), some variables including PATH will be shown. If /usr/local/bin is not part of the PATH variable value, your call to dcmdump would not work since the system would not find the binary.
The "export" command does work on the Mac and /usr/local/bin in the the PATH variable.

This indicates to me that I do not have it installed correctly. Would you agree?

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#4 Post by Michael Onken »

Hi,

look at the output of make install. You must run this as root, i.e. type "sudo make install". The reason is that you are not permitted as a normal user to write something in /usr/local.

If dcmdump runs if you enter it in the command line, you may enter "pwd dcmdump" which then shows from what path dcmdump was run.

Try typing "env" instead of export to see your environment variables including PATH.

Michael

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#5 Post by coach4ae »

Below is the output of "sudo make install' and "env" respectively.
sudo make install:

Code: Select all

sudo make install
(cd config && make ARCH="" DESTDIR="" install)
./mkinstalldirs /usr/local/share/doc/dcmtk
/usr/bin/install -c -m 644 docs/config.txt /usr/local/share/doc/dcmtk
/usr/bin/install -c -m 644 docs/envvars.txt /usr/local/share/doc/dcmtk
/usr/bin/install -c -m 644 docs/modules.txt /usr/local/share/doc/dcmtk
/usr/bin/install -c -m 644 docs/dirstruc.txt /usr/local/share/doc/dcmtk
/usr/bin/install -c -m 644 docs/macros.txt /usr/local/share/doc/dcmtk
(cd ofstd && make ARCH="" DESTDIR="" install)
(cd include && make ARCH="" all)
make[2]: Nothing to be done for `all'.
(cd libsrc && make ARCH="" all)
c++	-DHAVE_CONFIG_H -DUSE_NULL_SAFE_OFSTRING  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
		 -O -I/usr/include/libxml2 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall  ofstring.cc
In file included from /usr/include/sys/attr.h:42,
                 from /usr/include/sys/mount.h:76,
                 from /usr/include/libc.h:44,
                 from ../include/dcmtk/ofstd/ofstdinc.h:335,
                 from ../include/dcmtk/ofstd/ofstring.h:63,
                 from ofstring.cc:42:
/usr/include/sys/ucred.h:91: error: ‘u_long’ does not name a type
/usr/include/sys/ucred.h:133: error: ‘u_int’ does not name a type
In file included from /usr/include/sys/mount.h:76,
                 from /usr/include/libc.h:44,
                 from ../include/dcmtk/ofstd/ofstdinc.h:335,
                 from ../include/dcmtk/ofstd/ofstring.h:63,
                 from ofstring.cc:42:
/usr/include/sys/attr.h:80: error: ‘u_short’ does not name a type
/usr/include/sys/attr.h:444: error: ‘u_long’ does not name a type
/usr/include/sys/attr.h:456: error: ‘u_char’ does not name a type
make[2]: *** [ofstring.o] Error 1
make[1]: *** [libsrc-all] Error 2
make: *** [ofstd-install] Error 2
env:

Code: Select all

env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/jn/_y8dqlpn34b1jjp98hyq1k480000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-5KiOIe/Render
TERM_PROGRAM_VERSION=297
TERM_SESSION_ID=2C678464-A4B2-4FE0-A451-529DFB1B0FA1
USER=Chad
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-kKhmMZ/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
PWD=/Users/Chad/Downloads/Offis/dcmtk-3.6.0/dcmdata/apps
LANG=en_US.UTF-8
HOME=/Users/Chad
SHLVL=1
LOGNAME=Chad
DISPLAY=/tmp/launch-njikyI/org.x:0
_=/usr/bin/env
If dcmdump runs if you enter it in the command line, you may enter "pwd dcmdump" which then shows from what path dcmdump was run.
To clarify: Regarding my comment about being able to run it in the command line, I was referring to the functionality I have at work on Windows. I would like to mimic this functionality on my Mac.

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#6 Post by Michael Onken »

Hi,

already compiling fails, i.e. make install first automatically runs "make" to compile.

Which version of DCMTK have you been downloading? Looks like compilation fails with very basic errors. Before that error is gone, you will not be able to install DCMTK to /usr/local. Not sure why compilation failes, though.

Did ./configure run without problems?

The PATH variable on your mac is already fine since it includes /usr/local/bin.

Michael

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#7 Post by coach4ae »

I have been using 3.6.0.

I will uninstall (I think there is an argument I can use with "make" or "configure" to do this; I just have to find out what it is) and start from scratch. I will post results whether or not it runs successfully.

I will also try the previous version (3.5.4) to see how that works.

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#8 Post by coach4ae »

Ok, the steps I have take are:
1) Remove any existing configuration by running "make distclean"
2) Delete my dcmtk downloaded files and extracted directories
3) Download dcmtk354 and dcmtk360 from the FTP
4) Extract dcmtk360
5) From the extracted folder "dcmtk-3.6.0", run the following commands in order: "./configure --enable-debug" "sudo make all" "sudo make install".
***This failed in much the same way as the previous attempts***
6) Run "make distclean"
7) Change directory to "dcmtk-3.5.4" from the extracted file
8) From the extracted folder "dcmtk-3.5.4", run the following commands in order: "./configure --enable-debug" "sudo make all" "sudo make install".
***Again, this failed in much the same way as the previous attempts***

I have the output for all of these commands saved as an rtf, but I do not see an option to upload to this forum. I would be happy to make them available if anyone is interested, I just need to know the best way to do so.

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

#9 Post by J. Riesmeier »

From what I can see from your above posted compiler output ...

Code: Select all

c++   -DHAVE_CONFIG_H -DUSE_NULL_SAFE_OFSTRING  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \ 
       -O -I/usr/include/libxml2 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall  ofstring.cc 
... your version of Mac OS X is not yet supported by the configure mechanism (because e.g. _DARWIN_C_SOURCE is not defined).

Here's the check in "config/configure.in":

Code: Select all

	*-*-darwin[[8-9]].*|*-*-darwin1[[0-1]].*)
	  dnl On Mac OS X we need to have _DARWIN_C_SOURCE defined to enable UNIX standard API for system headers
	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
	  ;;
I guess the host identifier for your system is "*-*-darwin12", right? If so, could you please change the "[0-1]" in the above file to "[0-2]" and then do the following:

Code: Select all

$> cd config
$> ./autoall
$> cd ..
$> ./configure
$> make
$> sudo make install

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#10 Post by coach4ae »

Thanks for the reply. I have inspected my config.in file, and I believe the problem to be exactly what you indicated. Beginning on lines 608, and again on 651, the following code is:

Code: Select all

*-*-darwin[[8-9]].*|*-*-darwin10.*)
	  dnl On Mac OS X we need to have _DARWIN_C_SOURCE defined to enable UNIX standard API for system headers
	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
	  ;;
This indicates to me that it is compatible with Darwin 8-10.*. My version of Darwin on Mac OS X 10.7.1 is 11.1.0 as indicated by the output of the hostinfo command:

Code: Select all

Mach kernel version:
	 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64
Kernel configured for up to 2 processors.
2 processors are physically available.
2 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1
Primary memory available: 4.00 gigabytes
Default processor set: 81 tasks, 382 threads, 2 processors
Load average: 0.53, Mach factor: 1.46
I copied the code from your post (@J. Riesmeier) and then started from scratch. I received the same errors. To be thorough, I did as you ultimately suggested and changed the "1" to a "2", ran ./autoall, and began again. SUCCESS!

I suspect I would have had the same problems if I had not upgraded to Mac OS X 10.7 to 10.7.1 since the "config.in" file appeared to be configured for Darwin 10.* which comes with Mac OS X 10.6.*. I was confused when it did not work after adding the "*-*-darwin1[[0-1]].*" code because I thought that 11.* would include 11.*.*. Since it seems to have installed correctly only after changing to "*-*-darwin1[[0-2]].*", it appears I was incorrect.

It is worth noting that both source code and documentation files (.zip and .tar.gz) have the line that reads "*-*-darwin10.*". Should it be changed to accommodate Darwin 11.1.0? Since I did not see any errors during my install, I think it would be safe to do at least that much (though, I don't do this for a living, so that is my humble opinion).

I have saved the entire output of my process in the event that anyone is interested in reviewing it (send me a PM). I will begin using and testing the software and will report any issues, but at this point, I believe this post can be closed. Thank you both for your assistance.

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

#11 Post by J. Riesmeier »

Sorry for the confusion. It seems, the required changes are already part of our development version. See the following commit, which uses version "11" and not "12" (as I was incorrectly assuming in my previous post).

Does this patch also work for your system?

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#12 Post by coach4ae »

If I am understanding correctly the information on the page you linked to, the answer is no, the patch did not work correctly on my system. Or, I did not duplicate it in the same way. The first section is "Changes .361" and is just a description. The second is "config/configure" which refers to the executable file. If there is a way to edit that file, I do not know about it. I did not change that file on my system. The third section is "config/configure.in" which I was able the change in a simple text editor.

Here is where I think I am confused:
The commit page you linked to seems to indicate that the fix is to change the first line to the second

Code: Select all

-       *-*-darwin[[8-9]].*|*-*-darwin1[0-1].*)
+       *-*-darwin[[8-9]].*|*-*-darwin1[[0-1]].*)
For me, the first line did not look like that, it looked like this

Code: Select all

*-*-darwin[[8-9]].*|*-*-darwin10.*)
When I changed it to

Code: Select all

*-*-darwin[[8-9]].*|*-*-darwin1[[0-1]].*)
it continued to fail in the same way. I think this may be caused by the additional decimal place in the Darwin version. See the fourth paragraph regarding converting Darwin version to a release version here. Again, if I am understanding all of this correctly, the original release of Mac OS X 10.7.0 had a Darwin version of 11.0. Since the release of Apple's first patch, the Mac OS X version is 10.7.1, but the Darwin version is 11.1.0. I believe that the additional decimal point could be the reason that the above proposed fix did not work for me, but the following code did

Code: Select all

*-*-darwin[[8-9]].*|*-*-darwin1[[0-2]].*)
I would prefer to not back my system down to 10.7, and that leaves me with no way to test this. I could try to remove DCMTK again and modify the "config/configure.in" file to

Code: Select all

*-*-darwin[[8-9]].*|*-*-darwin1[[0-1]].*.*)
and try again, if that sounds like a reasonable idea.

Again, this is not my area of expertise and I understand just enough of this to be dangerous (I'm surprised my computer didn't explode during this process). If I am not making any sense, please let me know.

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

#13 Post by J. Riesmeier »

1. The "configure" file is created from "configure.in" during the execution of "./autoall". So, this is also a text file. That means, you/we change only the "configure.in" file and then let the "configure" file be created by "autoall".

2. The patch I've referenced in my previous posting only shows the difference between two versions, where the first version is not identical to the official release version (i.e. DCMTK 3.6.0). See this page for the history of "configure.in".

3. I guess we have to wait for my colleague Michael to have a look at this, since I personally have no access to a Mac.

coach4ae
Posts: 9
Joined: Wed, 2011-09-07, 02:59
Location: United States

#14 Post by coach4ae »

If there is something you would like me to test on my Mac in the interim, please let me know. I will continue to monitor this post.

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

#15 Post by J. Riesmeier »

You could also check whether CMake works on your system (if you've installed this package).

So, start with a freshly unpacked DCMTK source code package (e.g. ~/dcmtk-3.6.0). Then create a new build directory (e.g. ~/dcmtk-build) and change to this directory (cd ~/dcmtk-build). Then call "cmake ../dcmtk-3.6.0" in this build directory. And finally, call "make". Maybe, this is easier and works out-of-the-box ... :)

However, please note the following note from the INSTALL file:

Code: Select all

NOTE: Starting with DCMTK 3.6.0, CMake can also be used for non-Windows
      systems.  However, this is not (yet) the recommended way since this
      mechanism is not as mature and stable as the above described approach
      using GNU autoconf.  Please feel free to test it and report any issue.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest