MantisBT - CMake
View Issue Details
0012992CMakeCMakepublic2012-02-21 14:562012-07-09 06:53
Christopher Sean Morrison 
Rolf Eike Beer 
normalmajoralways
closedfixed 
CMake 2.8.6 
CMake 2.8.8CMake 2.8.8 
0012992: CHECK_C_COMPILER_FLAG broken for icc
It looks like the CHECK_C_COMPILER_FLAG is outright broken for the Intel compiler (icc).

Similar to llvm's C compiler, icc *recognizes* many command-line flags supported by gcc, but it does nothing with them. The compiler outputs a warning during compilation (haven't found a way to turn it into an error) and the compilation proceeds. See the Additional Information for an example using the famliar "-pedantic" gcc flag.

While for most flags, the failed test merely results in flags getting add added that do nothing, from a build system perspective it results in tests passing that should not have. This results in incorrect build system behavior and *excessively* noisy build output for all the various unsupported flags being warned about repeatedly.

One of our compilation modes, for example, puts the compiler into strict standards conformance mode so we can perform source code regression and portability testing. Being able to select the right compilation flags is necessary for that mode to work correctly. With other flags (e.g., -kPIC, -fPIC, etc), you get outright wrong behavior that makes the linker cry when linking against libraries compiled wrong.
STATUS: Performing Test PEDANTIC_COMPILER_FLAG_FOUND
STATUS: Performing Test PEDANTIC_COMPILER_FLAG_FOUND - Success
Performing C SOURCE FILE Test PEDANTIC_COMPILER_FLAG_FOUND succeded with the following output:
Change Dir: /home/morrison/brlcad/.cmake/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/home/morrison/brlcad/.cmake/CMakeFiles/CMakeTmp'
/home/morrison/Applications/bin/cmake -E cmake_progress_report /home/morrison/brlcad/.cmake/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/src.c.o
/opt/intel/bin/icc -DPEDANTIC_COMPILER_FLAG_FOUND -I/usr/local/include -pedantic -o CMakeFiles/cmTryCompileExec.dir/src.c.o -c /home/morrison/brlcad/.cmake/CMakeFiles/CMakeTmp/src.c
icc: command line remark #10148: option '-pedantic' not supported
Linking C executable cmTryCompileExec
/home/morrison/Applications/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/opt/intel/bin/icc -DPEDANTIC_COMPILER_FLAG_FOUND CMakeFiles/cmTryCompileExec.dir/src.c.o -o cmTryCompileExec -rdynamic
gmake[1]: Leaving directory `/home/morrison/brlcad/.cmake/CMakeFiles/CMakeTmp'

Source file was:
int main(void) { return 0; }
No tags attached.
diff icc_patch.diff (2,575) 2012-02-21 16:45
https://public.kitware.com/Bug/file/4232/icc_patch.diff
Issue History
2012-02-21 14:56Christopher Sean MorrisonNew Issue
2012-02-21 16:01Rolf Eike BeerNote Added: 0028692
2012-02-21 16:45Christopher Sean MorrisonNote Added: 0028693
2012-02-21 16:45Christopher Sean MorrisonFile Added: icc_patch.diff
2012-02-21 17:07Rolf Eike BeerNote Added: 0028694
2012-02-21 17:13Rolf Eike BeerNote Added: 0028695
2012-02-21 18:16Christopher Sean MorrisonNote Added: 0028696
2012-02-22 02:32Rolf Eike BeerNote Added: 0028698
2012-02-22 03:10Rolf Eike BeerNote Added: 0028699
2012-02-22 03:10Rolf Eike BeerAssigned To => Rolf Eike Beer
2012-02-22 03:10Rolf Eike BeerStatusnew => assigned
2012-02-22 20:07Christopher Sean MorrisonNote Added: 0028702
2012-02-23 17:19Rolf Eike BeerNote Added: 0028704
2012-02-23 17:19Rolf Eike BeerFixed in Version => CMake 2.8.8
2012-02-23 17:19Rolf Eike BeerTarget Version => CMake 2.8.8
2012-02-23 17:20Rolf Eike BeerStatusassigned => resolved
2012-02-23 17:20Rolf Eike BeerResolutionopen => fixed
2012-07-09 06:53David ColeNote Added: 0029984
2012-07-09 06:53David ColeStatusresolved => closed

Notes
(0028692)
Rolf Eike Beer   
2012-02-21 16:01   
This can easily be fixed by adding a proper regular expression to Modules/CheckCCompilerFlag.cmake and Modules/CheckCXXCompilerFlag.cmake. Sadly mantis seems to have destroyed the output you send. Can you please call icc with a bad flag from command line and attach the output (not paste) so we can figure out the correct expression? Or send a patch?
(0028693)
Christopher Sean Morrison   
2012-02-21 16:45   
The output is munged in the commit e-mail but actually displays correctly through the website. Regardless, a patch is attached. There was one other file that needed the regex too.
(0028694)
Rolf Eike Beer   
2012-02-21 17:07   
Yes, you are correct. I would add the "(hash)10148:" also to the expression. Let's be strict first, we can later relax this if we find it's not enough.
(0028695)
Rolf Eike Beer   
2012-02-21 17:13   
Does this work (Replace (hash) by hash-sign)?

FAIL_REGEX "(hash)10148: option '.*' not supported"
(0028696)
Christopher Sean Morrison   
2012-02-21 18:16   
10148 was but one failure example. A quick search through my logs showed 10149 getting reported for others. Once two were identified, I stopped looking. It was reason enough to keep it general like the other tests.
(0028698)
Rolf Eike Beer   
2012-02-22 02:32   
Ok, thanks for checking. Will push your patch tonight.
(0028699)
Rolf Eike Beer   
2012-02-22 03:10   
If you want the patch to show you as author please add a patch with a From: line, I can't see your email address in Mantis. Otherwise I'll add the patch and note you in the commit log.
(0028702)
Christopher Sean Morrison   
2012-02-22 20:07   
It's a one-liner, no worries.
(0028704)
Rolf Eike Beer   
2012-02-23 17:19   
Fix pushed to next:

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

I omitted the stuff in GenerateExportHeader. I doubt this whole stuff should be in there at all. If it should then there are other things that need to be merged into that anyway.
(0029984)
David Cole   
2012-07-09 06:53   
Closing resolved issues that have not been updated in more than 4 months.