I'm building clang from source, but using a gcc 7.2 build that doesn't live in the normal spot. I want the resulting clang++
binary to use this toolchain by default. I tried to do:
$ export GCC_PREFIX=/path/to/gcc/7.2
$ mkdir -p build
$ cd build
$ cmake -G Ninja -DCMAKE_C_COMPILER=${GCC_PREFIX}/bin/gcc \
-DCMAKE_CXX_COMPILER=${GCC_PREFIX}/bin/g++ \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_TARGETS_TO_BUILD=X86 ..
But the resulting build just looks in /usr/include/c++/4.8.5
for standard library includes instead of /path/to/gcc/7.2/include
like I wanted it to (and, as the path suggests, 4.8.5 is a bit old). Is there a way to build clang such that the resulting binary will search the path I want for its include directory?
Note, I know I run the produced binary with --gcc-toolchain=${GCC_PREFIX}
. That works. What I want to do is build that into the binary so I don't have to type it every time.
Just found this. The correct way to do this is to provide
GCC_INSTALL_PREFIX
:That does the right thing. The resulting clang binary behaves as if you provided
--gcc-toolchain=${GCC_PREFIX}
, as desired.