[llvm-dev] Building LLVM and Clang using Clang?

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 9 13:37:22 PDT 2015


I think you can do -DCMAKE_C_COMPILER=... and -DCMAKE_CXX_COMPILER=... with cmake.
I personally like using "ccmake" (comes with every cmake install) which gives you a GUI that lists all options available to a cmake build.

- Matthias

> On Sep 9, 2015, at 10:55 AM, Greg Stark via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Try as I might I can't seem to get LLVM to bulid using clang/clang++.
> No matter what I do it insists on using /usr/bin/cc and /usr/bin/c++
> which are gcc. Am I missing something obvious? I vaguely remember some
> document describing a stage1 compiler built by your old toolchain and
> a stage2 compiler but I can't find the steps to do that any more.
> 
> 
> $ CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++  cmake
> -DCMAKE_BUILD_TYPE=Release -Wno-dev ~/src/llvm
> -- Target triple: x86_64-unknown-linux-gnu
> -- Native target architecture is X86
> -- Threads enabled.
> -- Doxygen disabled.
> -- Sphinx disabled.
> -- Go bindings disabled.
> -- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
> -- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
> -- OCaml bindings disabled.
> -- Building with -fPIC
> -- Constructing LLVMBuild project information
> -- Targeting AArch64
> -- Targeting AMDGPU
> -- Targeting ARM
> -- Targeting BPF
> -- Targeting CppBackend
> -- Targeting Hexagon
> -- Targeting Mips
> -- Targeting MSP430
> -- Targeting NVPTX
> -- Targeting PowerPC
> -- Targeting Sparc
> -- Targeting SystemZ
> -- Targeting X86
> -- Targeting XCore
> -- Compiler-RT supported architectures: x86_64
> -- Clang version: 3.8.0
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/stark/src/llvm-build
> $ make CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++
> [  0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o
> [  0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APInt.cpp.o
> [  0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o
> [  0%] Building CXX object
> lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o
> [  0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMWinEH.cpp.o
> [  0%] Building CXX object
> lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o
> [  0%] Building CXX object
> lib/Support/CMakeFiles/LLVMSupport.dir/BlockFrequency.cpp.o
> 
> And while doing that I ran this and see it's running /usr/bin/c++:
> 
> $ ps auxww | grep LLVMSupp
> stark    26435  0.1  0.0  10400  2744 pts/6    S+   18:50   0:00 make
> -f lib/Support/CMakeFiles/LLVMSupport.dir/build.make
> lib/Support/CMakeFiles/LLVMSupport.dir/build
> stark    26463  0.0  0.0   4328   752 pts/6    S+   18:50   0:00
> /bin/sh -c cd /home/stark/src/llvm-build/lib/Support && /usr/bin/c++
> -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC
> -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter
> -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic
> -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor
> -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3
> -DNDEBUG -fPIC -I/home/stark/src/llvm-build/lib/Support
> -I/home/stark/src/llvm/lib/Support
> -I/home/stark/src/llvm-build/include -I/home/stark/src/llvm/include
> -fno-exceptions -fno-rtti -o
> CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c
> /home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp
> stark    26464  0.0  0.0  11512   996 pts/6    S+   18:50   0:00
> /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC
> -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter
> -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic
> -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor
> -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3
> -DNDEBUG -fPIC -I/home/stark/src/llvm-build/lib/Support
> -I/home/stark/src/llvm/lib/Support
> -I/home/stark/src/llvm-build/include -I/home/stark/src/llvm/include
> -fno-exceptions -fno-rtti -o
> CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c
> /home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp
> stark    26465  0.0  1.2  88756 48740 pts/6    R+   18:50   0:00
> /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -I
> /home/stark/src/llvm-build/lib/Support -I
> /home/stark/src/llvm/lib/Support -I /home/stark/src/llvm-build/include
> -I /home/stark/src/llvm/include -imultiarch x86_64-linux-gnu
> -D_GNU_SOURCE -D GTEST_HAS_RTTI=0 -D _GNU_SOURCE -D
> __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS
> -D NDEBUG /home/stark/src/llvm/lib/Support/ARMBuildAttrs.cpp -quiet
> -dumpbase ARMBuildAttrs.cpp -mtune=generic -march=x86-64
> -auxbase-strip CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -O3
> -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual
> -Wno-missing-field-initializers -Wpedantic -Wno-long-long
> -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11
> -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -fPIC
> -fno-exceptions -fno-rtti -o /tmp/ccTTfqUE.s
> stark    26467  0.0  0.0  14452   932 pts/3    S+   18:50   0:00 grep LLVMSupp
> 
> 
> -- 
> greg
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list