Skip to content

Commit

Permalink
Fix the Conan MacOS build (#1814)
Browse files Browse the repository at this point in the history
For some time now, the CI build on MacOS using the Conan package manager has been broken, because the building of the ICU dependency failed.  This PR fixes this build again.

The background is, that we have to link against a custom (brew installed) standard library, which makes the whole build process a lot more brittle as several flags have to be set manually.
  • Loading branch information
joka921 authored Feb 19, 2025
1 parent 4fa1fea commit b93b101
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
run: |
pip3 install pyaml pyicu
- name: Install conan
run: |
brew install conan@2
- name: Install dependencies
run: |
brew install llvm@16
Expand All @@ -46,27 +49,34 @@ jobs:
echo 'export LDFLAGS="-L/usr/local/opt/llvm@16/lib -L/usr/local/opt/llvm@16/lib/c++ -Wl,-rpath,/usr/local/opt/llvm@16/lib/c++"' >> ~/.bash_profile
echo LDFLAGS="-L/usr/local/opt/llvm@16/lib -L/usr/local/opt/llvm@16/lib/c++ -Wl,-rpath,/usr/local/opt/llvm@16/lib/c++" >> $GITHUB_ENV
echo 'export CPPFLAGS="-I/usr/local/opt/llvm@16/include"' >> ~/.bash_profile
echo CPPFLAGS="/usr/local/opt/llvm@16/include" >> $GITHUB_ENV
echo CPPFLAGS="-I/usr/local/opt/llvm@16/include" >> $GITHUB_ENV
echo 'export CFLAGS="-I/usr/local/opt/llvm@16/include"' >> ~/.bash_profile
echo CFLAGS="-I/usr/local/opt/llvm@16/include" >> $GITHUB_ENV
echo 'export CC="/usr/local/opt/llvm@16/bin/clang"' >> ~/.bash_profile
echo CC="/usr/local/opt/llvm@16/bin/clang" >> $GITHUB_ENV
echo 'export CXX="/usr/local/opt/llvm@16/bin/clang++"' >> ~/.bash_profile
echo CXX="/usr/local/opt/llvm@16/bin/clang++" >> $GITHUB_ENV
source ~/.bash_profile
- name: Print clang version
run: clang++ --version

- name: Cache for conan
uses: actions/cache@v3
env:
cache-name: cache-conan-modules
cache-name: cache-conan-modules-macos-13
with:
path: ~/.conan2
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('conanfile.txt') }}
- name: Create build directory
run: mkdir ${{github.workspace}}/build
- name: Install and run conan
working-directory: ${{github.workspace}}/build
run: >
conan install .. -pr:b=../conanprofiles/clang-16-macos -pr:h=../conanprofiles/clang-16-macos -of=. --build=missing;
run: |
conan install .. -pr:b=../conanprofiles/clang-16-macos -pr:h=../conanprofiles/clang-16-macos -of=. --build=missing
- name: Configure CMake
# For std::ranges::join_view we need the -fexperimental-library flag on libc++16, which on Mac requires to manually tinker with the linking flags.
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DCMAKE_TOOLCHAIN_FILE="$(pwd)/build/conan_toolchain.cmake" -DUSE_PARALLEL=true -DRUN_EXPENSIVE_TESTS=false -DENABLE_EXPENSIVE_CHECKS=true -DCMAKE_CXX_COMPILER=clang++ -DADDITIONAL_COMPILER_FLAGS="-fexperimental-library" -D_NO_TIMING_TESTS=ON -DADDITIONAL_LINKER_FLAGS="-L$(brew --prefix llvm)/lib/c++"
# We currently cannot use the parallel algorithms, as the parallel sort requires a GNU-extension, and we build with `libc++`.
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DCMAKE_TOOLCHAIN_FILE="$(pwd)/build/conan_toolchain.cmake" -DUSE_PARALLEL=false -DRUN_EXPENSIVE_TESTS=false -DENABLE_EXPENSIVE_CHECKS=true -DCMAKE_CXX_COMPILER=clang++ -DADDITIONAL_COMPILER_FLAGS="-fexperimental-library" -D_NO_TIMING_TESTS=ON -DADDITIONAL_LINKER_FLAGS="-L$(brew --prefix llvm)/lib/c++"

- name: Build
# Build your program with the given configuration
Expand Down
2 changes: 1 addition & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[requires]
boost/1.81.0
icu/73.1
icu/76.1
openssl/3.1.1
zstd/1.5.5
# The jemalloc recipe for Conan2 is currently broken, uncomment this line as soon as this is fixed.
Expand Down
3 changes: 3 additions & 0 deletions conanprofiles/clang-16-macos
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=16
os=Macos

[conf]
tools.build:compiler_executables={ "c": "clang", "cpp": "clang++"}
2 changes: 1 addition & 1 deletion test/engine/ExistsJoinTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void testExistsFromIdTable(IdTable left, IdTable right,
// was applied
auto permuteColumns = [](auto& table) {
auto colsView = ad_utility::integerRange(table.numColumns());
std::vector<size_t> permutation;
std::vector<ColumnIndex> permutation;
ql::ranges::copy(colsView, std::back_inserter(permutation));
table.setColumnSubset(permutation);
return permutation;
Expand Down

0 comments on commit b93b101

Please sign in to comment.