Last active
July 8, 2024 22:49
-
-
Save stvoidit/6bbded06adcd07ddd26ed53776354688 to your computer and use it in GitHub Desktop.
python 3 compilation with clang-18 and full optimization on ubuntu22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
set -e | |
# llvm-profdata is required for a --enable-optimizations build but could not be found. | |
export PATH="$PATH:/usr/lib/llvm-18/bin/" | |
export CC="clang" | |
export CXX="clang++" | |
export LD="lld" | |
export LLVM=1 | |
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y build-essential gdb lcov pkg-config \ | |
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \ | |
libncurses5-dev libncursesw5-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev \ | |
lzma lzma-dev xz-utils tk-dev uuid-dev zlib1g-dev libnss3-dev libjansson-dev | |
PYVERSION=$1 | |
wget -O - "https://www.python.org/ftp/python/$PYVERSION/Python-$PYVERSION.tar.xz" | tar -C /tmp/ -xJ | |
cd /tmp/Python* | |
./configure LDFLAGS='-fuse-linker-plugin -fuse-ld=lld' --enable-optimizations | |
make autoconf | |
make -j$(nproc) | |
sudo make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment