Skip to content

Instantly share code, notes, and snippets.

@cjameshuff
Created January 1, 2018 00:19
Show Gist options
  • Save cjameshuff/85642de07f2af4e0b21efae6a97b22df to your computer and use it in GitHub Desktop.
Save cjameshuff/85642de07f2af4e0b21efae6a97b22df to your computer and use it in GitHub Desktop.
Clang 5.0 toolchain install
# https://stackoverflow.com/questions/39332406/install-libc-on-ubuntu
# Adapted for Clang 5.0
sudo apt-get update
sudo apt-get install -y clang-5.0 clang-5.0-doc \
libclang-common-5.0-dev libclang-5.0-dev libclang1-5.0 libclang1-5.0-dbg \
libllvm5.0 libllvm5.0-dbg lldb-5.0 llvm-5.0 llvm-5.0-dev llvm-5.0-runtime \
clang-format-5.0 python-clang-5.0 liblldb-5.0-dev lld-5.0 libfuzzer-5.0-dev \
subversion cmake
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-5.0 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-5.0 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-5.0 10
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 20
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.bfd 30
ld --version && echo 3 | sudo update-alternatives --config ld && ld --version
svn co http://llvm.org/svn/llvm-project/libcxx/branches/release_50/ libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/branches/release_50/ libcxxabi
mkdir -p libcxx/build libcxxabi/build
cd libcxx/build
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-5.0\
-DCMAKE_INSTALL_PREFIX=/usr ..
sudo make install
cd ../../libcxxabi/build
CPP_INCLUDE_PATHS=echo | c++ -Wp,-v -x c++ - -fsyntax-only 2>&1 |grep ' /usr'|tr '\n' ' '|tr -s ' ' |tr ' ' ';'
CPP_INCLUDE_PATHS="/usr/include/c++/v1/;$CPP_INCLUDE_PATHS"
cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libstdc++ \
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="$CPP_INCLUDE_PATHS" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_CONFIG_PATH=/usr/bin/llvm-config-5.0 \
-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include ..
sudo make install
cd ../../libcxx/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DLIBCXX_CXX_ABI=libcxxabi -DLLVM_CONFIG_PATH=/usr/bin/llvm-config-5.0\
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include ..
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment