Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX: make fails with unrecognized command line option "-Wcovered-switch-default" #5

Closed
swatanabe opened this issue Feb 20, 2013 · 2 comments
Assignees

Comments

@swatanabe
Copy link

Reverted to cmake 2.8.6, ran the usual cmake and make steps and ran into this:

[ 5%] Building C object lib/Support/CMakeFiles/LLVMSupport.dir/regerror.c.o
cc1: error: unrecognized command line option "-Wcovered-switch-default"
make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/regcomp.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option "-Wcovered-switch-default"
make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/regerror.c.o] Error 1

This failure is reminiscent of a problem recently reported to clang-dev:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-October/024748.html
which resulted in this reply:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-October/024753.html
which states:

this is a guess, but it's possible you're setting the C++
compiler to clang++, but not setting the C compiler to clang.

This appears to be the case.

-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works

And on the system that I'm working on, the various c and c++ paths look like this.

$ for p in gcc g++ llvm-gcc-4.2 llvm-g++-4.2 /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/llvm-g++-4.2 clang clang++ cc c++; do ls -l which $p; done
lrwxr-xr-x 1 root wheel 12 Oct 16 13:44 /usr/bin/gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 12 Oct 16 13:44 /usr/bin/g++ -> llvm-g++-4.2
lrwxr-xr-x 1 root wheel 32 Oct 16 13:44 /usr/bin/llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 32 Oct 16 13:44 /usr/bin/llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
-rwxr-xr-x 1 root wheel 117168 Oct 16 13:44 /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
-rwxr-xr-x 1 root wheel 117168 Oct 16 13:44 /usr/llvm-gcc-4.2/bin/llvm-g++-4.2
-rwxr-xr-x 1 root wheel 21622640 Oct 16 13:44 /usr/bin/clang
lrwxr-xr-x 1 root wheel 5 Oct 16 13:44 /usr/bin/clang++ -> clang
lrwxr-xr-x 1 root wheel 5 Oct 16 13:44 /usr/bin/cc -> clang
lrwxr-xr-x 1 root wheel 7 Oct 16 13:44 /usr/bin/c++ -> clang++

We see that the "C" compiler choice resolves to /usr/bin/gcc (/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2) and the "CXX" compiler resolves to /usr/bin/c++ (clang++).

The question is: what cmake incantation do I need to work around this issue? For example, I'd like to set CC to 'clang'.
Add

Subtasks
Add

Related issues

Issue #
Delay: days Cancel
History
#1

Updated by Gary Funck 3 months ago
Comment

Gary Funck wrote:

The question is: what cmake incantation do I need to work around this issue?
For example, I'd like to set CC to 'clang'.

I think that I found the answer here:
http://www.cmake.org/Wiki/CMake_Useful_Variables

I can set the CC and CXX environment variables when running cmake. Will try that.

@nenadv
Copy link

nenadv commented Mar 4, 2013

I cloned the latest tree of llvm-upc and clang-upc. I was able to pass this point by doing the following on Mac:

CC=/usr/bin/cc CXX=/usr/bin/c++ cmake ../src/llvm

OR

cmake -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++ ../src/llvm

@swatanabe
Copy link
Author

Okay, so I can close this?

@nenadv nenadv closed this as completed Mar 9, 2013
swatanabe pushed a commit that referenced this issue Mar 11, 2013
because it expects a reference and receives a non-l-value.

For example, given:

  int foo(int &);
  template<int x> void b() { foo(x); }

clang will now print "expects an l-value for 1st argument" instead of
"no known conversion from 'int' to 'int &' for 1st argument". The change
in wording (and associated code to detect the case) was prompted by
comment #5 in PR3104, and should be the last bit of work needed for the
bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158691 91177308-0d34-0410-b5e6-96231b3b80d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants