Install/compile with mingw32

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
gzhang
Posts: 50
Joined: Wed, 2015-09-02, 09:24

Install/compile with mingw32

#1 Post by gzhang »

Hi,

I have a problem installing the lastest snapshot dcmtk-3.6.1-20150629 with mingw32. My system is

Window 7 64-bit; mingw thread model: win32; gcc version 4.8.1; CMake 3.3.1

I got the following errors in the step of "configure" already:

CMake Error at CMake/GenerateDCMTKConfigure.cmake:781 (MESSAGE):
Change Dir:
D:/dcmtk/dcmtk-3.6.1-20150629-mingw32-4.8.1/CMakeTmp/Arith/CMakeFiles/CMakeTmp

Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_2d303/fast"

C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_2d303.dir\build.make
CMakeFiles/cmTC_2d303.dir/build

mingw32-make.exe[1]: Entering directory
'D:/dcmtk/dcmtk-3.6.1-20150629-mingw32-4.8.1/CMakeTmp/Arith/CMakeFiles/CMakeTmp'

Building CXX object CMakeFiles/cmTC_2d303.dir/arith.cc.obj

C:\MinGW\bin\g++.exe
-I"D:/dcmtk/dcmtk-3.6.1-20150629-mingw32-4.8.1/config/include"
-I"D:/dcmtk/dcmtk-3.6.1_20150629/ofstd/include" -o
CMakeFiles\cmTC_2d303.dir\arith.cc.obj -c
D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'void capture(int)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:113:14:
error: '_fpreset' was not declared in this scope

_fpreset();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'void provoke_snan()':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:385:14:
error: there are no arguments to '_clearfp' that depend on a template
parameter, so a declaration of '_clearfp' must be available [-fpermissive]

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:385:14:
note: (if you use '-fpermissive', G++ will accept your code, but allowing
the use of an undeclared name is deprecated)


D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:31:
error: there are no arguments to '_controlfp' that depend on a template
parameter, so a declaration of '_controlfp' must be available
[-fpermissive]

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:36:
error: '_EM_INVALID' was not declared in this scope

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:49:
error: '_MCW_EM' was not declared in this scope

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'int test_snan(std::ostream&, const char*)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:410:14:
error: there are no arguments to '_clearfp' that depend on a template
parameter, so a declaration of '_clearfp' must be available [-fpermissive]

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:31:
error: there are no arguments to '_controlfp' that depend on a template
parameter, so a declaration of '_controlfp' must be available
[-fpermissive]

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:35:
error: '_EM_INVALID' was not declared in this scope

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:48:
error: '_MCW_EM' was not declared in this scope

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'void test_subnormal(std::ostream&, const char*)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:481:14:
error: there are no arguments to '_clearfp' that depend on a template
parameter, so a declaration of '_clearfp' must be available [-fpermissive]

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:17:
error: '_EM_DENORMAL' was not declared in this scope

_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:32:
error: '_EM_UNDERFLOW' was not declared in this scope

_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:48:
error: '_EM_INEXACT' was not declared in this scope


_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:61:
error: '_MCW_EM' was not declared in this scope


_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:69:
error: there are no arguments to '_controlfp' that depend on a template
parameter, so a declaration of '_controlfp' must be available
[-fpermissive]

_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'void test_tinyness_before(std::ostream&, const char*)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:499:14:
error: there are no arguments to '_clearfp' that depend on a template
parameter, so a declaration of '_clearfp' must be available [-fpermissive]

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:511:19:
error: there are no arguments to '_statusfp' that depend on a template
parameter, so a declaration of '_statusfp' must be available
[-fpermissive]

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:511:23:
error: '_EM_UNDERFLOW' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'void test_denorm_loss(std::ostream&, const char*)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:529:14:
error: there are no arguments to '_clearfp' that depend on a template
parameter, so a declaration of '_clearfp' must be available [-fpermissive]

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:540:19:
error: there are no arguments to '_statusfp' that depend on a template
parameter, so a declaration of '_statusfp' must be available
[-fpermissive]

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:540:23:
error: '_EM_UNDERFLOW' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In function
'LONG consume_seh_problems(_EXCEPTION_POINTERS*)':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:558:14:
error: '_fpreset' was not declared in this scope

_fpreset();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:559:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'int test_snan(std::ostream&, const char*) [with T =
float; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:627:54:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:410:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:31:
error: '_controlfp' was not declared in this scope

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:56:
error: '_controlfp' was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:31:
note: '_controlfp' declared here, later in the translation unit

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'int test_snan(std::ostream&, const char*) [with T =
double; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:628:56:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:410:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:31:
error: '_controlfp' was not declared in this scope

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:56:
error: '_controlfp' was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:411:31:
note: '_controlfp' declared here, later in the translation unit

_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_subnormal(std::ostream&, const char*) [with T =
float; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:637:41:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:481:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:69:
error: '_controlfp' was not declared in this scope

_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_subnormal(std::ostream&, const char*) [with T =
double; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:638:43:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:481:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:482:69:
error: '_controlfp' was not declared in this scope

_controlfp( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_tinyness_before(std::ostream&, const char*)
[with T = float; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:642:47:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:499:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:511:19:
error: '_statusfp' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_tinyness_before(std::ostream&, const char*)
[with T = double; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:643:49:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:499:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:511:19:
error: '_statusfp' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_denorm_loss(std::ostream&, const char*) [with T
= float; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:647:43:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:529:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:540:19:
error: '_statusfp' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void test_denorm_loss(std::ostream&, const char*) [with T
= double; std::ostream = std::basic_ostream<char>]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:648:45:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:529:14:
error: '_clearfp' was not declared in this scope

_clearfp()

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:540:19:
error: '_statusfp' was not declared in this scope

_statusfp() & _EM_UNDERFLOW,

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void provoke_snan() [with T = float]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:406:61:
required from 'int test_snan(std::ostream&, const char*) [with T = float;
std::ostream = std::basic_ostream<char>]'

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:627:54:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:385:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:31:
error: '_controlfp' was not declared in this scope

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:57:
error: '_controlfp' was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:31:
note: '_controlfp' declared here, later in the translation unit

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc: In
instantiation of 'void provoke_snan() [with T = double]':

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:406:61:
required from 'int test_snan(std::ostream&, const char*) [with T = double;
std::ostream = std::basic_ostream<char>]'

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:628:56:
required from here

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:385:14:
error: '_clearfp' was not declared in this scope

_clearfp();

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:31:
error: '_controlfp' was not declared in this scope

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:57:
error: '_controlfp' was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

D:\dcmtk\dcmtk-3.6.1_20150629\config\arith.cc:386:31:
note: '_controlfp' declared here, later in the translation unit

_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );

^

CMakeFiles\cmTC_2d303.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_2d303.dir/arith.cc.obj' failed

mingw32-make.exe[1]: *** [CMakeFiles/cmTC_2d303.dir/arith.cc.obj] Error 1

mingw32-make.exe[1]: Leaving directory
'D:/dcmtk/dcmtk-3.6.1-20150629-mingw32-4.8.1/CMakeTmp/Arith/CMakeFiles/CMakeTmp'

Makefile:125: recipe for target 'cmTC_2d303/fast' failed

mingw32-make.exe: *** [cmTC_2d303/fast] Error 2

Call Stack (most recent call first):
CMakeLists.txt:45 (INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES)

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

Re: Install/compile with mingw32

#2 Post by Jan Schlamelcher »

_fpreset() et al. are Microsoft specific floating point functions that should also be available in MinGW (at least our nightly builds are working). The only thing I can imagine is that your version of MinGW is a bit picky regarding the header file they are defined in. Currently either <cfloat> or <float.h> are included, depending on what is available. <cfloat> is preferred if it exists, so I think your MinGW might define those functions only in <float.h>. Try changing the file ofstd/libsrc/ofmath.cc the following way:

Code: Select all

@@ -31,6 +31,7 @@
 #ifdef HAVE_WINDOWS_H
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
+#include <float.h>
 #endif

gzhang
Posts: 50
Joined: Wed, 2015-09-02, 09:24

Re: Install/compile with mingw32

#3 Post by gzhang »

Hi Jan, I have tried a couple of things according to your suggestion:

(1) the snapshot dcmtk-3.6.1-20150629 does NOT contain this file "ofstd/libsrc/ofmath.cc". Instead, I added "#include <float.h>" in a similar place in "config/arith.cc". However, the same error occurs in CMake.

(2) I also downloaded the newest nightly builds dated on "Tue, 1 Sep 2015 13:08:52", where it contains a "ofstd/libsrc/ofmath.cc", and then I added the sentence as you suggested. However, it still doesn't work.

Since neither of them work, I guess it's indeed a problem with "mingw". Probably because you're using a 64-bit mingw instead of 32-bit? Would you mind taking a further look?

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

Re: Install/compile with mingw32

#4 Post by Jan Schlamelcher »

gzhang wrote:(1) the snapshot dcmtk-3.6.1-20150629 does NOT contain this file "ofstd/libsrc/ofmath.cc". Instead, I added "#include <float.h>" in a similar place in "config/arith.cc". However, the same error occurs in CMake.
Sorry, I though I had added this prior to the most recent snapshot. I now remember I only commited it "recently" to fix some problems with Free-/OpenBSD.
gzhang wrote:Since neither of them work, I guess it's indeed a problem with "mingw". Probably because you're using a 64-bit mingw instead of 32-bit? Would you mind taking a further look?
We use both:
  • MinGW-GCC 4.9.1 posix i686-w64-mingw32
  • MinGW-GCC 4.9.1 posix x86_64-w64-mingw32
But as the name implies we use the i686 MinGW from the mingw-w64 "distribution", so their packaging might indeed be different. However, my first guess would be that <cfloat> and <float.h> share the same include guard, so try putting "#include <float.h>" at the very to of the file. If that does not help try searching for "_fpreset" in your MinGW directory and tell me which file defines it.

gzhang
Posts: 50
Joined: Wed, 2015-09-02, 09:24

Re: Install/compile with mingw32

#5 Post by gzhang »

Adding "#include <float.h>" to the very beginning of the file doesn't really help :(
I've checked the "mingw". The "_fpreset" is indeed defined in "mingw/include/float.h" as
void __cdecl __MINGW_NOTHROW _fpreset (void);
void __cdecl __MINGW_NOTHROW fpreset (void);


Given this trouble, would you instead suggesting always using the mingw64 distribution to build 32-bit targets?

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

Re: Install/compile with mingw32

#6 Post by Jan Schlamelcher »

I obviously can't force you to use any specific distribution and also won't want to. But lets say it this way: I've made some good experiences with mingw64 and some bad experiences with the "classic" MinGW in the past. So if someone would ask me for a recommendation, it would be mingw64. However, it would of course be better if we were also able to compile DCMTK with the classic MinGW. Can you perhaps identify some #ifdef macros or like that in your <float.h> that prevent the compiler from using _fpreset at certain settings?

gzhang
Posts: 50
Joined: Wed, 2015-09-02, 09:24

Re: Install/compile with mingw32

#7 Post by gzhang »

thanks Jan for sharing your "experiences" :) It confirms my feeling as well. Here's another piece of information if useful: the current release dcmtk-3.6.0 as well as the snapshot dated on 20140731 have no problem with the classical MinGW at the step of CMake, but still have problems during the actual compiling. In comparison, a mingw64 for 32-bit distribution can easily succeed in both steps for all snapshots that I have tried.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest