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

Re-enable linux ARM builds for CPython and numpy #1386

Merged
merged 12 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .github/workflows/cpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
25 changes: 21 additions & 4 deletions cpython/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"* ]]
Expand All @@ -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
;;
Expand All @@ -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
;;
Expand Down
14 changes: 7 additions & 7 deletions cpython/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.linux-armhf}</classifier>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.linux-arm64}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
Expand Down Expand Up @@ -136,7 +136,7 @@
<moduleInfoSource>
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;
Expand Down
5 changes: 5 additions & 0 deletions numpy/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
;;
Expand Down
14 changes: 7 additions & 7 deletions numpy/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.linux-armhf}</classifier>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.linux-arm64}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
Expand Down Expand Up @@ -141,7 +141,7 @@
<moduleInfoSource>
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;
Expand Down