Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#1 Post by Oban »

Hello gents !

I get errors when compiling dcmtk with gcc / msys under Windows and minGw

In msys, in the root folder of dcmtk :
configure :arrow: ok
make all :arrow: fails in compilation of module oflog :

Code: Select all

../include/dcmtk/oflog/config/windowsh.h:155:20: fatal error: intrin.h: No such file or directory
I've read FAQs and the INSTALL file without really finding an explanation I could get @ my level of understanding.
But I found this in CHANGES 361 :
- Don't include intrin.h on Visual Studio 2005 because of build errors.
Affects: oflog/include/dcmtk/oflog/config/win32.h
And I read somewhere that some intrinsecs (proprietary) methods can be used with MSC, but they might not exist, or maybe with another name in gcc, and therefore could eventually the include be forgotten.

Thus I modified for a try win32.h by commenting the define out :

Code: Select all

/* This used to be _MSC_VER >= 1400, but MSVC 2005 is broken */
#if (defined (_MSC_VER) && _MSC_VER > 1400) || defined (__MINGW32__)
//#  define DCMTK_LOG4CPLUS_HAVE_INTRIN_H
#endif
Then

Code: Select all

make clean ; configure ; make all
issues now another error :

Code: Select all

[...]
(cd oflog && make ARCH="" DESTDIR="" all)
make[1]: Entering directory `/h/dev/dcmtk-3.6.1_20140725/oflog'
(cd include && make ARCH="" all)
make[2]: Entering directory `/h/dev/dcmtk-3.6.1_20140725/oflog/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/h/dev/dcmtk-3.6.1_20140725/oflog/include'
(cd libsrc && make ARCH="" all)
make[2]: Entering directory `/h/dev/dcmtk-3.6.1_20140725/oflog/libsrc'
c++     -DHAVE_CONFIG_H -DUSE_NULL_SAFE_OFSTRING -DDCMTK_BUILD_IN_PROGRESS -Doflog_EXPORTS -DNDEBUG  -c -I. -I. -I../include -I../../config/
include -I../../ofstd/include  \
         -O  -Wall  oflog.cc
In file included from oflog.cc:22:0:
../../config/include/dcmtk/config/osconfig.h:1040:19: error: multiple types in one declaration
 #define socklen_t int
                   ^
../../config/include/dcmtk/config/osconfig.h:1040:19: error: declaration does not declare anything [-fpermissive]
make[2]: *** [oflog.o] Error 1
make[2]: Leaving directory `/h/dev/dcmtk-3.6.1_20140725/oflog/libsrc'
make[1]: *** [libsrc-all] Error 2
make[1]: Leaving directory `/h/dev/dcmtk-3.6.1_20140725/oflog'
make: *** [oflog-all] Error 2
I went in the folder dcmtk-3.6.1/oflog and ran from there

Code: Select all

configure
make
:arrow: same last error :?

Well, now that's too much complicated for me.
Did someone already do that kind of compilation with the same chaintool ?
Can someone drive me to achieve the compilation ?
Operating system is Win 7 Pro SP1 EN. gcc 4.8.1 but same issue with a 4.7.x
Thanx for any clue

Edit: updated text and errors gotten with snapshot 20140725
Last edited by Oban on Sun, 2014-08-03, 21:04, edited 1 time in total.

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

Re: Issue regarding compiling dcmtk 3.6.1_20140617 with gcc

#2 Post by J. Riesmeier »

I personally don't use MinGW but since there have been a couple of changes to the DCMTK after the snapshot 3.6.1 (2013-11-14) I would recommend that you give the current development version a try. You can download it from the public git repository: http://git.dcmtk.org/ (there is also a "download snapshot" function in case you don't want to use git).

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140617 with gcc

#3 Post by Oban »

Hello ! I'm already using the June version (cf. The title of the thread)
Edit : now trying 2014-07-31
Last edited by Oban on Sun, 2014-08-03, 21:04, edited 1 time in total.

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

Re: Issue regarding compiling dcmtk 3.6.1_20140617 with gcc

#4 Post by J. Riesmeier »

I thought you were using the previous snapshot because of this definition in your log: -DDCMTK_BUILD_DATE=\"2013-11-14\"

Anyway, there were further changes after the June 2014 snapshot, so I would give the most recent development version a try (before digging further into the code).

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140617 with gcc

#5 Post by Oban »

J. Riesmeier wrote:I thought you were using the previous snapshot because of this definition in your log: -DDCMTK_BUILD_DATE=\"2013-11-14\"

Anyway, there were further changes after the June 2014 snapshot, so I would give the most recent development version a try (before digging further into the code).
Oh well... The last snapshot is the one of June (2014-06-17) that I'm trying. but I must say there's something like a mixture on the PC I tested, because I also have a 3.60 version in another folder. I must have confused.
Starting over I copied the 3.6.1_20140617 in an XP virtual machine, and made the test with minw/gcc 4.6.2 (configure ; make all)
Here are the results :

Code: Select all

[...]
(cd oflog && make ARCH="" DESTDIR="" all)
make[1]: Entering directory `/c/dev/dcmtk-3.6.1_20140617/oflog'
(cd include && make ARCH="" all)
make[2]: Entering directory `/c/dev/dcmtk-3.6.1_20140617/oflog/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/dev/dcmtk-3.6.1_20140617/oflog/include'
(cd libsrc && make ARCH="" all)
make[2]: Entering directory `/c/dev/dcmtk-3.6.1_20140617/oflog/libsrc'
c++     -DHAVE_CONFIG_H [b]-DDCMTK_BUILD_DATE=\"2014-06-17\"[/b] -DUSE_NULL_SAFE_OFSTRING -DDCMTK_BUILD_IN_PROGRESS -Doflog_EXPORTS -DNDE
BUG  -c -I. -I. -I../include -I../../config/include -I../../ofstd/include  \
         -O  -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  oflog.cc
