CMake 3.7.2 Error when cross-compiling in Windows 10 32-bit

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
konis
Posts: 28
Joined: Mon, 2015-11-23, 16:05

CMake 3.7.2 Error when cross-compiling in Windows 10 32-bit

#1 Post by konis » Wed, 2017-03-15, 22:55

Hi,

I have encountered a problem running CMake 3.7.0 on dcmtk-3.6.1_20170228 snapshot. I am trying to build 64-bit versions or the DCMTK apps with Visual Studio 2015 Community edition on OS: Windows 10 32-bit. The problem is that I am getting this error in CMake Configure:

CMake Error at CMake/GenerateDCMTKConfigure.cmake:895 (MESSAGE):
Call Stack (most recent call first):
CMakeLists.txt:44 (INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES)

Is there anything I can do to make this go away? Thanks.

- Christos

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

Re: CMake 3.7.2 Error when cross-compiling in Windows 10 32-

#2 Post by Jan Schlamelcher » Thu, 2017-03-16, 10:20

It took me a minute to understand what you are doing, so let me first confirm my current assumptions:
- You are indeed cross-compiling, but not between entirely different systems (Linux -> Windows) but instead (Windows 32bit -> Windows 64bit)
- Did you use a CMake Toolchain file, or specify the compilers manually, that is: does CMake know you are cross-compiling?

Regarding the actual problem: there are two configuration tests that require running an executable to detect some runtime specific behavior:
- C_CHAR_UNSIGNED
- INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES

I presume that CMake cannot run those executables because they are 64 bit and cannot be launched on your 32 bit OS. Normally (if I remember my implementation correctly) CMake should warn about that instead of the cryptic warning you got, but that is (I presume) because you did not tell CMake that it is cross-compiling.

Possible workaround: run those configure tests on a 64 bit Windows host and copy the file "config/include/dcmtk/config/arith.h" into your build directory. Also, explicitly set the resulting CMake cache variable C_CHAR_UNSIGNED according to the results on the native 64 bit host.

I would think that this is not really worth the trouble and using a native 64 bit host instead would be way easier, but I (instead of what everyone else on the internet seems to do) think that you probably have a good reason not to do that, right?

konis
Posts: 28
Joined: Mon, 2015-11-23, 16:05

Re: CMake 3.7.2 Error when cross-compiling in Windows 10 32-

#3 Post by konis » Thu, 2017-03-16, 10:44

Jan,

Thank you for the detailed explanation.

You are correct: I am trying to cross compile between Windows 32bit -> Windows 64bit. I assumed that choosing the Win64 tools for the Generator would be a good hint for CMake in a 32-bit version of Windows.

I just needed the 64-bit versions of the communication tools so I though I could do it in 32-bit Windows. I agree the setting up a 64-bit Windows machine and build the tools there will be the easy way out.

Thanks again.

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

Re: CMake 3.7.2 Error when cross-compiling in Windows 10 32-

#4 Post by Jan Schlamelcher » Thu, 2017-03-16, 11:37

konis wrote:I assumed that choosing the Win64 tools for the Generator would be a good hint for CMake in a 32-bit version of Windows.
Interesting, I agree that this would seem intuitive. Can you provide the value of 'CMAKE_CROSSCOMPILING' in that case by doing

Code: Select all

MESSAGE("CMAKE_CROSSCOMPILING=${CMAKE_CROSSCOMPILING}")
somewhere in the CMake scripts (e.g. dcmtk/CMakeLists.txt).
If it is really not defined, we could ask the CMake developers to add it in case the "Win64 tools for the Generator" was selected on a 32 bit host. If it is defined, however, I'll have to fix it in my code ;-).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest