Skip to content

Commit

Permalink
Fix some compilation errors on MacOS due to an old SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Nov 16, 2024
1 parent 5bcfe7f commit 47b4dea
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
25 changes: 23 additions & 2 deletions .github/julia/build_tarballs_release.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ using BinaryBuilder, Pkg

haskey(ENV, "UNO_RELEASE") || error("The environment variable UNO_RELEASE is not defined.")
haskey(ENV, "UNO_COMMIT") || error("The environment variable UNO_COMMIT is not defined.")
haskey(ENV, "UNO_URL") || error("The environment variable UNO_URL is not defined.")

name = "Uno"
version = VersionNumber(ENV["UNO_RELEASE"])

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/cvanaret/Uno.git", ENV["UNO_COMMIT"]),
ArchiveSource("https://mumps-solver.org/MUMPS_5.7.3.tar.gz", "84a47f7c4231b9efdf4d4f631a2cae2bdd9adeaabc088261d15af040143ed112")
GitSource(ENV["UNO_URL"], ENV["UNO_COMMIT"]),
ArchiveSource("https://mumps-solver.org/MUMPS_5.7.3.tar.gz",
"84a47f7c4231b9efdf4d4f631a2cae2bdd9adeaabc088261d15af040143ed112"),
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz",
"2408d07df7f324d3beea818585a6d990ba99587c218a3969f924dfcc4de93b62"),
]

# Bash recipe for building across all platforms
Expand Down Expand Up @@ -83,6 +87,23 @@ cd $WORKSPACE/srcdir/Uno
mkdir -p build
cd build
if [[ "${target}" == x86_64-apple-darwin* ]]; then
# Work around the issue
# /workspace/srcdir/Uno/uno/options/Presets.cpp:17:48: error: 'value' is unavailable: introduced in macOS 10.14
# Presets::set(options, optional_preset.value());
# ^
# /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root/usr/include/c++/v1/optional:938:33: note: 'value' has been explicitly marked unavailable here
# constexpr value_type const& value() const&
# ^
export MACOSX_DEPLOYMENT_TARGET=10.15
# ...and install a newer SDK which supports `std::filesystem`
pushd $WORKSPACE/srcdir/MacOSX10.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/."
cp -ra System "/opt/${target}/${target}/sys-root/."
popd
fi
if [[ "${target}" == *mingw* ]]; then
LIBHIGHS=${prefix}/lib/libhighs.dll.a
else
Expand Down
22 changes: 21 additions & 1 deletion .github/julia/build_tarballs_yggdrasil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ haskey(ENV, "UNO_URL") || error("The environment variable UNO_URL is not defined
name = "Uno"
version = VersionNumber(ENV["UNO_RELEASE"])


# Collection of sources required to complete build
sources = [
GitSource(ENV["UNO_URL"], ENV["UNO_COMMIT"])
GitSource(ENV["UNO_URL"], ENV["UNO_COMMIT"]),
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz",
"2408d07df7f324d3beea818585a6d990ba99587c218a3969f924dfcc4de93b62"),
]

# The remainder of the file is similar to the content found at the following link:
Expand All @@ -21,6 +24,23 @@ cd $WORKSPACE/srcdir/Uno
mkdir -p build
cd build
if [[ "${target}" == x86_64-apple-darwin* ]]; then
# Work around the issue
# /workspace/srcdir/Uno/uno/options/Presets.cpp:17:48: error: 'value' is unavailable: introduced in macOS 10.14
# Presets::set(options, optional_preset.value());
# ^
# /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root/usr/include/c++/v1/optional:938:33: note: 'value' has been explicitly marked unavailable here
# constexpr value_type const& value() const&
# ^
export MACOSX_DEPLOYMENT_TARGET=10.15
# ...and install a newer SDK which supports `std::filesystem`
pushd $WORKSPACE/srcdir/MacOSX10.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/."
cp -ra System "/opt/${target}/${target}/sys-root/."
popd
fi
if [[ "${target}" == *mingw* ]]; then
LBT=blastrampoline-5
LIBHIGHS=${prefix}/lib/libhighs.dll.a
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV
echo "UNO_RELEASE=${{ github.ref_name }}" >> $GITHUB_ENV
echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV
echo "UNO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
- name: Cross-compilation of Uno -- x86_64-linux-gnu-cxx11
run: |
julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")'
Expand Down

0 comments on commit 47b4dea

Please sign in to comment.