如何使用非系统gcc构建clang + LLVM

时间:2013-08-04 12:28:36

标签: gcc clang llvm

我正在尝试切换到/usr/local/bin/gcc中的gcc47 +设置。默认系统gcc在/usr/bin/gcc中为4.4.6。

类似的头文件:

/usr/include/c++/4.4.4/bits/stl_pair.h /usr/local/include/c++/4.7.1/bits/stl_pair.h

我尝试使用cd /apps/llvmbuild ; /apps/llvm/configure --prefix=/apps/llvmbuild --enable-optimized --enable-cxx11 --enable-docs=no --enable-targets=host-only --disable-assertions CPPFLAGS=-I/usr/local/include/ CXXFLAGS=-I/usr/local/include/

构建llvm clang

然后 cd /apps/llvmbuild ; make -j12 ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1

但是我收到的错误显示它正在4.4.6目录中搜索c ++文件: /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/exception_ptr.h

locate exception_ptr.h
/usr/include/c++/4.4.4/exception_ptr.h
/usr/local/include/c++/4.7.1/bits/exception_ptr.h

1 个答案:

答案 0 :(得分:1)

使用 CC CXX 环境变量。 有关信息,请参阅configure --help

Some influential environment variables:
  CC          C compiler command
  ...
  CXX         C++ compiler command

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

这样的事情:

CXX=/usr/local/bin/g++ CC=/usr/local/bin/gcc /apps/llvm/configure --your --other --options