Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scipy] Add platform macosx-arm64 #1516

Merged
merged 18 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions .github/actions/deploy-macosx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,27 @@ runs:
# brew install cmake.rb

if [[ -n ${CI_DEPLOY_NEED_GCC:-} ]]; then
echo Installing an older less buggy version of GCC
brew install gcc@10
brew link --overwrite gcc@10

echo Removing "fixed" header files that are actually broken
sudo rm -Rf $(find /usr/local/Cellar/gcc@10/ -iname include-fixed)

echo Fixing up some binaries to support rpath
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgomp.1.dylib /usr/local/lib/gcc/10/libgomp.1.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libstdc++.6.dylib /usr/local/lib/gcc/10/libstdc++.6.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgfortran.5.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libquadmath.0.dylib /usr/local/lib/gcc/10/libquadmath.0.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib
sudo install_name_tool -change $(otool -L /usr/local/lib/gcc/10/libgfortran.5.dylib | grep /usr/local/Cellar/gcc@10/ | cut -f1 -d ' ') @rpath/libquadmath.0.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgomp.1.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libstdc++.6.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libquadmath.0.dylib
otool -L /usr/local/lib/gcc/10/*.dylib
if [ $(arch) = "arm64" ]; then
brew install gcc@13
brew link --overwrite gcc@13
else
brew install gcc@10
brew link --overwrite gcc@10
echo Removing "fixed" header files that are actually broken
sudo rm -Rf $(find /usr/local/Cellar/gcc@10/ -iname include-fixed)
echo Fixing up some binaries to support rpath
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgomp.1.dylib /usr/local/lib/gcc/10/libgomp.1.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libstdc++.6.dylib /usr/local/lib/gcc/10/libstdc++.6.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgfortran.5.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libquadmath.0.dylib /usr/local/lib/gcc/10/libquadmath.0.dylib
sudo install_name_tool -add_rpath /usr/local/lib/gcc/10/ -add_rpath @loader_path/. -id @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib
sudo install_name_tool -change $(otool -L /usr/local/lib/gcc/10/libgfortran.5.dylib | grep /usr/local/Cellar/gcc@10/ | cut -f1 -d ' ') @rpath/libquadmath.0.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgomp.1.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libstdc++.6.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgfortran.5.dylib
sudo install_name_tool -change /usr/local/lib/gcc/10/libgcc_s.1.dylib @rpath/libgcc_s.1.dylib /usr/local/lib/gcc/10/libquadmath.0.dylib
otool -L /usr/local/lib/gcc/10/*.dylib
fi
saudet marked this conversation as resolved.
Show resolved Hide resolved
fi

sudo install_name_tool -add_rpath @loader_path/. -id @rpath/libomp.dylib `brew ls libomp|grep libomp.dylib`
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/scipy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
macosx-arm64:
runs-on: macos-14
steps:
- uses: HGuillemet/javacpp-presets/.github/actions/deploy-macosx@scipy-macosx-arm64
macosx-x86_64:
runs-on: macos-12
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
- uses: HGuillemet/javacpp-presets/.github/actions/deploy-macosx@scipy-macosx-arm64
# windows-x86:
# runs-on: windows-2019
# steps:
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,7 @@
<module>openblas</module>
<module>cpython</module>
<module>numpy</module>
<module>scipy</module>
<module>llvm</module>
<module>libffi</module>
<module>libpostal</module>
Expand Down
13 changes: 12 additions & 1 deletion scipy/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,18 @@ case $PLATFORM in
ATLAS=None CC="gcc -m64 -D__STDC_NO_THREADS__" FFLAGS="-m64 -fPIC" "$PYTHON_BIN_PATH" -m pip install . --prefix $INSTALL_PATH --config-settings=builddir=build
strip $(find ../ -iname *.so)
;;
macosx-*)
macosx-arm64)
export F77="$(brew ls gcc@13 | grep bin/gfortran | head -n 1)"
export F90="$F77"
export LDFLAGS="-L/usr/lib/"
ATLAS=None FC="$F77" "$PYTHON_BIN_PATH" -m pip install . --prefix $INSTALL_PATH --config-settings=builddir=build
# need to add RPATH so it can find MKL in cache
for f in $(find ../ -iname *.so); do
install_name_tool -add_rpath @loader_path/../../../ -add_rpath @loader_path/../../../../ $f || true;
codesign --force -s - $f
done
;;
macosx-x86_64)
export F77="$(ls -1 /usr/local/bin/gfortran-* | head -n 1)"
export F90="$F77"
export LDFLAGS="-L/usr/lib/"
Expand Down
9 changes: 8 additions & 1 deletion scipy/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down Expand Up @@ -90,7 +96,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-arm64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -140,6 +146,7 @@
// requires static org.bytedeco.${javacpp.moduleId}.linux.ppc64le;
// requires static org.bytedeco.${javacpp.moduleId}.linux.x86;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.arm64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
// requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
Expand Down
Loading