MantisBT - CMake
View Issue Details
0013059CMakeCMakepublic2012-03-23 04:572012-10-01 13:22
Flávio J. Saraiva 
Brad King 
normalminorN/A
closedfixed 
CYGWIN_NT-6.1-WOW64
 
 
0013059: No native data type can represent a ??-bit integer.
After doing updates to my Cygwin+Cygwin Ports environment I was going to update cmake from 2.8.5 to 2.8.7.

While building 2.8.7 I got puzzling errors in FundamentalType.h... see http://open.cdash.org/buildSummary.php?buildid=2114265#Stage2 [^] :
In file included from /cygdrive/D/dev/buildslave/My Tests/CMake/Source/kwsys/SystemInformation.cxx:29:
/cygdrive/D/dev/buildslave/My Tests/CMake-build/Source/cmsys/FundamentalType.h:75:3: #error "No native data type can represent a 16-bit integer."
/cygdrive/D/dev/buildslave/My Tests/CMake-build/Source/cmsys/FundamentalType.h:86:3: #error "No native data type can represent a 32-bit integer."
/cygdrive/D/dev/buildslave/My Tests/CMake-build/Source/cmsys/FundamentalType.h:106:3: #error "No native data type can represent a 64-bit integer."

I still had the 2.8.5 version installed and little time. So I started reporting Nightly builds to the dashboard and left it at that.

-----

A few days later I noticed that the versions of gcc and g++ didn't match, so I updated and cmake can build now. (one was 3.4.4 and the other 4.5.3, forgot which was which)
My best guess is that gcc and g++ were disagreeing on the size of short/int/long?...

I suggest adding a test to check if C and CXX compilers are compatible, since cmake seems to assume they are.
No tags attached.
txt CMakeCache.txt (91,521) 2012-03-23 09:49
https://public.kitware.com/Bug/file/4258/CMakeCache.txt
? FundamentalType.h (5,436) 2012-03-23 09:50
https://public.kitware.com/Bug/file/4259/FundamentalType.h
log CMakeError.log (175,030) 2012-03-23 09:51
https://public.kitware.com/Bug/file/4260/CMakeError.log
log CMakeOutput.log (379,443) 2012-03-23 09:51
https://public.kitware.com/Bug/file/4261/CMakeOutput.log
Issue History
2012-03-23 04:57Flávio J. SaraivaNew Issue
2012-03-23 08:46Brad KingNote Added: 0028955
2012-03-23 09:49Flávio J. SaraivaFile Added: CMakeCache.txt
2012-03-23 09:50Flávio J. SaraivaFile Added: FundamentalType.h
2012-03-23 09:51Flávio J. SaraivaFile Added: CMakeError.log
2012-03-23 09:51Flávio J. SaraivaFile Added: CMakeOutput.log
2012-03-23 09:51Flávio J. SaraivaNote Added: 0028956
2012-03-23 09:55Brad KingNote Added: 0028957
2012-03-23 09:59Brad KingNote Added: 0028958
2012-03-23 11:24Flávio J. SaraivaNote Added: 0028959
2012-03-23 12:53Flávio J. SaraivaNote Added: 0028960
2012-04-03 22:32Flávio J. SaraivaNote Added: 0029070
2012-05-03 07:24Brad KingNote Added: 0029393
2012-05-03 07:24Brad KingStatusnew => resolved
2012-05-03 07:24Brad KingResolutionopen => fixed
2012-05-03 07:24Brad KingAssigned To => Brad King
2012-10-01 13:22David ColeNote Added: 0031118
2012-10-01 13:22David ColeStatusresolved => closed

Notes
(0028955)
Brad King   
2012-03-23 08:46   
Something must be going wrong with detection and configuration of the type sizes. Please attach the configured FundamentalType.h, CMakeCache.txt, and CMakeFiles/CMake*.log from the build tree.
(0028956)
Flávio J. Saraiva   
2012-03-23 09:51   
To reproduce the problematic environment I uninstalled all gcc4 packages and then installed gcc4-core. Then on a fresh cmake-2.8.7 did:
$ ./bootstrap
(...snip...)

$ make
(...snip...)

$ gcc --version
gcc (GCC) 4.5.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(0028957)
Brad King   
2012-03-23 09:55   
Okay, so the type size checks are run with the C compiler and end up configuring this in FundamentalType.h:

/* The size of fundamental types. Types that do not exist have size 0. */
#define cmsys_SIZEOF_CHAR 1
#define cmsys_SIZEOF_SHORT __SIZEOF_SHORT__
#define cmsys_SIZEOF_INT __SIZEOF_INT__
#define cmsys_SIZEOF_LONG __SIZEOF_LONG__
#define cmsys_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
#define cmsys_SIZEOF___INT64 0

Then when this is included by the older C++ compiler it does not define the __SIZEOF_*__ macros so they all evaluate to "0" in the later preprocessor tests.
(0028958)
Brad King   
2012-03-23 09:59   
> I suggest adding a test to check if C and CXX compilers are compatible

How might one detect that? The overlap between C and C++ is huge and any tiny detail might mismatch. The incompatibility in this particular case is quite obscure.
(0028959)
Flávio J. Saraiva   
2012-03-23 11:24   
They agree on the size but not the macros... that can happen when the C and CXX compilers don't have the same version or when they have different brands.

In this case incompatibility means a mismatch of macros, so testing for incompatibility means testing if both compilers have the macro before using it.

It's probably safe to assume that they are compatible if their brands and versions match. Using different versions or brands is very rare, but still possible. =~~
(0028960)
Flávio J. Saraiva   
2012-03-23 12:53   
At the very least I expect a warning... I probably wouldn't notice the cause if I didn't start doing Nightly builds for the dashboard. =~~

I'll keep doing Nightly builds with the problematic environment and attach those files as notes. (site=flaviojs.laptop ; build=Cygwin)
(0029070)
Flávio J. Saraiva   
2012-04-03 22:32   
changed build name to Cygwin-gcc4.5.3-g++3.4.4

link for nightly builds: http://open.cdash.org/index.php?project=CMake#Nightly [^]
(0029393)
Brad King   
2012-05-03 07:24   
This commit:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=221b5b69 [^]

removes dependencies on the FundamentalType header causing the reported issue.

Now your dashboard reports that things build all the way until the link step, at which point it fails with:

 undefined reference to `___gxx_personality_sj0'
 undefined reference to `__Unwind_SjLj_Register'
 undefined reference to `__Unwind_SjLj_Resume'
 undefined reference to `__Unwind_SjLj_Unregister'

This comes from incompatible exception handling ABIs used by the (vastly) different versions of gcc and g++. The compilers are in compatible so there is no point in testing the combination.

As I said in 0013059:0028958 it is impossible to detect full compatibility between compilers up front.
(0031118)
David Cole   
2012-10-01 13:22   
Closing resolved issues that have not been updated in more than 4 months.