Over the weekend I upgraded my system to Mac OS X 10.8, and now a clean cmake build fails. The error message:> Building C object runtime/libprofile/CMakeFiles/profile_rt-static.dir/CommonProfiling.c.o > cc1: error: unrecognized command line option "-Wcovered-switch-default"The configuration:> Mac OS X 10.8 > CMake 2.8.8 > LLVM tot > Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)Running cmake to generate the make files gives the following output:> -- The C compiler identification is GNU 4.2.1 > -- The CXX compiler identification is Clang 4.0.0 >Diagnosis: cmake is passing "-Wcovered-switch-default" to the c compiler. It also thinks that the c compiler should be gcc, rather than clang. gcc does not support that switch, and fails. Possible solutions: * use clang to compile the C code (note that /usr/bin/cc is clang on this system; why it's picking gcc, I don't know) * Don't pass "-Wcovered-switch-default" to the C compiler. -- Marshall Marshall Clow Idio Software <mailto:mclow.lists at gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki
On Jul 30, 2012, at 10:03 AM, Marshall Clow <mclow.lists at gmail.com> wrote:> Over the weekend I upgraded my system to Mac OS X 10.8, and now a clean cmake build fails. > > The error message: >> Building C object runtime/libprofile/CMakeFiles/profile_rt-static.dir/CommonProfiling.c.o >> cc1: error: unrecognized command line option "-Wcovered-switch-default" > > > The configuration: >> Mac OS X 10.8 >> CMake 2.8.8 >> LLVM tot >> Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn) > > > Running cmake to generate the make files gives the following output: >> -- The C compiler identification is GNU 4.2.1 >> -- The CXX compiler identification is Clang 4.0.0 >> > > Diagnosis: > cmake is passing "-Wcovered-switch-default" to the c compiler. > It also thinks that the c compiler should be gcc, rather than clang. > gcc does not support that switch, and fails. > > Possible solutions: > * use clang to compile the C code (note that /usr/bin/cc is clang on this system; why it's picking gcc, I don't know) > * Don't pass "-Wcovered-switch-default" to the C compiler.A workaround - force use of clang for C compilations: CC=/usr/bin/cc cmake $LLVM/llvm -- Marshall Marshall Clow Idio Software <mailto:mclow.lists at gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki
On 2012-07-30 19:03, Marshall Clow wrote:> Over the weekend I upgraded my system to Mac OS X 10.8, and now a clean cmake build fails. > > The error message: >> Building C object runtime/libprofile/CMakeFiles/profile_rt-static.dir/CommonProfiling.c.o >> cc1: error: unrecognized command line option "-Wcovered-switch-default" > > > The configuration: >> Mac OS X 10.8 >> CMake 2.8.8 >> LLVM tot >> Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn) > > > Running cmake to generate the make files gives the following output: >> -- The C compiler identification is GNU 4.2.1 >> -- The CXX compiler identification is Clang 4.0.0 >> > > Diagnosis: > cmake is passing "-Wcovered-switch-default" to the c compiler. > It also thinks that the c compiler should be gcc, rather than clang. > gcc does not support that switch, and fails. > > Possible solutions: > * use clang to compile the C code (note that /usr/bin/cc is clang on this system; why it's picking gcc, I don't know)This is a problem in CMake; for a C compiler, it always picks a 'gcc' executable in the PATH over a 'cc' executable. See the file /opt/local/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake, where it has: [...] SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc) Maybe this was done, because some systems used to have a bad default cc? Like Solaris? :) I don't think that reasoning is really valid anymore, these days, though. In any case, I usually just add these to the cmake invocation, just to be sure: -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
Dimitry Andric <dimitry at andric.com> writes:> This is a problem in CMake; for a C compiler, it always picks a 'gcc' > executable in the PATH over a 'cc' executable. See the file > /opt/local/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake, where > it has: > > [...] > SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc) > > Maybe this was done, because some systems used to have a bad default cc? > Like Solaris? :) I don't think that reasoning is really valid anymore, > these days, though.I passed your remark to the CMake developers and they swiftly fixed the issue: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27b74445 CMake version 2.8.9 already is in final RC stage, so the change will appear on version 2.8.10. Thanks. [snip]
Maybe Matching Threads
- [LLVMdev] clean CMake build failing (Mac OS X 10.8)
- [LLVMdev] [cfe-dev] 2.6 pre-release2 ready for testing
- [LLVMdev] [cfe-dev] 2.6 pre-release2 ready for testing
- [LLVMdev] [cfe-dev] 2.6 pre-release2 ready for testing
- [LLVMdev] [cfe-dev] 2.6 pre-release2 ready for testing