<div dir="ltr">Here's part of a script I use. It uses a specific version of gcc, but if you follow the pattern, it should give you what you need...<div><br></div><div><div> cd ${local_dir}/build</div><div> cmake -DCMAKE_C_COMPILER=${CLANG_GCC}/bin/gcc \</div><div> -DCMAKE_CXX_COMPILER=${CLANG_GCC}/bin/g++ \</div><div> -DGCC_INSTALL_PREFIX=${CLANG_GCC} \</div><div> -DCMAKE_CXX_LINK_FLAGS="-L${CLANG_GCC}/lib64 -Wl,-rpath,${CLANG_GCC}/lib64" \</div><div> -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \</div><div> -DLLVM_ENABLE_ASSERTIONS=ON \</div><div> -DCMAKE_BUILD_TYPE="Release" \</div><div> -DLLVM_TARGETS_TO_BUILD="X86" \</div><div> ../llvm-${version}.src \</div><div> -GNinja || die "cmake failed"</div><div> ${NINJA} -j16 -v || die "ninja failed"</div><div> exit</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 9, 2015 at 1:55 PM, Greg Stark via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Try as I might I can't seem to get LLVM to bulid using clang/clang++.<br>
No matter what I do it insists on using /usr/bin/cc and /usr/bin/c++<br>
which are gcc. Am I missing something obvious? I vaguely remember some<br>
document describing a stage1 compiler built by your old toolchain and<br>
a stage2 compiler but I can't find the steps to do that any more.<br>
<br>
<br>
$ CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ cmake<br>
-DCMAKE_BUILD_TYPE=Release -Wno-dev ~/src/llvm<br>
-- Target triple: x86_64-unknown-linux-gnu<br>
-- Native target architecture is X86<br>
-- Threads enabled.<br>
-- Doxygen disabled.<br>
-- Sphinx disabled.<br>
-- Go bindings disabled.<br>
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)<br>
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)<br>
-- OCaml bindings disabled.<br>
-- Building with -fPIC<br>
-- Constructing LLVMBuild project information<br>
-- Targeting AArch64<br>
-- Targeting AMDGPU<br>
-- Targeting ARM<br>
-- Targeting BPF<br>
-- Targeting CppBackend<br>
-- Targeting Hexagon<br>
-- Targeting Mips<br>
-- Targeting MSP430<br>
-- Targeting NVPTX<br>
-- Targeting PowerPC<br>
-- Targeting Sparc<br>
-- Targeting SystemZ<br>
-- Targeting X86<br>
-- Targeting XCore<br>
-- Compiler-RT supported architectures: x86_64<br>
-- Clang version: 3.8.0<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /home/stark/src/llvm-build<br>
$ make CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++<br>
[ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o<br>
[ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APInt.cpp.o<br>
[ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o<br>
[ 0%] Building CXX object<br>
lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o<br>
[ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMWinEH.cpp.o<br>
[ 0%] Building CXX object<br>
lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o<br>
[ 0%] Building CXX object<br>
lib/Support/CMakeFiles/LLVMSupport.dir/BlockFrequency.cpp.o<br>
<br>
And while doing that I ran this and see it's running /usr/bin/c++:<br>
<br>
$ ps auxww | grep LLVMSupp<br>
stark 26435 0.1 0.0 10400 2744 pts/6 S+ 18:50 0:00 make<br>
-f lib/Support/CMakeFiles/LLVMSupport.dir/build.make<br>
lib/Support/CMakeFiles/LLVMSupport.dir/build<br>
stark 26463 0.0 0.0 4328 752 pts/6 S+ 18:50 0:00<br>
/bin/sh -c cd /home/stark/src/llvm-build/lib/Support && /usr/bin/c++<br>
-DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS<br>
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC<br>
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter<br>
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic<br>
-Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor<br>
-Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3<br>
-DNDEBUG -fPIC -I/home/stark/src/llvm-build/lib/Support<br>
-I/home/stark/src/llvm/lib/Support<br>
-I/home/stark/src/llvm-build/include -I/home/stark/src/llvm/include<br>
-fno-exceptions -fno-rtti -o<br>
CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c<br>
/home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp<br>
stark 26464 0.0 0.0 11512 996 pts/6 S+ 18:50 0:00<br>
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS<br>
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC<br>
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter<br>
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic<br>
-Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor<br>
-Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3<br>
-DNDEBUG -fPIC -I/home/stark/src/llvm-build/lib/Support<br>
-I/home/stark/src/llvm/lib/Support<br>
-I/home/stark/src/llvm-build/include -I/home/stark/src/llvm/include<br>
-fno-exceptions -fno-rtti -o<br>
CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c<br>
/home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp<br>
stark 26465 0.0 1.2 88756 48740 pts/6 R+ 18:50 0:00<br>
/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -I<br>
/home/stark/src/llvm-build/lib/Support -I<br>
/home/stark/src/llvm/lib/Support -I /home/stark/src/llvm-build/include<br>
-I /home/stark/src/llvm/include -imultiarch x86_64-linux-gnu<br>
-D_GNU_SOURCE -D GTEST_HAS_RTTI=0 -D _GNU_SOURCE -D<br>
__STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS<br>
-D NDEBUG /home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp -quiet<br>
-dumpbase ARMBuildAttrs.cpp -mtune=generic -march=x86-64<br>
-auxbase-strip CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -O3<br>
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual<br>
-Wno-missing-field-initializers -Wpedantic -Wno-long-long<br>
-Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11<br>
-fvisibility-inlines-hidden -ffunction-sections -fdata-sections -fPIC<br>
-fno-exceptions -fno-rtti -o /tmp/ccTTfqUE.s<br>
stark 26467 0.0 0.0 14452 932 pts/3 S+ 18:50 0:00 grep LLVMSupp<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
greg<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</font></span></blockquote></div><br></div>