sudo apt update && sudo apt upgradesudo apt install build-essentialsudo apt-get updatesudo apt-get install libssl-dev
mkdir cmake-installcd cmake-install/wget https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1.tar.gztar -xvf cmake-3.27.1.tar.gzcd cmake-3.27.1./bootstrap -- -DCMAKE_BUILD_TYPE:STRING=Releasemakemake installcd / && rm -rf cmake-install
mkdir llvm-installcd llvm-installsudo wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zipsudo gunzip /usr/local/bin/ninja.gzsudo chmod a+x /usr/local/bin/ninjasudo apt-get install software-properties-commonsudo add-apt-repository ppa:deadsnakes/ppasudo apt-get updatesudo apt-get install swig libedit-dev libncurses5-dev libncursesw5-dev liblzma-dev python3.8 libxml2-dev- Follow those instructions to install CUDA.
- Set
CUDA_PATHto your CUDA installation path, e.g./usr/local/cuda-12.2
If this works, thanks to this guy:
- Create some folder as a workspace, say /gcc-install
- Move to that folder
- Run
wget https://github.com/gcc-mirror/gcc/archive/refs/tags/releases/gcc-12.2.0.tar.gz - Extract the thing:
tar -xvf gcc-12.2.0.tar.gz - Navigate to the folder:
cd gcc-releases-gcc-12.2.0 - Run the provided script which downloads and installs prerequisites:
contrib/download_prerequisites - Some guy says some other dependencies might be missing. Run this just to be sure:
sudo apt update && sudo apt install bzip2 flex
- Create a build directory outside this:
cd ~/gcc-install
mkdir build
- Run whatever this is:
../gcc-releases-gcc-12.2.0/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-12.2.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-12.2 - Build it:
make -j 16 - Install it:
sudo make install-strip - Do some more magic:
export PATH=/usr/local/gcc-12.2.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/gcc-12.2.0/lib64:$LD_LIBRARY_PATH
- Let CMake know
export CC=/usr/local/gcc-12.2.0/bin/gcc-12.2
export CXX=/usr/local/gcc-12.2.0/bin/g++-12.2
export FC=/usr/local/gcc-12.2.0/bin/gfortran-12.2
At this point, the build might still fail because the compiler fails to locate the assembler (which is installed as /usr/bin/as). If this is the case, create a symbolic link from gcc's bin folder to /usr/bin/as.
For clang-format and clang-tidy.
sudo apt update && sudo apt install zlib1g-devgit clone https://github.com/llvm/llvm-project.gitcd llvm-project- Check out whichever version you want to use, e.g.
16.0.6:git checkout 7cbf1a2 mkdir buildcmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;cross-project-tests;libclc;lld;lldb;openmp;polly;pstl' -DCMAKE_INSTALL_PREFIX=/usr/local/llvmninja -j 8 -C /llvm-install/llvm-project/build install
Formatting and other help for working with Bazel: