diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 86476689..9ae1deae 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -16,13 +16,10 @@ jobs: matrix: include: # Linux with GCC - # - {os: ubuntu-18.04, llvm: '3.9', compiler: gcc} - # - {os: ubuntu-18.04, llvm: '4.0', compiler: gcc} - # - {os: ubuntu-18.04, llvm: '5.0', compiler: gcc} - - {os: ubuntu-18.04, llvm: '6.0', compiler: gcc} - - {os: ubuntu-18.04, llvm: 7, compiler: gcc} - - {os: ubuntu-18.04, llvm: 8, compiler: gcc} - - {os: ubuntu-18.04, llvm: 9, compiler: gcc} + - {os: ubuntu-20.04, llvm: '6.0', compiler: gcc} + - {os: ubuntu-20.04, llvm: 7, compiler: gcc} + - {os: ubuntu-20.04, llvm: 8, compiler: gcc} + - {os: ubuntu-20.04, llvm: 9, compiler: gcc} - {os: ubuntu-20.04, llvm: 10, compiler: gcc} - {os: ubuntu-20.04, llvm: 10, compiler: gcc, type: Debug} # FIXME: Edit when KLEE is rebased to latest upstream. @@ -31,13 +28,10 @@ jobs: - {os: ubuntu-22.04, llvm: 13, compiler: gcc, klee: 'no-klee'} # Linux with Clang - # - {os: ubuntu-18.04, llvm: '3.9', compiler: clang} - # - {os: ubuntu-18.04, llvm: '4.0', compiler: clang} - # - {os: ubuntu-18.04, llvm: '5.0', compiler: clang} - - {os: ubuntu-18.04, llvm: '6.0', compiler: clang} - - {os: ubuntu-18.04, llvm: 7, compiler: clang} - - {os: ubuntu-18.04, llvm: 8, compiler: clang} - - {os: ubuntu-18.04, llvm: 9, compiler: clang} + - {os: ubuntu-20.04, llvm: '6.0', compiler: clang} + - {os: ubuntu-20.04, llvm: 7, compiler: clang} + - {os: ubuntu-20.04, llvm: 8, compiler: clang} + - {os: ubuntu-20.04, llvm: 9, compiler: clang} - {os: ubuntu-20.04, llvm: 10, compiler: clang} - {os: ubuntu-20.04, llvm: 10, compiler: clang, type: Debug} # FIXME: Edit when KLEE is rebased to latest upstream. @@ -52,23 +46,11 @@ jobs: with: submodules: true - # LLVM 7.0.x built by GCC is not ABI compatible with tools built by Clang - # and vice-versa. Therefore, every instance of KLEE ended being killed - # by SIGSEGV. LLVM 7.1 fixes this issue but it never made its way to - # Bionic's official repositories. So let's use the LLVM repos instead. - # - # https://lists.llvm.org/pipermail/llvm-dev/2018-September/126564.html - - name: '[Bionic + LLVM 7.1] Add repositories' - if: matrix.os == 'ubuntu-18.04' && matrix.llvm == 7 - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" - - name: Install dependencies run: | sudo apt update sudo apt install ccache cmake clang-${{matrix.llvm}} \ - llvm-${{matrix.llvm}}-dev libc6-dev-i386 \ + llvm-${{matrix.llvm}}-dev gcc-multilib \ libz3-dev - name: Set environment @@ -100,6 +82,10 @@ jobs: CFLAGS="-shared-libasan $CFLAGS" CXXFLAGS="-shared-libasan $CXXFLAGS" + # Dynamic compiler-rt libraries are not in /usr/lib + tmp="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)" + LD_LIBRARY_PATH="$(dirname "$tmp")" + # Force coloured output CFLAGS="-fcolor-diagnostics $CFLAGS" CXXFLAGS="-fcolor-diagnostics $CXXFLAGS" @@ -119,20 +105,19 @@ jobs: echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV # Set up ccache sudo /usr/sbin/update-ccache-symlinks echo "/usr/lib/ccache" >> $GITHUB_PATH - # Bionic does not create symlinks to versioned clang - sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang-${{matrix.llvm}} - sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang++-${{matrix.llvm}} + # Store the environment echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache" >> $GITHUB_ENV echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV - echo "::set-output name=timestamp::$(date -u -Iseconds)" + echo "timestamp=$(date -u -Iseconds)" >> $GITHUB_OUTPUT - name: Set up ccache uses: actions/cache@v3 @@ -152,11 +137,9 @@ jobs: if: matrix.llvm < 11 run: | if [[ "${{matrix.compiler}}" = "clang" ]]; then - # * libclang_rt.asan-x86_64.so must be loaded as the first library - # * other compiler_rt libraries are not in /usr/lib + # libclang_rt.asan-x86_64.so must be loaded as the first library # See https://systemd.io/TESTING_WITH_SANITIZERS for details. export LD_PRELOAD="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)" - export LD_LIBRARY_PATH="$(dirname $LD_PRELOAD)" else export LD_PRELOAD="$(gcc -print-file-name=libasan.so)" fi diff --git a/build.sh b/build.sh index 4590b612..f088ab9b 100755 --- a/build.sh +++ b/build.sh @@ -831,7 +831,7 @@ if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then pushd predator-${LLVM_VERSION} if [ ! -f cl_build/CMakeCache.txt ]; then - CXX=clang++ ./switch-host-llvm.sh ${ABS_SRCDIR}/llvm-${LLVM_VERSION}/build/${LLVM_CMAKE_CONFIG_DIR} + ./switch-host-llvm.sh ${ABS_SRCDIR}/llvm-${LLVM_VERSION}/build/${LLVM_CMAKE_CONFIG_DIR} fi build || exitmsg "Building Predator" diff --git a/lib/symbioticpy/symbiotic/environment.py b/lib/symbioticpy/symbiotic/environment.py index e201943e..6395d520 100644 --- a/lib/symbioticpy/symbiotic/environment.py +++ b/lib/symbioticpy/symbiotic/environment.py @@ -5,6 +5,8 @@ from . utils import err, dbg from . utils.utils import process_grep +import re + def _vers_are_same(v1, v2): parts1 = v1.split('.') parts2 = v2.split('.') @@ -17,8 +19,11 @@ def _check_clang_in_path(llvm_version): if versline[0] != 0 or len(versline[1]) != 1: return False - parts = versline[1][0].split() - return _vers_are_same(parts[2].decode('utf-8'), llvm_version) + match = re.search(r'\d+\.\d+\.\d+', versline[1][0].decode()) + if match is None: + err('Could not determine the clang version') + + return _vers_are_same(match[0], llvm_version) def _set_symbiotic_environ(tool, env, opts): env.cwd = getcwd() diff --git a/system-build.sh b/system-build.sh index bce94885..f3fb34d4 100755 --- a/system-build.sh +++ b/system-build.sh @@ -166,11 +166,6 @@ mkdir -p $PREFIX/include check() { MISSING="" - if ! curl --version &>/dev/null; then - echo "Need curl to download files" - MISSING="curl" - fi - if ! which true ; then echo "Need 'which' command." MISSING="which" @@ -407,9 +402,7 @@ if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then pushd predator-${LLVM_VERSION} if [ ! -f cl_build/CMakeCache.txt ]; then - which "$LLVM_BIN_DIR/clang++" # plain clang has already been tested above - CC="$LLVM_BIN_DIR/clang" CXX="$LLVM_BIN_DIR/clang++" \ - ./switch-host-llvm.sh "$LLVM_DIR" + ./switch-host-llvm.sh "$LLVM_DIR" fi build || exitmsg "Failed building Predator"