From bfdd4943b248dc8df1e56c240bacc4640da06b0d Mon Sep 17 00:00:00 2001 From: Branden Butler Date: Tue, 23 Jan 2024 20:13:37 -0600 Subject: [PATCH] * Reenable `linux-arm64` builds for CPython and NumPy (pull #1386) --- .github/workflows/cpython.yml | 10 +++++----- .github/workflows/numpy.yml | 10 +++++----- CHANGELOG.md | 1 + cpython/cppbuild.sh | 25 +++++++++++++++++++++---- cpython/platform/pom.xml | 14 +++++++------- numpy/cppbuild.sh | 5 +++++ numpy/platform/pom.xml | 14 +++++++------- 7 files changed, 51 insertions(+), 28 deletions(-) diff --git a/.github/workflows/cpython.yml b/.github/workflows/cpython.yml index ca3961363ce..94a400cc737 100644 --- a/.github/workflows/cpython.yml +++ b/.github/workflows/cpython.yml @@ -21,10 +21,10 @@ jobs: # runs-on: ubuntu-20.04 # steps: # - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions -# linux-arm64: -# runs-on: ubuntu-20.04 -# steps: -# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions + linux-arm64: + runs-on: ubuntu-20.04 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions # linux-ppc64le: # runs-on: ubuntu-20.04 # steps: @@ -50,7 +50,7 @@ jobs: steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions redeploy: - needs: [linux-x86_64, macosx-x86_64, windows-x86_64] + needs: [linux-arm64, linux-x86_64, macosx-x86_64, windows-x86_64] # needs: [linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64] runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml index 4fbf0144f99..2a9e5b9989e 100644 --- a/.github/workflows/numpy.yml +++ b/.github/workflows/numpy.yml @@ -22,10 +22,10 @@ jobs: # runs-on: ubuntu-20.04 # steps: # - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions -# linux-arm64: -# runs-on: ubuntu-20.04 -# steps: -# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions + linux-arm64: + runs-on: ubuntu-20.04 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions # linux-ppc64le: # runs-on: ubuntu-20.04 # steps: @@ -51,7 +51,7 @@ jobs: steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions redeploy: - needs: [linux-x86_64, macosx-x86_64, windows-x86_64] + needs: [linux-arm64, linux-x86_64, macosx-x86_64, windows-x86_64] # needs: [linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64] runs-on: ubuntu-20.04 steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5725807718e..141840253ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Reenable `linux-arm64` builds for CPython and NumPy ([pull #1386](https://github.com/bytedeco/javacpp-presets/pull/1386) * Enable Vulkan GPU acceleration for FFmpeg ([pull #1460](https://github.com/bytedeco/javacpp-presets/pull/1460)) * Include `timeapi.h` for system API of Windows ([pull #1447](https://github.com/bytedeco/javacpp-presets/pull/1447)) * Add Android and Windows builds to presets for DepthAI ([pull #1441](https://github.com/bytedeco/javacpp-presets/pull/1441)) diff --git a/cpython/cppbuild.sh b/cpython/cppbuild.sh index 02c2ae6f438..310f01e883d 100755 --- a/cpython/cppbuild.sh +++ b/cpython/cppbuild.sh @@ -24,6 +24,9 @@ patch -Np1 --binary < ../../../cpython-windows.patch case $PLATFORM in linux-armhf) + # armhf builds are no longer guaranteed to succeed. + # If they are needed, look at the configure command for arm64 + # and try any options that are missing from here HOST_ARCH="$(uname -m)" CROSSCOMPILE=1 if [[ $HOST_ARCH == *"arm"* ]] @@ -49,12 +52,16 @@ case $PLATFORM in make install_sw make distclean cd ../Python-$CPYTHON_VERSION - ./configure --prefix=$INSTALL_PATH/host --with-system-ffi --with-openssl=$INSTALL_PATH/host + # ac_cv_buggy_getaddrinfo=no disables the runtime ./configure checks for ipv6 support + # Without it, the build fails because it can't detect ipv6 on the host. Needed on both host and cross-compiled builds + ./configure --prefix=$INSTALL_PATH/host --with-system-ffi --with-openssl=$INSTALL_PATH/host ac_cv_buggy_getaddrinfo=no make -j $MAKEJ make install make distclean export PATH=$INSTALL_PATH/host/bin/:$PATH - CC="arm-linux-gnueabihf-gcc -std=c99" ./configure --prefix=$INSTALL_PATH --host=arm-linux-gnueabihf --build=$(uname -m)-pc-linux-gnu --enable-shared --with-system-ffi --with-openssl=$INSTALL_PATH LDFLAGS='-s -Wl,-rpath,\$$ORIGIN/,-rpath,\$$ORIGIN/../,-rpath,\$$ORIGIN/../lib/' --with-build-python=$INSTALL_PATH/host/bin/python3 $INSTALL_PATH/host ac_cv_working_openssl_hashlib=yes ac_cv_working_openssl_ssl=yes + # ac_cv_file__dev_ptmx=yes and ac_cv_file__dev_ptc=no are required for cross-compilation as stated by the configure script, + # but little information is known about them + CC="arm-linux-gnueabihf-gcc -std=c99" ./configure --prefix=$INSTALL_PATH --host=arm-linux-gnueabihf --build=$(uname -m)-pc-linux-gnu --enable-shared --with-system-ffi --with-openssl=$INSTALL_PATH LDFLAGS='-s -Wl,-rpath,\$$ORIGIN/,-rpath,\$$ORIGIN/../,-rpath,\$$ORIGIN/../lib/' --with-build-python=$INSTALL_PATH/host/bin/python3 $INSTALL_PATH/host ac_cv_working_openssl_hashlib=yes ac_cv_working_openssl_ssl=yes ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no make -j $MAKEJ make install ;; @@ -70,12 +77,22 @@ case $PLATFORM in make install_sw make distclean cd ../Python-$CPYTHON_VERSION - ./configure --prefix=$INSTALL_PATH/host --with-system-ffi --with-openssl=$INSTALL_PATH/host + # ac_cv_buggy_getaddrinfo=no disables the runtime ./configure checks for ipv6 support + # Without it, the build fails because it can't detect ipv6 on the host. Needed on both host and cross-compiled builds + ./configure --prefix=$INSTALL_PATH/host --with-system-ffi --with-openssl=$INSTALL_PATH/host ac_cv_buggy_getaddrinfo=no make -j $MAKEJ make install make distclean export PATH=$INSTALL_PATH/host/bin/:$PATH - CC="aarch64-linux-gnu-gcc -mabi=lp64 $CFLAGS" ./configure --prefix=$INSTALL_PATH --host=aarch64-linux-gnu --build=$(uname -m)-pc-linux-gnu --enable-shared --with-system-ffi --with-openssl=$INSTALL_PATH LDFLAGS='-s -Wl,-rpath,\$$ORIGIN/,-rpath,\$$ORIGIN/../,-rpath,\$$ORIGIN/../lib/' --with-build-python=$INSTALL_PATH/host/bin/python3 ac_cv_working_openssl_hashlib=yes ac_cv_working_openssl_ssl=yes + # ac_cv_file__dev_ptmx=yes and ac_cv_file__dev_ptc=no are required for cross-compilation as stated by the configure script, + # but little information is known about them. + # /dev/ptmx is the pseudoterminal master file, reading from it generates a new file descriptor + # to use with a corresponding /dev/pts/ pseudoterminal + # See man 4 ptmx + # No information on /dev/ptc could be found. + # The above configure options specify whether the corresponding device files + # are expected to be found on the target machine. + CC="aarch64-linux-gnu-gcc -mabi=lp64 $CFLAGS" ./configure --prefix=$INSTALL_PATH --host=aarch64-linux-gnu --build=$(uname -m)-pc-linux-gnu --enable-shared --with-system-ffi --with-openssl=$INSTALL_PATH LDFLAGS='-s -Wl,-rpath,\$$ORIGIN/,-rpath,\$$ORIGIN/../,-rpath,\$$ORIGIN/../lib/' --with-build-python=$INSTALL_PATH/host/bin/python3 ac_cv_working_openssl_hashlib=yes ac_cv_working_openssl_ssl=yes ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no make -j $MAKEJ make install ;; diff --git a/cpython/platform/pom.xml b/cpython/platform/pom.xml index fcb3f29a51c..5f38cb158ec 100644 --- a/cpython/platform/pom.xml +++ b/cpython/platform/pom.xml @@ -36,12 +36,12 @@ - - - - - - + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-arm64} + @@ -136,7 +136,7 @@ module org.bytedeco.${javacpp.moduleId}.platform { // requires static org.bytedeco.${javacpp.moduleId}.linux.armhf; -// requires static org.bytedeco.${javacpp.moduleId}.linux.arm64; + requires static org.bytedeco.${javacpp.moduleId}.linux.arm64; // 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; diff --git a/numpy/cppbuild.sh b/numpy/cppbuild.sh index cdfb1943309..7d8c25b5a72 100755 --- a/numpy/cppbuild.sh +++ b/numpy/cppbuild.sh @@ -102,6 +102,9 @@ if ! $PYTHON_BIN_PATH -m pip install --target=$PYTHON_LIB_PATH $TOOLS; then echo "extra_link_args = -lgfortran" >> site.cfg chmod +x "$CPYTHON_HOST_PATH/bin/python3.12" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CPYTHON_HOST_PATH/lib/:$CPYTHON_HOST_PATH" + + # crossenv 1.4 for python 3.11+ support. + # See https://github.com/bytedeco/javacpp-presets/issues/1381 "$CPYTHON_HOST_PATH/bin/python3.12" -m pip install --target="$CPYTHON_HOST_PATH/lib/python3.12/" crossenv==1.4 $TOOLS "$CPYTHON_HOST_PATH/bin/python3.12" -m crossenv "$PYTHON_BIN_PATH" crossenv source crossenv/bin/activate @@ -117,6 +120,8 @@ case $PLATFORM in arm-linux-gnueabihf-strip $(find ../ -iname *.so) ;; linux-arm64) + rm -f meson.build pyproject.toml + mv pyproject.toml.setuppy pyproject.toml ATLAS=None CC="aarch64-linux-gnu-gcc -mabi=lp64" CFLAGS="-O2" "$PYTHON_BIN_PATH" -m pip install . --prefix $INSTALL_PATH aarch64-linux-gnu-strip $(find ../ -iname *.so) ;; diff --git a/numpy/platform/pom.xml b/numpy/platform/pom.xml index 3df444464b9..dd9e5c9083b 100644 --- a/numpy/platform/pom.xml +++ b/numpy/platform/pom.xml @@ -41,12 +41,12 @@ - - - - - - + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-arm64} + @@ -141,7 +141,7 @@ module org.bytedeco.${javacpp.moduleId}.platform { // requires static org.bytedeco.${javacpp.moduleId}.linux.armhf; -// requires static org.bytedeco.${javacpp.moduleId}.linux.arm64; + requires static org.bytedeco.${javacpp.moduleId}.linux.arm64; // 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;