Page MenuHomePhabricator

Current source does not build with CMake 2.8.5
Closed, ResolvedPublic

Description

behaviour: Superbuild of MITK fails with

[ 43%] Built target usResourceCompiler
[ 43%] Building C object Core/Code/CMakeFiles/Mitk.dir/CppMicroServices/src/util/usUncompressResourceData.c.o
cc1: warning: command line option ‘-Woverloaded-virtual’ is valid for C++/ObjC++ but not for C [enabled by default]
cc1: warning: command line option ‘-Wstrict-null-sentinel’ is valid for C++/ObjC++ but not for C [enabled by default]
cc1: error: command line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C [-Werror]
cc1: all warnings being treated as errors

make[5]: * [Core/Code/CMakeFiles/Mitk.dir/CppMicroServices/src/util/usUncompressResourceData.c.o] Error 1
make[4]:
* [Core/Code/CMakeFiles/Mitk.dir/all] Error 2
make[3]: * [all] Error 2
make[2]:
* [CMakeFiles/MITK-build] Error 2
make[1]: * [CMakeFiles/MITK-build.dir/all] Error 2
make:
* [all] Error 2

Event Timeline

muellerm added a subscriber: muellerm.

did some investigation with sascha, found out that the CMake 2.8.

did some investigation with sascha, found out that the CMake 2.8.5 does not restrict the -fvisibility-inlines-hidden flag for C compilers whereas 2.8.7 interprets the resulting warning correctly

Ok, another CMake bug in my opinion: the locale for the compiler call in the test macro is not set to english or "c" or something. My problems in T15003 thus resulted from a German locale and the funny gcc error messages in that case (CMake version was 2.8.10)

Ok, we could fix that on our side, some example code to set and reset the locale can be found in another CMake module:

CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake

We should still report this to CMake ...

(In reply to comment #4)

We should still report this to CMake ...

Just did that: http://public.kitware.com/Bug/view.php?id=14102

It seems the core change request describes only the first step of the solution?!

Ahm, it only describes the changes in my branch affecting the Core directory. These are of course only cosmetic changes.

The other changes in the branch involve copying the CMake CheckC/CXXCompilerFlags.cmake files and applying the patch from the CMake bug report.

Tested successfully with CMake 2.8.4 and a German locale gcc.

[cc2e05]: Merge branch 'bug-14937-fix-compiler-flag-checks'

Merged commits:

2013-04-23 18:49:41 Sascha Zelzer [bc5caa]
Renamed mitkFunctionCheckCompilerFlags2 to mitkFunctionCheckCAndCXXCompilerFlags


2013-04-23 18:48:52 Sascha Zelzer [3ac29d]
Use custom CMake scripts for checking compiler flags.

These scripts were copied from CMake 2.8.10.2 and the "normalizing
locale" patch was applied. This allows us to keep the CMake minimum
version while fixing a couple of bugs related to old CMake scripts.

New remote branch pushed: bug-14937-fix-compiler-flag-checks