Skip to content

Commit 42a34e8

Browse files
authored
CI Use conda-forge's openmp in osx to build wheels (#22109)
1 parent f87b5ae commit 42a34e8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

build_tools/github/build_wheels.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,32 @@ set -x
77
if [[ "$RUNNER_OS" == "macOS" ]]; then
88
# Make sure to use a libomp version binary compatible with the oldest
99
# supported version of the macos SDK as libomp will be vendored into the
10-
# scikit-learn wheels for macos. The list of binaries are in
11-
# https://packages.macports.org/libomp/.
10+
# scikit-learn wheels for macos.
11+
1212
if [[ "$CIBW_BUILD" == *-macosx_arm64 ]]; then
1313
# arm64 builds must cross compile because CI is on x64
1414
export PYTHON_CROSSENV=1
1515
# SciPy requires 12.0 on arm to prevent kernel panics
1616
# https://github.com/scipy/scipy/issues/14688
1717
# We use the same deployment target to match SciPy.
1818
export MACOSX_DEPLOYMENT_TARGET=12.0
19-
wget https://packages.macports.org/libomp/libomp-11.0.1_0.darwin_20.arm64.tbz2 -O libomp.tbz2
19+
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2"
2020
else
2121
# Currently, the oldest supported macos version is: High Sierra / 10.13.
2222
# Note that Darwin_17 == High Sierra / 10.13.
2323
export MACOSX_DEPLOYMENT_TARGET=10.13
24-
wget https://packages.macports.org/libomp/libomp-11.0.1_0+universal.darwin_17.i386-x86_64.tbz2 -O libomp.tbz2
24+
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2"
2525
fi
26-
sudo tar -C / -xvjf libomp.tbz2 opt
26+
27+
sudo conda create -n build $OPENMP_URL
28+
PREFIX="/usr/local/miniconda/envs/build"
2729

2830
export CC=/usr/bin/clang
2931
export CXX=/usr/bin/clang++
3032
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
31-
export CFLAGS="$CFLAGS -I/opt/local/include/libomp"
32-
export CXXFLAGS="$CXXFLAGS -I/opt/local/include/libomp"
33-
export LDFLAGS="$LDFLAGS -Wl,-rpath,/opt/local/lib/libomp -L/opt/local/lib/libomp -lomp"
33+
export CFLAGS="$CFLAGS -I$PREFIX/include"
34+
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
35+
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
3436
fi
3537

3638
# The version of the built dependencies are specified

0 commit comments

Comments
 (0)