Upgrade llvm version to v18.1.1. #87
This file contains 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
name: libclang-linux-arm | |
on: [push, pull_request] | |
env: | |
LLVM_VER: 18.1.1 | |
concurrency: | |
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build-and-deploy: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: free disk spaces | |
run: | | |
./.github/free-disk-space.sh || true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: install wheel dependencies | |
run: | | |
pip3 install wheel | |
- name: get llvm-project | |
run: | | |
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VER/llvm-project-$LLVM_VER.src.tar.xz | |
tar xf llvm-project-$LLVM_VER.src.tar.xz | |
mv llvm-project-$LLVM_VER.src llvm-project-$LLVM_VER | |
- name: install cross compilation toolchain | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
binutils-arm-linux-gnueabihf \ | |
gcc-8 \ | |
g++-8 \ | |
gcc-8-arm-linux-gnueabihf \ | |
g++-8-arm-linux-gnueabihf | |
- name: build host llvmtblgen/clangtblgen | |
run: | | |
mkdir llvm-project-$LLVM_VER/build-host | |
cd llvm-project-$LLVM_VER/build-host | |
cmake ../llvm \ | |
-DLLVM_ENABLE_PROJECTS=clang \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DLLVM_ENABLE_ZLIB=OFF \ | |
-DLLVM_ENABLE_ZSTD=OFF \ | |
-DLLVM_ENABLE_TERMINFO=OFF \ | |
-DLLVM_TARGETS_TO_BUILD=X86 \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \ | |
-DCMAKE_C_COMPILER=gcc-8 \ | |
-DCMAKE_CXX_COMPILER=g++-8 | |
make clang-tblgen llvm-tblgen -j$(nproc) | |
# copy the artifacts to an absolute path | |
sudo cp ./bin/* /usr/bin/ | |
- name: make build directory | |
run: mkdir -p llvm-project-$LLVM_VER/build | |
- name: cmake | |
run: | | |
cd llvm-project-$LLVM_VER/build | |
cmake ../llvm \ | |
-DLLVM_ENABLE_PROJECTS=clang \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DLLVM_ENABLE_ZLIB=OFF \ | |
-DLLVM_ENABLE_ZSTD=OFF \ | |
-DLLVM_ENABLE_TERMINFO=OFF \ | |
-DCMAKE_SYSTEM_NAME=Linux \ | |
-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \ | |
-DLLVM_TARGET_ARCH=ARM \ | |
-DLLVM_TARGETS_TO_BUILD=ARM \ | |
-DLLVM_TABLEGEN=/usr/bin/llvm-tblgen \ | |
-DCLANG_TABLEGEN=/usr/bin/clang-tblgen \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \ | |
-DCMAKE_C_FLAGS="-march=armv7 -include $(realpath ../../force_glibc_2_17.h)" \ | |
-DCMAKE_CXX_FLAGS="-march=armv7 -include $(realpath ../../force_glibc_2_17.h)" \ | |
-DCMAKE_EXE_LINKER_FLAGS="-lm" \ | |
-DCMAKE_SHARED_LINKER_FLAGS="-lm" \ | |
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc-8 \ | |
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++-8 | |
- name: build | |
run: | | |
cd llvm-project-$LLVM_VER/build | |
make libclang -j$(nproc) | |
arm-linux-gnueabihf-strip lib/libclang.so | |
- name: print dependencies | |
run: | | |
du -csh $(realpath llvm-project-$LLVM_VER/build/lib/libclang.so) | |
file $(realpath llvm-project-$LLVM_VER/build/lib/libclang.so) | |
strings llvm-project-$LLVM_VER/build/lib/libclang.so | grep GLIBC | |
nm --dynamic --undefined-only --with-symbol-versions llvm-project-$LLVM_VER/build/lib/libclang.so | |
- name: create and print sha512sum | |
run: | | |
cd llvm-project-$LLVM_VER/build/lib | |
sha512sum libclang.so > libclang.so.$LLVM_VER.linux-arm.sha512sum | |
echo "Checksum is: " | |
cat libclang.so.$LLVM_VER.linux-arm.sha512sum | |
tar zcvfh libclang.so.$LLVM_VER.linux-arm.tar.gz libclang.so libclang.so.$LLVM_VER.linux-arm.sha512sum | |
shasum -a512 libclang.so.$LLVM_VER.linux-arm.tar.gz | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: libclang.so.${{env.LLVM_VER}}.linux-arm.tar.gz | |
path: llvm-project-${{env.LLVM_VER}}/build/lib/libclang.so.${{env.LLVM_VER}}.linux-arm.tar.gz | |
- name: generate wheel package | |
run: | | |
cp llvm-project-$LLVM_VER/build/lib/libclang.so native/ | |
python3 setup_ext.py bdist_wheel --universal --plat-name=manylinux2014_armv7l | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheel-${{env.LLVM_VER}}-manylinux2014_armv7l | |
path: dist/*.whl | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages_dir: dist/ | |
password: ${{ secrets.PYPI_TOKEN }} | |
verbose: true | |
print_hash: true |