dcmtk-3.5.4 on Win32 with gcc 4.4.0

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

dcmtk-3.5.4 on Win32 with gcc 4.4.0

#1 Post by paolom »

Hi,

I try to install dcmtk-3.5.4 on Win32 with MinGw with gcc 4.4.0:

Code: Select all

$ gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32
Thread model: win32
gcc version 4.4.0 (GCC)

and I get these errors during the building:

Code: Select all


make[2]: Entering directory `/c/dcmtk-3.5.4/ofstd/libsrc'
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  oflist.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  ofstring.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  ofcmdln.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  ofconapp.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/Progetti/microprint3/classes/mpDICOM/libdcmtk/zlib/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  offname.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  ofconsol.cc
c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include   \
        -I/c/libpng/include -I/c/zlib/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  ofthread.cc
ofthread.cc: In member function 'int OFThread::start()':
ofthread.cc:142: error: invalid conversion from 'unsigned int' to 'void*'
ofthread.cc: In member function 'bool OFThread::equal(long unsigned int)':
ofthread.cc:198: error: ISO C++ forbids comparison between pointer and integer
make[2]: *** [ofthread.o] Error 1
make[2]: Leaving directory `/c/dcmtk-3.5.4/ofstd/libsrc'
make[1]: *** [libsrc-all] Error 2
make[1]: Leaving directory `/c/dcmtk-3.5.4/ofstd'
make: *** [ofstd-all] Error 2

Before I compile the dcmtk-3.5.4 with gcc 3.4.5 and it works but I need to use this version of gcc (4.4.0)... is it possible to solve these errors?

Thanks

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Did you already check whether the latest DCMTK snapshot works?

fuliwu
Posts: 2
Joined: Sat, 2009-02-28, 04:08

#3 Post by fuliwu »

I download dcmtk 3.5.5(20100723) and use mingw/msys/gcc4.4.0(windows7) to compile.
./configure --build=mingw32
make
I got the following errors:
-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 unixsock.cc
unixsock.cc:34:23: error: arpa/inet.h: No such file or directory
unixsock.cc: In function 'log4cplus::helpers::SOCKET_TYPE log4cplus::helpers::openSocket(short unsigned int, log4cplus::helpers::SocketState&)':
unixsock.cc:147: error: cannot convert 'int*' to 'const char*' for argument '4' to 'int setsockopt(SOCKET, int, int, const char*, int)'
unixsock.cc: In function 'log4cplus::helpers::SOCKET_TYPE log4cplus::helpers::connectSocket(const log4cplus::tstring&, short unsigned int, log4cplus::helpers::SocketState&)':
unixsock.cc:188: warning: comparison between signed and unsigned integer expressions
unixsock.cc: In function 'log4cplus::helpers::SOCKET_TYPE log4cplus::helpers::acceptSocket(log4cplus::helpers::SOCKET_TYPE, log4cplus::helpers::SocketState&)':
unixsock.cc:206: warning: comparison between signed and unsigned integer expressions
make[2]: *** [unixsock.o] Error 1
make[2]: Leaving directory `/c/Users/FuliWu/MedIS/dcmtk-3.5.5_20100723/oflog/libsrc'
make[1]: *** [libsrc-all] Error 2
Could you give me some help? how to fix the problem.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

I have no MINGW system available for testing purposes, but maybe the following patch (for the current snapshot) is of some help:

Code: Select all

diff -u -r1.10 unixsock.cc
--- libsrc/unixsock.cc  5 Aug 2010 08:38:11 -0000       1.10
+++ libsrc/unixsock.cc  12 Aug 2010 08:32:51 -0000
@@ -31,7 +31,10 @@
 # define _XOPEN_SOURCE_EXTENDED
 # endif
 #endif
+
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif

 #ifdef LOG4CPLUS_HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -144,7 +147,7 @@
     server.sin_port = htons(port);

     int optval = 1;
-    setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval) );
+    setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof(optval) );

     if(bind(sock, OFreinterpret_cast(struct sockaddr*, &server), sizeof(server)) < 0) {
         return INVALID_SOCKET;

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

#5 Post by Michael Onken »

Hi,

also you need an extra define in oflog/libsrc/factory.cc. This is the patch:

Code: Select all

diff -u -p -r1.5 factory.cc
--- factory.cc  23 Apr 2010 11:04:48 -0000      1.5
+++ factory.cc  12 Aug 2010 10:36:24 -0000
@@ -156,8 +156,8 @@ void initializeFactoryRegistry()
     REG_APPENDER (reg, RollingFileAppender);
     REG_APPENDER (reg, DailyRollingFileAppender);
     REG_APPENDER (reg, SocketAppender);
-#if defined(_WIN32)
-#  if defined(LOG4CPLUS_HAVE_NT_EVENT_LOG)
+#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(LOG4CPLUS_HAVE_NT_EVENT_LOG)
     REG_APPENDER (reg, NTEventLogAppender);
 #  endif
 #  if defined(LOG4CPLUS_HAVE_WIN32_CONSOLE)
@@ -166,7 +166,7 @@ void initializeFactoryRegistry()
     REG_APPENDER (reg, Win32DebugAppender);
 #elif defined(LOG4CPLUS_HAVE_SYSLOG_H)
     REG_APPENDER (reg, SysLogAppender);
-#endif
+#endif // defined(_WIN32) && !defined(__MINGW32__)

     LayoutFactoryRegistry& reg2 = getLayoutFactoryRegistry();
     REG_LAYOUT (reg2, SimpleLayout);
Then (for me) DCMTK compiles complete with ./configure and make under MINGW. Jörgs and my patch will be in the DCMTK source soon.

Best regards,
Michael

fuliwu
Posts: 2
Joined: Sat, 2009-02-28, 04:08

#6 Post by fuliwu »

great! Thank Jörgs and Michael

Best regards,
Fuli

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest