Skip to content

Fix gcc-15 paths

Fix gcc-15 paths #189

name: CMake Build
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, macos-latest ]
build_type: [ Debug, Release ]
c_compiler: [ clang ]
include:
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
env:
LDFLAGS=: "-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++"
CPPFLAGS: "-I/opt/homebrew/opt/llvm/include -I/opt/homebrew/opt/llvm/include/c++/v1"
LD_LIBRARY_PATH: "/opt/homebrew/opt/llvm/lib"
DYLD_LIBRARY_PATH: "/opt/homebrew/opt/llvm/lib"
- os: ubuntu-24.04
c_compiler: clang
cpp_compiler: clang++-18
# Don't include the following configurations in the matrix
exclude:
- os: macos-latest
build_type: Debug
steps:
# Install dependencies: cmake, ninja, gcc, libgcrypt, openssl, readline, and libsodium
- name: Install Dependencies
if: matrix.os == 'macos-latest'
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=TRUE
brew update
brew install ninja gmp isl libmpc mpfr zstd
brew reinstall llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/opt/homebrew/opt/gcc/lib/gcc/14:$PATH"' >> ~/.bash_profile
- name: Build GCC From Source
if: matrix.os == 'macos-latest'
run: |
git clone https://github.com/iains/gcc-darwin-arm64.git
cd gcc-darwin-arm64
mkdir build && cd build
../configure --prefix=/opt/homebrew/opt/gcc \
--libdir=/opt/homebrew/opt/gcc/lib/gcc/current \
--disable-nls --enable-checking=release \
--with-gcc-major-version-only \
--enable-languages=c,c++,objc,obj-c++,fortran \
--program-suffix=-15 --with-gmp=/opt/homebrew/opt/gmp \
--with-mpfr=/opt/homebrew/opt/mpfr \
--with-mpc=/opt/homebrew/opt/libmpc \
--with-isl=/opt/homebrew/opt/isl \
--with-zstd=/opt/homebrew/opt/zstd \
--with-pkgversion='Draco\'s GCC 15.0.0' \
--with-system-zlib --build=aarch64-apple-darwin23 \
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
make -j 4
sudo make install
- name: Check configuration
run: |
echo "GCC: $(which /opt/homebrew/opt/gcc/bin/gcc-15)"
echo "Other Glibc: $(/opt/homebrew/opt/gcc/bin/gcc-15 -print-file-name=libstdc++.dylib)"
echo "GCC INCLUDES: $(/opt/homebrew/opt/gcc/bin/gcc-15 -print-search-dirs | grep install)"
echo "GCC LIBS: $(/opt/homebrew/opt/gcc/bin/gcc-15 -print-search-dirs | grep libraries)"
echo "Include dir: $(ls -l /opt/homebrew/opt/gcc/include)"
echo "GCC lib dir: $(ls -l /opt/homebrew/opt/gcc/lib/gcc/current)"
echo "GCC info: $(/opt/homebrew/opt/gcc/bin/gcc-15 -v)"
echo ""
echo "GCC extra info: $(/opt/homebrew/opt/gcc/bin/gcc-15 -v -x c++ /dev/null -o /dev/null)"
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# Build the project
- name: Build PrivacyShield
if: matrix.os == 'ubuntu-24.04'
run: |
sudo ./scripts/build.sh
- name: Install Blake3
if: matrix.os == 'macos-latest'
run: |
sudo ./scripts/install-blake3.sh ${{ matrix.c_compiler }}
- name: Configure CMake
if: matrix.os == 'macos-latest'
run: >
# export LDFLAGS="-L/usr/local/opt/gcc@13/lib/gcc/13 -Wl,-rpath,/usr/local/opt/gcc@13/lib/gcc/13";
# export CPPFLAGS="-I/usr/local/opt/gcc@13/include/c++/13 -I/usr/local/opt/gcc@13/include/c++/13/x86_64-apple-darwin22";
export LD_LIBRARY_PATH="/opt/homebrew/opt/gcc/lib/gcc/current";
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/gcc/lib/gcc/current";
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang
-DCMAKE_CXX_FLAGS=" -stdlib=libstdc++ -I/opt/homebrew/lib/gcc/current/gcc/aarch64-apple-darwin23/15 -I/opt/homebrew/opt/llvm/include/c++/v1 -I/opt/homebrew/lib/gcc/current/gcc/aarch64-apple-darwin23/15/include -L/opt/homebrew/opt/gcc/lib/gcc/current -Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/current"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }} -G Ninja
- name: Build
if: matrix.os == 'macos-latest'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j 4
- name: Package
if: matrix.os == 'macos-latest' && matrix.build_type == 'Release'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cpack
- name: Package
if: matrix.os == 'ubuntu-24.04' && matrix.build_type == 'Release'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
sudo cpack
sudo chown -R $USER:$USER "${{ github.workspace }}/Packages"
- name: Import GPG Key
if: matrix.build_type == 'Release'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASS }}
trust_level: 5
- name: Sign Package
if: matrix.build_type == 'Release'
working-directory: ${{ github.workspace }}
run: |
for file in Packages/*; do
gpg --batch --status-file ~/gpg_log.txt --passphrase ${{ secrets.GPG_PASS }} --default-key [email protected] \
--pinentry-mode=loopback --detach-sign "$file" || (cat ~/gpg_log.txt && exit 1)
done
#
# # Upload the built artifacts
- name: Upload Artifacts
if: matrix.build_type == 'Release'
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.build_type }}"
path: "${{ github.workspace }}/Packages"
overwrite: true
if-no-files-found: 'warn'