svn update then make gives cc1 error: unrecognized command line option '-Wcovered-switch-default'

I just ran svn update:

~/download/llvm/svn/llvm $ svn update
~/download/llvm/svn/llvm/tools/clang $ svn update
~/download/llvm/svn/llvm/tools $ svn co
http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
~/download/llvm/svn/llvm/projects/compiler-rt $ svn update

However, make resulted in:

.
.
.
llvm[1]: Compiling regexec.c for Debug+Asserts build
cc1: error: unrecognized command line option "-Wcovered-switch-default"
/bin/rm: cannot remove
`/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.d.tmp':
No such file or directory
make[1]: ***
[/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.o]
Error 1
make[1]: Leaving directory
`/home/evansl/download/llvm/svn/build/lib/Support'
make: *** [all] Error 1
~/download/llvm/svn/build $

How can this be corrected?

My system is:

uname -a
Linux evansl-desktop 2.6.32-41-generic #90-Ubuntu SMP Tue May 22
11:29:51 UTC 2012 x86_64 GNU/Linux

TIA.

-regards,
Larry

I just ran svn update:

  ~/download/llvm/svn/llvm $ svn update
  ~/download/llvm/svn/llvm/tools/clang $ svn update
  ~/download/llvm/svn/llvm/tools $ svn co
  http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
  ~/download/llvm/svn/llvm/projects/compiler-rt $ svn update

  However, make resulted in:

  .
  .
  .
  llvm[1]: Compiling regexec.c for Debug+Asserts build
  cc1: error: unrecognized command line option "-Wcovered-switch-default"
  /bin/rm: cannot remove

`/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.d.tmp':
  No such file or directory
  make[1]: ***
  [/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.o]
  Error 1
  make[1]: Leaving directory
  `/home/evansl/download/llvm/svn/build/lib/Support'
  make: *** [all] Error 1
  ~/download/llvm/svn/build $

  How can this be corrected?

  My system is:

  uname -a
  Linux evansl-desktop 2.6.32-41-generic #90-Ubuntu SMP Tue May 22
  11:29:51 UTC 2012 x86_64 GNU/Linux

  TIA.

  -regards,
  Larry
SOLVED:

Changed Makefile.config to remove the COVERED_SWITCH_DEFAULT macro,
and now it's working:

  ~/download/llvm/svn/build $ cat Makefile.config|grep switch
  # -Wcovered-switch-default
  #COVERED_SWITCH_DEFAULT = -Wcovered-switch-default
  ~/download/llvm/svn/build $ make
  llvm[0]: Constructing LLVMBuild project information.
  make[1]: Entering directory
`/home/evansl/download/llvm/svn/build/lib/Support'
  llvm[1]: Compiling regexec.c for Debug+Asserts build
  llvm[1]: Compiling system_error.cpp for Debug+Asserts build
  llvm[1]: Building Debug+Asserts Archive Library libLLVMSupport.a

  .
  .
  .

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

-Eli

Thanks Eli.

I've not set anything directly. I did do the configure step:

~/download/llvm/svn/llvm $ cd ..
~/download/llvm/svn $ cd build
~/download/llvm/svn/build $ ls ../llvn/configure
../llvn/configure: No such file or directory
~/download/llvm/svn/build $ ls ../llvm/configure
../llvm/configure
~/download/llvm/svn/build $ ../llvm/configure
checking for clang... no
checking for llvm-gcc... no
checking for gcc... gcc
.
.
.

and maybe that did what you say. Hmmm. This is not the
1st time I've built clang; so, maybe something's left over
from the last build.

Where would I check to see which compiler is being used?

TIA.

-Larry

You can look in config.log for lines starting with CC= and CXX= .

-Eli

Thanks, config.log contains:

CC='gcc'

and:

CXX='clang++'

Okay. I suppose that's theoretically a combination we should support,
but I doubt anyone cares in practice.

What's the output of "which clang" and "which clang++"? Do you have
CC or CXX set in your environment?

-Eli

Thanks Eli.

Here's the info:

evansl@evansl-desktop:~/bin$ echo $CC

evansl@evansl-desktop:~/bin$ echo $CXX

evansl@evansl-desktop:~/bin$ which clang
evansl@evansl-desktop:~/bin$ which clang++
/home/evansl/bin/clang++
evansl@evansl-desktop:~/bin$ ls -l ~/bin/clang++
lrwxrwxrwx 1 evansl evansl 62 Feb 6 2011 /home/evansl/bin/clang++ ->
/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++
evansl@evansl-desktop:~/bin$

Maybe if I made another symlink in ~/bin to
  home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang
everything would work as expected.

  I just ran svn update:

  ~/download/llvm/svn/llvm $ svn update
  ~/download/llvm/svn/llvm/tools/clang $ svn update
  ~/download/llvm/svn/llvm/tools $ svn co
  http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
  ~/download/llvm/svn/llvm/projects/compiler-rt $ svn update

  However, make resulted in:

  .
  .
  .
  llvm[1]: Compiling regexec.c for Debug+Asserts build
  cc1: error: unrecognized command line option "-Wcovered-switch-default"
  /bin/rm: cannot remove

`/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.d.tmp':
  No such file or directory
  make[1]: ***
  [/home/evansl/download/llvm/svn/build/lib/Support/Debug+Asserts/regexec.o]
  Error 1
  make[1]: Leaving directory
  `/home/evansl/download/llvm/svn/build/lib/Support'
  make: *** [all] Error 1
  ~/download/llvm/svn/build $

  How can this be corrected?

  My system is:

  uname -a
  Linux evansl-desktop 2.6.32-41-generic #90-Ubuntu SMP Tue May 22
  11:29:51 UTC 2012 x86_64 GNU/Linux

  TIA.

  -regards,
  Larry
SOLVED:

Changed Makefile.config to remove the COVERED_SWITCH_DEFAULT macro,
and now it's working:

  ~/download/llvm/svn/build $ cat Makefile.config|grep switch
  # -Wcovered-switch-default
  #COVERED_SWITCH_DEFAULT = -Wcovered-switch-default
  ~/download/llvm/svn/build $ make
  llvm[0]: Constructing LLVMBuild project information.
  make[1]: Entering directory
`/home/evansl/download/llvm/svn/build/lib/Support'
  llvm[1]: Compiling regexec.c for Debug+Asserts build
  llvm[1]: Compiling system_error.cpp for Debug+Asserts build
  llvm[1]: Building Debug+Asserts Archive Library libLLVMSupport.a

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

-Eli

Thanks Eli.

I've not set anything directly. I did do the configure step:

~/download/llvm/svn/llvm $ cd ..
~/download/llvm/svn $ cd build
~/download/llvm/svn/build $ ls ../llvn/configure
../llvn/configure: No such file or directory
~/download/llvm/svn/build $ ls ../llvm/configure
../llvm/configure
~/download/llvm/svn/build $ ../llvm/configure
checking for clang... no
checking for llvm-gcc... no
checking for gcc... gcc
.
.
.

and maybe that did what you say. Hmmm. This is not the
1st time I've built clang; so, maybe something's left over
from the last build.

Where would I check to see which compiler is being used?

You can look in config.log for lines starting with CC= and CXX= .

-Eli

Thanks, config.log contains:

CC='gcc'

and:

CXX='clang++'

Okay. I suppose that's theoretically a combination we should support,
but I doubt anyone cares in practice.

What's the output of "which clang" and "which clang++"? Do you have
CC or CXX set in your environment?

-Eli

Thanks Eli.

Here's the info:

evansl@evansl-desktop:~/bin$ echo $CC

evansl@evansl-desktop:~/bin$ echo $CXX

evansl@evansl-desktop:~/bin$ which clang
evansl@evansl-desktop:~/bin$ which clang++
/home/evansl/bin/clang++
evansl@evansl-desktop:~/bin$ ls -l ~/bin/clang++
lrwxrwxrwx 1 evansl evansl 62 Feb 6 2011 /home/evansl/bin/clang++ ->
/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++
evansl@evansl-desktop:~/bin$

Maybe if I made another symlink in ~/bin to
  home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang
everything would work as expected.

Finally finished the build, but got link error at maybe last step:

make[4]: Entering directory `/home/evansl/download/llvm/svn/build/tools/clang/tools/driver'
llvm[4]: Compiling cc1_main.cpp for Debug+Asserts build
llvm[4]: Compiling cc1as_main.cpp for Debug+Asserts build
llvm[4]: Compiling driver.cpp for Debug+Asserts build
llvm[4]: Linking Debug+Asserts executable clang
clang: error: unable to execute command: Killed
clang: error: linker command failed due to signal (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
make[4]: *** [/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang] Error 254
make[4]: Leaving directory `/home/evansl/download/llvm/svn/build/tools/clang/tools/driver'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/home/evansl/download/llvm/svn/build/tools/clang/tools'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/evansl/download/llvm/svn/build/tools/clang'
make[1]: *** [clang/.makeall] Error 2
make[1]: Leaving directory `/home/evansl/download/llvm/svn/build/tools'
make: *** [all] Error 1
~/download/llvm/svn/build $

Maybe the problem is I'm using gcc and clang++, or maybe the last step
is replacing the driver.exe using the driver.exe?

Maybe I should start over by 1st rm'ing the symlink in ~/bin that
points to home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++
then doing a make clean, then a configure specifying prefix that
points to something other than the build directory?

I'd appreciate any suggestions about the best way to proceed.

TIA.

-regards,
Larry

Or you are running out of memory. Especially for a debug build, it can
easily require 2GB or more.

Joerg

I just re-configured and re-made:

/home/evansl/download/llvm/svn/build $ cat my-configure.sh
#!/bin/bash
this_dir=`pwd`
$this_dir/../llvm/configure \
  --prefix=$this_dir/../install
/home/evansl/download/llvm/svn/build $ ./my-configure.sh
checking for clang... no
checking for llvm-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
.
.
.
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml/transforms/ipo'
make[3]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml/transforms'
make[2]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml'
make[1]: Leaving directory `/home/evansl/download/llvm/svn/build/bindings'
llvm[0]: ***** Completed Debug+Asserts Build
llvm[0]: ***** Note: Debug build can be 10 times slower than an
llvm[0]: ***** optimized build. Use make ENABLE_OPTIMIZED=1 to
llvm[0]: ***** make an optimized build. Alternatively you can
llvm[0]: ***** configure with --enable-optimized.
/home/evansl/download/llvm/svn/build $

However, when I tried `make install`, got:

/home/evansl/download/llvm/svn/build $ make install
llvm[0]: Installing include files
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm-c
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm-c/Transforms
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm
.
.
.
llvm[4]: Installing compiler runtime library: linux/asan-i386
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/compiler-rt'
make[4]: Entering directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/libcxx'
/usr/bin/make -C /home/evansl/download/llvm/svn/llvm/projects/libcxx \
    HEADER_DIR=/home/evansl/download/llvm/svn/build/../install/lib
installheaders
make[5]: Entering directory
`/home/evansl/download/llvm/svn/llvm/projects/libcxx'
mkdir -p /home/evansl/download/llvm/svn/build/../install/lib/c++/v1/ext
rsync -r --exclude=".*" --exclude="support" ./include/* \
    /home/evansl/download/llvm/svn/build/../install/lib/c++/v1/
chown -R root:wheel /home/evansl/download/llvm/svn/build/../install/lib/c++
chown: invalid group: `root:wheel'
make[5]: *** [do-installhdrs] Error 1
make[5]: Leaving directory
`/home/evansl/download/llvm/svn/llvm/projects/libcxx'
make[4]: *** [install-local] Error 2
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/libcxx'
make[3]: *** [libcxx/.makeinstall] Error 2
make[3]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime'
make[2]: *** [install] Error 1
make[2]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang'
make[1]: *** [clang/.makeinstall] Error 2
make[1]: Leaving directory `/home/evansl/download/llvm/svn/build/tools'
make: *** [install] Error 1
/home/evansl/download/llvm/svn/build $

There's no group `root:wheel' on my system.
What should be done to fix this?

TIA.

-regards,
Larry

[snip]

I just re-configured and re-made:

I also removed the symlink to clang++ in my ~/bin directory.

/home/evansl/download/llvm/svn/build $ cat my-configure.sh
#!/bin/bash
this_dir=`pwd`
$this_dir/../llvm/configure \
  --prefix=$this_dir/../install
/home/evansl/download/llvm/svn/build $ ./my-configure.sh
checking for clang... no
checking for llvm-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
.
.
.
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml/transforms/ipo'
make[3]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml/transforms'
make[2]: Leaving directory
`/home/evansl/download/llvm/svn/build/bindings/ocaml'
make[1]: Leaving directory `/home/evansl/download/llvm/svn/build/bindings'
llvm[0]: ***** Completed Debug+Asserts Build
llvm[0]: ***** Note: Debug build can be 10 times slower than an
llvm[0]: ***** optimized build. Use make ENABLE_OPTIMIZED=1 to
llvm[0]: ***** make an optimized build. Alternatively you can
llvm[0]: ***** configure with --enable-optimized.
/home/evansl/download/llvm/svn/build $

However, when I tried `make install`, got:

/home/evansl/download/llvm/svn/build $ make install
llvm[0]: Installing include files
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm-c
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm-c/Transforms
llvm[0]: Making install directory
/home/evansl/download/llvm/svn/build/../install/include/./llvm
.
.
.
llvm[4]: Installing compiler runtime library: linux/asan-i386
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/compiler-rt'
make[4]: Entering directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/libcxx'
/usr/bin/make -C /home/evansl/download/llvm/svn/llvm/projects/libcxx \
    HEADER_DIR=/home/evansl/download/llvm/svn/build/../install/lib
installheaders
make[5]: Entering directory
`/home/evansl/download/llvm/svn/llvm/projects/libcxx'
mkdir -p /home/evansl/download/llvm/svn/build/../install/lib/c++/v1/ext
rsync -r --exclude=".*" --exclude="support" ./include/* \
    /home/evansl/download/llvm/svn/build/../install/lib/c++/v1/
chown -R root:wheel /home/evansl/download/llvm/svn/build/../install/lib/c++
chown: invalid group: `root:wheel'
make[5]: *** [do-installhdrs] Error 1
make[5]: Leaving directory
`/home/evansl/download/llvm/svn/llvm/projects/libcxx'
make[4]: *** [install-local] Error 2
make[4]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime/libcxx'
make[3]: *** [libcxx/.makeinstall] Error 2
make[3]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang/runtime'
make[2]: *** [install] Error 1
make[2]: Leaving directory
`/home/evansl/download/llvm/svn/build/tools/clang'
make[1]: *** [clang/.makeinstall] Error 2
make[1]: Leaving directory `/home/evansl/download/llvm/svn/build/tools'
make: *** [install] Error 1
/home/evansl/download/llvm/svn/build $

There's no group `root:wheel' on my system.
What should be done to fix this?

TIA.

-regards,
Larry

In the Makefile:

llvm/projects/libcxx/Makefile, there was this line:

# The do-installhdrs target is also used by clang's runtime/libcxx makefile.
do-installhdrs:
  mkdir -p $(HEADER_DIR)/c++/v1/ext
  rsync -r --exclude=".*" --exclude="support" $(SRCDIRS)/include/* \
    $(HEADER_DIR)/c++/v1/
  chown -R root:wheel $(HEADER_DIR)/c++
  chmod 755 $(HEADER_DIR)/c++/v1
  chmod 644 $(HEADER_DIR)/c++/v1/*
  chmod 755 $(HEADER_DIR)/c++/v1/ext
  chmod 644 $(HEADER_DIR)/c++/v1/ext/*

After removing the chown comand, `make install` worked.
This looks like a bug to me.

-regards,
Larry