From 9920e5cad5417df999e15ad88ccd66c506d4129e Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 7 Nov 2022 10:45:53 -0800 Subject: [PATCH 1/2] third_party: update googletest to current main Update the pinned revision for googletest to pick up google/googletest#2815 which should allow us to repair the macOS builds. Add dependency tracking to try to avoid a build race with capstone and libbloaty. --- third_party/googletest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/googletest b/third_party/googletest index 565f1b84..96f4ce02 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 565f1b848215b77c3732bca345fe76a0431d8b34 +Subproject commit 96f4ce02a3a78d63981c67acbd368945d11d7d70 From 4c8b4e21d7e8359acdda3830d8003f50776f8656 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 10 Nov 2022 15:28:28 -0800 Subject: [PATCH 2/2] CI: add a workaround for macOS builders on GHA The GHA agents have installed capstone via brew. Unfortunately, the pkg-config data for the bottle provides an include path with an extra component which we cannot reliably strip in the build system. The result is that `capstone/capstone.h` is not found. Explicitly inject an additional header search path from the command line to resolve the header properly. --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a11a053..d72ccf7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: with: path: ${{ github.workspace }}/bloaty - name: configure - run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_FLAGS=${{ matrix.cflags }} -D CMAKE_CXX_FLAGS=${{ matrix.cxxflags }} -G Ninja -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py + run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_FLAGS=${{ matrix.cflags }} -D CMAKE_CXX_FLAGS=${{ matrix.cxxflags }} -G Ninja -S ${{ github.workspace }}/bloaty -D BLOATY_PREFER_SYSTEM_CAPSTONE=NO -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py - name: build run: cmake --build build/bloaty --config Debug - name: test diff --git a/CMakeLists.txt b/CMakeLists.txt index f7636534..5a843b9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ option(BLOATY_ENABLE_UBSAN "Enable undefined behavior sanitizer." OFF) option(BLOATY_ENABLE_CMAKETARGETS "Enable installing cmake target files." ON) option(BLOATY_ENABLE_BUILDID "Enable build id." ON) option(BLOATY_ENABLE_RE2 "Enable the support for regular expression functions." ON) +option(BLOATY_PREFER_SYSTEM_CAPSTONE "Prefer to use the system capstone if available" YES) if(UNIX OR MINGW) find_package(PkgConfig) @@ -21,7 +22,9 @@ find_package(ZLIB) if(BLOATY_ENABLE_RE2) pkg_search_module(RE2 re2) endif() -pkg_search_module(CAPSTONE capstone) +if(BLOATY_PREFER_SYSTEM_CAPSTONE) + pkg_search_module(CAPSTONE capstone) +endif() pkg_search_module(PROTOBUF protobuf) if(BLOATY_ENABLE_RE2) if(RE2_FOUND)