Skip to content

Sanitize the output of llvm-config when building with external LLVM #14663

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

Closed
ghost opened this issue Jun 5, 2014 · 7 comments
Closed

Sanitize the output of llvm-config when building with external LLVM #14663

ghost opened this issue Jun 5, 2014 · 7 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@ghost
Copy link

ghost commented Jun 5, 2014

My LLVM, built with clang:

$ llvm-config --cflags

-I/usr/include -march=native -pipe -O3 -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

Building with gcc:

$ ../configure --llvm-root=/usr --prefix=$HOME/sys && make
<snip>
g++: error: unrecognized command line option ‘-Wcovered-switch-default’
/home/jurily/cucc/src/rust/rust/mk/rustllvm.mk:46: recipe for target 'x86_64-unknown-linux-gnu/rustllvm/RustWrapper.o' failed
make: *** [x86_64-unknown-linux-gnu/rustllvm/RustWrapper.o] Error 1
@steveklabnik steveklabnik added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jan 23, 2015
@tfogal
Copy link

tfogal commented Feb 23, 2015

I am hitting this error message just trying to build Rust:

llvm[2]: Compiling ConvertUTF.c for Debug+Asserts build
gcc: error: unrecognized command line option ‘-Wcovered-switch-default’
/bin/rm: cannot remove ‘/home/tfogal/dev/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Debug+Asserts/ConvertUTF.d.tmp’: No such file or directory
make[2]: *** [/home/tfogal/dev/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Debug+Asserts/ConvertUTF.o] Error 1
make[2]: Leaving directory `/home/tfogal/dev/rust/x86_64-unknown-linux-gnu/llvm/lib/Support'
make[1]: *** [all] Error 1

I configure via:

#!/bin/sh

./configure \
  --disable-docs \
  --disable-optimize-llvm \
  --disable-jemalloc \
  --prefix=${HOME}/sw/ \
  --local-rust-root=${HOME}/sw/ \
  $@

Is there a workaround?

@tamird
Copy link
Contributor

tamird commented Jun 1, 2015

@MagaTailor
Copy link

I updated llvm to 3.7.1 on Slackware current to get rid of this issue but suddenly I'm getting the above-mentioned build error using both gcc 5.3.0 and 4.9..

Did the -Wcovered-switch-default flag get there from building llvm with clang? (yes it did)

$ /mnt/usr/bin/llvm-config --cflags

-I/mnt/usr/include -O2 -march=i586 -mtune=i686 -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -ffunction-sections -fdata-sections -O3 -DNDEBUG  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

@MagaTailor
Copy link

It's about compiling just three C++ files so it's a minor mistake in the build scripts.
The correct logic would clear this flag from llvm-config output in case gcc/g++ is being used to build rustc.

@MagaTailor
Copy link

MagaTailor commented Jun 11, 2016

@retarded_fag @alexcrichton Someone has just got bitten by this again.

@Mark-Simulacrum
Copy link
Member

Okay, to triage this issue a little, I think this is about us using llvm-config's output to generate gcc parameters, which breaks on external LLVM's, since those can get built with different gcc/linker params.

The current situation appears to be unchanged, but cc @brson for confirmation.

@Mark-Simulacrum
Copy link
Member

I don't believe this is a bug anymore, closing -- if someone reproduces, let us know and we'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
Projects
None yet
Development

No branches or pull requests

5 participants