record a build llvm-project-18 and gcc13.1 from source code

llvm-project build script

#!/bin/sh

build_llvm=`pwd`/build-llvm
build_clang=`pwd`/build-clang
#installprefix=`pwd`/install
installprefix=/usr/local
llvm=`pwd`/llvm-project
mkdir -p $build_llvm

#cmake -G Ninja -S $llvm/llvm -B $build_llvm \
#      -DLLVM_INSTALL_UTILS=ON \
#      -DCMAKE_INSTALL_PREFIX=$installprefix \
#      -DCMAKE_BUILD_TYPE=Release \
#      -DLLVM_INCLUDE_TESTS=OFF
#ninja -C $build_llvm install

cmake -G Ninja -S $llvm/clang -B $build_clang \
      -DLLVM_EXTERNAL_LIT=$build_llvm/utils/lit \
      -DLLVM_ROOT=$installprefix \
      -DLLVM_INCLUDE_TESTS=OFF
#ninja -C $build_clang
#or go to build dir and ninja -j16

gcc13.1

# first run ./configure print error
# apt install the error miss deps like lib-dev
./configure #check the print error and using 64-bit only like --disable-multilib
# yes ready setup build
make -j16 #takes a long time
sudo make install
gcc -v

[latest-error]but it does work when I try clang++ and g++ on kubuntu22.04

remove /usr/local everything

你可能感兴趣的:(build,things,from,source,code,学习)