diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7ee3f7..62a6f90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,14 @@ jobs: include: - version: '1.10' os: ubuntu-latest - arch: x64 + arch: default - version: '1' os: ubuntu-latest + arch: default + # PENSDP only ships an Intel macOS binary, so pin to an Intel runner + # (macos-latest is arm64; macos-13 is the last native x86_64 image). + - version: '1' + os: macos-13 arch: x64 steps: - uses: actions/checkout@v6 @@ -24,6 +29,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} + force-arch: ${{ matrix['force-arch'] || false }} - uses: julia-actions/cache@v3 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 diff --git a/deps/build.jl b/deps/build.jl index dc406ad..6b4a788 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -70,6 +70,18 @@ function _download_and_extract() return extract_dir end +function _find_macos_gfortran() + for name in ("gfortran", "gfortran-14", "gfortran-13", "gfortran-12", "gfortran-11") + p = Sys.which(name) + p === nothing || return p + end + error( + "No `gfortran` found on PATH. The macOS build needs Homebrew's " * + "gfortran for libquadmath and the libgcc soft-float helpers used " * + "by `libgfortran_mac.a`. Install it with `brew install gcc`.", + ) +end + # Build a shared library that exports the `pensdp` symbol so that it can be # loaded by Julia via `Libdl.dlopen` and called with `ccall`. function _build_shared_library(extract_dir) @@ -94,9 +106,16 @@ function _build_shared_library(extract_dir) elseif os == :apple output = joinpath(LIB_DIR, "libpensdp.dylib") libgfortran_mac = joinpath(lib_src, "libgfortran_mac.a") - cmd = `gcc -dynamiclib -o $(output) + # `libgfortran_mac.a` references libquadmath (`_strtoflt128`, + # `_quadmath_snprintf`, ...) and the libgcc soft-float helpers + # (`___multf3`, `___subtf3`, ...) used for `long double` arithmetic. + # Apple's clang ships neither, so link via Homebrew `gfortran`, which + # adds its own libgcc/libquadmath search paths. + gfortran = _find_macos_gfortran() + cmd = `$(gfortran) -shared -dynamiclib -o $(output) -Wl,-force_load,$(libpensdp_a) $(libgfortran_mac) + -lquadmath -framework Accelerate -lpthread` @info "Linking shared library" cmd