In file included from ../include/dcmtk/oflog/thread/impl/tls.h:45:0,
                 from ../include/dcmtk/oflog/internal/internal.h:59,
                 from oflog.cc:34:
../include/dcmtk/oflog/config/windowsh.h:155:20: [b]fatal error: intrin.h[/b]: No such file or directory
compilation terminated.
make[2]: *** [oflog.o] Error 1
make[2]: Leaving directory `/c/dev/dcmtk-3.6.1_20140617/oflog/libsrc'
make[1]: *** [libsrc-all] Error 2
make[1]: Leaving directory `/c/dev/dcmtk-3.6.1_20140617/oflog'
make: *** [oflog-all] Error 2
Any idea ? Maybe an environment variable to be set ?
I could try to find another shell to run make under Windows, but which one ?

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140617 with gcc

#6 Post by Oban »

OK I understood that the snapshot version from the dcmtk web site is older than the ones on git.
So I tried tonite the 20140724 one, but.... same result when compiling oflog about intrin.h

Note that I was able to almost compile the released version 3.6.0 : at least oflog built but later compilation fails with dcmwlm.
I'm still looking for someone that could counter-test the make under mingw/gcc/msys.
Please help !!!

Edit : I just installed Cygwin which has gcc 4.7.2 and make 4.02.

Code: Select all

configure ; make all of snapshot version 3.6.1_20140617 :
../include/dcmtk/oflog/config/windowsh.h:155:20: fatal error: intrin.h: No such file or directory

Code: Select all

configure ; make all of official released version 3.6.0 :
c++     -DHAVE_CONFIG_H -DUSE_NULL_SAFE_OFSTRING  -DNDEBUG  -c -I. -I. -I../include -I../../config/include -I../../dcmdata/include -I../../dcmnet/include -I../../oflog/include -I../../ofstd/include  \
         -O  -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  wlfsim.cc
In file included from wlfsim.cc:51:0:
../../ofstd/include/dcmtk/ofstd/ofoset.h: In instantiation of 'void OFOrderedSet<T>::Insert(const T&) [with T = OFString]':
wlfsim.cc:476:37:   required from here
../../ofstd/include/dcmtk/ofstd/ofoset.h:149:11: error: 'Resize' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]

Code: Select all

configure ; make all of git snapshot version boxerab/dcmtk 3.6.1_20140725 :
In file included from ../include/dcmtk/oflog/thread/impl/tls.h:45:0,
                 from ../include/dcmtk/oflog/internal/internal.h:59,
                 from oflog.cc:34:
../include/dcmtk/oflog/config/windowsh.h:155:20: fatal error: intrin.h: No such file or directory
Well I'm unlucky. Maybe a gcc or make issue :?:

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#7 Post by Jan Schlamelcher »

I would generally recommend to use CMake with MSYS / MinGW, since we do not plan to support autoconf under Windows and you would have to adapt the configuration scripts on your own (path-names, tochain-files, ...).
Is there anything that prevents you from using CMake?

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#8 Post by Oban »

Thank you for helping.
I just don't know how to use CMake... I thought it was only aimed to prepare for MSVC ?
Is there somewhere a guide to use it for MinGw/Msys/gcc ?

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#9 Post by Jan Schlamelcher »

Have a look at the general CMake howto. The only thing special for beeing used with MinGW is that you need to select MSYS Makefiles as the generator. CMake will then create appropriate makefiles for being used with MSYS, so you can do make all and the likes. CMake will also create the special make target help, which will print all available make targets including the ones for building and running the test-cases.

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#10 Post by Oban »

Well...
CMake with profile Msys issues errors that at first glance in google I'm not able to fix.

Code: Select all

CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file: H:/DEV/Build/dcmtk361/CMakeFiles/3.0.0/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file: H:/DEV/Build/dcmtk361/CMakeFiles/3.0.0/CMakeCXXCompiler.cmake
CMake Error: CMAKE_AR was not found, please set to archive program. 
Inversely, using MinGW profile works, but executing "make" in Msys console does a strange thing but not a compilation starts.
I tried also to run this in a Windows console

Code: Select all

mingw32-make.exe h:\dev\build\dcmtk361\Makefile all
mingw32-make.exe: Nothing to be done for 'h:\dev\build\dcmtk361\Makefile'
mingw32-make.exe: *** No rule to make target 'all'.  Stop.'
Question : I suppose I have to run "configure" before using Cmake :?:

I suppose I'm missing something around the make command.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#11 Post by Jan Schlamelcher »

Don't worry. This means that cmake cant find you make executable which it needs for running configure tests and so on. It's probably not in path or whatever. Just set CMAKE_MAKE_PROGRAM to your make.exe (most likely in C:\MSYS\bin) and you're done.

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#12 Post by Oban »

You're right, there's a make.exe in /MinGW/Msys/1.0/bin, but also there's MinGW's one in /MinGW/bin/mingw32-make.exe !!

Anyway after some trial I understood that :
:arrow: it's no use to declare CMAKE_MAKE_PROGRAM as an environment variable for windows : it doesn't help in this case
:arrow: I need to use "Add entry" in CMake but before I try to do anything formerly, or
:arrow: in Cmake : File / Delete Cache. Quit / restart Cmake / Add entry CMAKE_MAKE_PROGRAM = file path (xxx/MinGW/Msys/1.0/bin) / Configure (in CMake GUI)
:arrow: I found in CMake\share\cmake-3.0\Modules\ this file: CMakeMSYSFindMake.cmake where I could hard set the path to msys ;

Code: Select all

find_program(CMAKE_MAKE_PROGRAM make
  PATHS
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1;Inno Setup: App Path]/bin"
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
  c:/MinGW/msys/1.0/bin /msys/1.0/bin)   <-- it was c:/msys/1.0/bin
mark_as_advanced(CMAKE_MAKE_PROGRAM)
Finally CMake "configure" ran, "generate" was ok. Happy to see that working :D

Now, in Msys I ran make in my build folder from msys console, and there I got the same initial error about intrin.h :(

Code: Select all

Linking CXX static library ../../lib/libofstd.a
[  2%] Built target ofstd
Scanning dependencies of target ofstd_tests
[...]
Scanning dependencies of target oflog
[  4%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/oflog.cc.obj
In file included from H:/DEV/dcmtk-3.6.1_20140731/oflog/include/dcmtk/oflog/thread/impl/tls.h:45:0,
                 from H:/DEV/dcmtk-3.6.1_20140731/oflog/include/dcmtk/oflog/internal/internal.h:59,
                 from h:/DEV/dcmtk-3.6.1_20140731/oflog/libsrc/oflog.cc:34:
H:/DEV/dcmtk-3.6.1_20140731/oflog/include/dcmtk/oflog/config/windowsh.h:155:20: fatal error: intrin.h: No such file or directory
 #include <intrin.h>
                    ^
compilation terminated.
make[2]: *** [oflog/libsrc/CMakeFiles/oflog.dir/oflog.cc.obj] Error 1
make[1]: *** [oflog/libsrc/CMakeFiles/oflog.dir/all] Error 2
make: *** [all] Error 2
[/size]

If I try again with tweaking win32.h (commenting out "define DCMTK_LOG4CPLUS_HAVE_INTRIN_H"), well it goes further (presently 100%) albeit with warnings like

Code: Select all

[ 11%] Building CXX object dcmdata/libsrc/CMakeFiles/dcmdata.dir/dcdict.cc.obj
In file included from h:/DEV/dcmtk-3.6.1_20140731/dcmdata/libsrc/dcdict.cc:23:0:
h:/DEV/dcmtk-3.6.1_20140731/dcmdata/libsrc/dcdict.cc: In member function 'bool DcmDataDictionary::loadExternalDictionaries()':
H:/DEV/Build/dcmtk361/config/include/dcmtk/config/osconfig.h:54:31: warning: unknown escape sequence: '\d' [enabled by default]
 #define DCM_DICT_DEFAULT_PATH "h:\dev\bin/share/dcmtk/dicom.dic"
                               ^
h:/DEV/dcmtk-3.6.1_20140731/dcmdata/libsrc/dcdict.cc:598:15: note: in expansion of macro 'DCM_DICT_DEFAULT_PATH'
         env = DCM_DICT_DEFAULT_PATH;
               ^
[/size] and many others (I'm building the git snapshot of 31 July)

Thank you very much for your hints, it's been one month I tried to guess how to compile dcmtk :oops: Now I'll try to use a library in Eclipse CDT.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#13 Post by Jan Schlamelcher »

I googled your intrin.h error: http://stackoverflow.com/questions/2520 ... -directory. It seems this is an incompatibility between your "MinGW distribution" and DCMTK (similar to what happened here viewtopic.php?f=1&t=3838). I just looked inside my MinGW and it has intrin.h. Please tell me which MinGW you are using so i may try to create a workaround for anyone that does not consider changing to a different MinGW distribution a viable option (possibly including yourself).

Oban
Posts: 19
Joined: Thu, 2014-07-24, 08:14

Re: Issue regarding compiling dcmtk 3.6.1_20140725 with gcc

#14 Post by Oban »

Thank you for that search.
I also initially found this information about intrin.h (with a light understanding of), this is why I comment it out from win32.h;
Concerning my MinGW distribution, it's the "regular" one, installed with their downloader, 32 bits only. I don't know how you could diffenciate a 32 bits version of a 64 bits build, vs. a single 32 bits in make files.

Also, note that your distribution is a 64 bits one, I'm running Win 7 32 bits. I found here that intrin.h seems to be included in the 64 bits version only.

But finally reading your March post reply
[...]
For now i would recommend patching the mentioned occurences of __MINGW64__ to __MINGW32__ in your local dcmtk version. I think it would be a bad idea to apply this fix to the public dcmtk, since it would possibly break the "regular" mingw distribution (although my personal opinion is that this version sucks and you should always use the mingw-w64 distribution, even for 32 bits [QT seems to be agreeing with me in this regard]).
I think i will create a configure test which will detect the right version to use in the near future, so it will work on any mingw distribution then.
I'll try to install a 32bits build of MinGW64 using your link to SourceForge !

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest