Skip to content

Commit

Permalink
Update to llvm 14 (#664)
Browse files Browse the repository at this point in the history
* Build docker with llvm 14
* Add "Free disk space on runner" in publish base env
* Change dwarf to 4 version
  • Loading branch information
ladisgin authored Jan 15, 2024
1 parent f366873 commit 9370dfa
Show file tree
Hide file tree
Showing 32 changed files with 164 additions and 706 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/matrix.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"include": [
{
"DOCKER_TAG": "2023.10.0",
"DOCKER_TAG": "2023.12.0",
"OPERATING_SYSTEM_TAG": "18.04",
"LLVM_VERSION_MAJOR": "10"
"LLVM_VERSION_MAJOR": "14"
}
]
}
11 changes: 11 additions & 0 deletions .github/workflows/publish-base-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand Down
35 changes: 22 additions & 13 deletions docker/Dockerfile_base
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ RUN echo "check_certificate = off" > /etc/wgetrc

# We use C++ 17 for UnitTestBot, it is available in gcc-9; default gcc for ubuntu:18.04 is gcc-7
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt update && apt install -y --no-install-recommends gcc-9 g++-9
# Skip 32bits libs installation before LLVM compilation
RUN apt update && apt install -y --no-install-recommends gcc-9 g++-9 gcc-multilib g++-multilib gcc-9-multilib g++-9-multilib

# Set gcc-9 as default gcc version
RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
RUN sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
RUN sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 100
Expand Down Expand Up @@ -69,29 +70,34 @@ WORKDIR /home/utbot
USER root
ARG LLVM_VERSION_MAJOR
RUN mkdir $UTBOT_ALL/llvm_gold_plugin
COPY building_dependencies/llvm_gold_plugin/plugin-api.h $UTBOT_ALL/llvm_gold_plugin
RUN wget -P $UTBOT_ALL/llvm_gold_plugin https://raw.githubusercontent.com/bminor/binutils-gdb/fd67aa1129fd006ad49ed5ecb2b063705211553a/include/plugin-api.h
RUN git clone --single-branch --branch "release/${LLVM_VERSION_MAJOR}.x" --depth 1 "https://github.com/llvm/llvm-project.git" $UTBOT_ALL/llvm-project
WORKDIR $UTBOT_ALL/llvm-project
RUN mkdir build && cd build \
&& $UTBOT_CMAKE_BINARY \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$UTBOT_INSTALL_DIR \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_BINUTILS_INCDIR=$UTBOT_ALL/llvm_gold_plugin \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_EH=ON \
-DLLVM_TARGETS_TO_BUILD="host" \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libc;libclc;libcxx;libcxxabi;lld;lldb;clang-tools-extra" -G "Ninja" ../llvm \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_ENABLE_PROJECTS="clang;libclc;lld;lldb;clang-tools-extra" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libc;libcxx;libcxxabi" \
-G "Ninja" ../llvm \
&& $UTBOT_CMAKE_BINARY --build . --target install


# Install KLEE dependencies
ENV CURL_CA_BUNDLE=""
RUN sudo -E pip3 install tabulate==0.8.7 \
typing==3.7.4.3 \
lit==0.11.0.post1 \
wllvm==1.3.1

ENV CFLAGS="-gdwarf-4"
ENV CXXFLAGS="-gdwarf-4"

WORKDIR $UTBOT_ALL/llvm-project
RUN mkdir libcxx_build && cd libcxx_build \
&& export CC=wllvm \
Expand Down Expand Up @@ -125,7 +131,7 @@ RUN cd $UTBOT_ALL/grpc && git submodule update --init
RUN cd $UTBOT_ALL/grpc \
&& mkdir -p cmake/build \
&& cd cmake/build \
&& $UTBOT_CMAKE_BINARY -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=$UTBOT_INSTALL_DIR ../.. \
&& $UTBOT_CMAKE_BINARY -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$UTBOT_INSTALL_DIR ../.. \
&& make -j`nproc` \
&& make install \
&& cd $UTBOT_ALL \
Expand Down Expand Up @@ -205,13 +211,16 @@ RUN wget https://github.com/agauniyal/rang/releases/download/v3.1.0/rang.hpp -P
COPY building_dependencies/runtime_env.sh /home/utbot/.bashrc
COPY building_dependencies/runtime_env.sh /root/.bashrc

# Install uclibc
RUN git clone -b klee_uclibc_v1.2 https://github.com/klee/klee-uclibc.git $UTBOT_ALL/klee-uclibc
WORKDIR $UTBOT_ALL/klee-uclibc
RUN ./configure --make-llvm-lib && make -j`nproc`
# We need to install version 32 and 64 for klee.
# Install uclibc-32
RUN git clone -b klee_uclibc_v1.2 https://github.com/klee/klee-uclibc.git $UTBOT_ALL/klee-uclibc-32
WORKDIR $UTBOT_ALL/klee-uclibc-32
RUN ./configure --make-llvm-lib && make KLEE_CFLAGS="-m32" -j`nproc`

# Install 32bits libs AFTER LLVM compilation
RUN apt update && apt install -y --no-install-recommends gcc-multilib g++-multilib gcc-9-multilib g++-9-multilib
# Install uclibc-64
RUN git clone -b klee_uclibc_v1.2 https://github.com/klee/klee-uclibc.git $UTBOT_ALL/klee-uclibc-64
WORKDIR $UTBOT_ALL/klee-uclibc-64
RUN ./configure --make-llvm-lib && make -j`nproc`

# Download library for access private members
RUN git clone https://github.com/martong/access_private.git $UTBOT_ALL/access_private
Expand Down
2 changes: 1 addition & 1 deletion docker/building_dependencies/clean_release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This script clears out all the unnecessary files from the release build

# Need just clang-10, llvm-cov, llvm-profdata and cmake in $UTBOT_INSTALL_DIR/bin
cd $UTBOT_INSTALL_DIR/bin && find -type f \( -name "*" ! -name "llvm-cov" ! -name "llvm-profdata" ! -name "llvm-nm" ! -name "clang" ! -name "clang++" ! -name "clang-10" ! -name cmake \) -delete
cd $UTBOT_INSTALL_DIR/bin && find -type f \( -name "*" ! -name "llvm-cov" ! -name "llvm-profdata" ! -name "llvm-nm" ! -name "clang" ! -name "clang++" ! -name "clang-14" ! -name cmake \) -delete

# Delete all broken links. Don't need to delete clang which is a link (not broken) to clang-10
find $UTBOT_INSTALL_DIR/bin/ -xtype l -delete
Expand Down
Loading

0 comments on commit 9370dfa

Please sign in to comment.