Skip to content

Commit

Permalink
BLD/RLS: add aarch64 linux wheels (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche authored Apr 26, 2023
1 parent 5759f65 commit c4deb39
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2.1

jobs:
linux-aarch64-wheels:
working_directory: ~/linux-aarch64-wheels
machine:
image: ubuntu-2004:2022.04.1
docker_layer_caching: true
# resource_class is what tells CircleCI to use an ARM worker for native arm builds
# https://circleci.com/product/features/resource-classes/
resource_class: arm.medium
environment:
CIBUILDWHEEL: 1
CIBW_BUILD: "cp*-manylinux_aarch64"
steps:
- checkout
- run:
name: Build docker image with GDAL install
command: docker build -f ci/manylinux_2_28_aarch64-vcpkg-gdal.Dockerfile -t manylinux-aarch64-vcpkg-gdal:latest .
- run:
name: Build the Linux aarch64 wheels.
command: |
python3 -m pip install --user cibuildwheel==2.12.1
python3 -m cibuildwheel --output-dir wheelhouse
- run:
name: Test the wheels
command: |
python3 -m pip install -r ci/requirements-wheel-test.txt
python3 -m pip install --no-deps geopandas
python3 -m pip install --pre --find-links wheelhouse pyogrio
python3 -m pip list
cd ..
python3 -c "import pyogrio; print(f'GDAL version: {pyogrio.__gdal_version__}\nGEOS version: {pyogrio.__gdal_geos_version__}')"
python3 -m pytest --pyargs pyogrio.tests -v
- store_artifacts:
path: wheelhouse/

workflows:
wheel-build:
jobs:
- linux-aarch64-wheels:
filters:
branches:
only:
- main
- wheels-linux-aarch64
tags:
only: /.*/
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
### Packaging

- The GDAL library included in the wheels is updated from 3.6.2 to GDAL 3.6.4.
- Wheels are now available for Linux aarch64 / arm64.

## 0.5.1 (2023-01-26)

Expand Down
9 changes: 9 additions & 0 deletions ci/custom-triplets/arm64-linux-dynamic-release.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)

set(VCPKG_LIBRARY_LINKAGE static)
if(PORT MATCHES "gdal")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
43 changes: 43 additions & 0 deletions ci/manylinux_2_28_aarch64-vcpkg-gdal.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM quay.io/pypa/manylinux_2_28_aarch64:2023-04-16-157f52a

# building openssl needs IPC-Cmd (https://github.com/microsoft/vcpkg/issues/24988)
RUN dnf -y install curl zip unzip tar ninja-build perl-IPC-Cmd

# require python >= 3.7 (python 3.6 is default on base image) for meson
RUN ln -s /opt/python/cp38-cp38/bin/python3 /usr/bin/python3

RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg && \
git -C /opt/vcpkg checkout 580f143d123ce6abb5c135b11d6402c9a54bc9b9

ENV VCPKG_INSTALLATION_ROOT="/opt/vcpkg"
ENV PATH="${PATH}:/opt/vcpkg"

ENV VCPKG_DEFAULT_TRIPLET="arm64-linux-dynamic-release"
# pkgconf fails to build with default debug mode of arm64-linux host
ENV VCPKG_DEFAULT_HOST_TRIPLET="arm64-linux-release"

# Must be set when building on arm
ENV VCPKG_FORCE_SYSTEM_BINARIES=1

# mkdir & touch -> workaround for https://github.com/microsoft/vcpkg/issues/27786
RUN bootstrap-vcpkg.sh && \
mkdir -p /root/.vcpkg/ $HOME/.vcpkg && \
touch /root/.vcpkg/vcpkg.path.txt $HOME/.vcpkg/vcpkg.path.txt && \
vcpkg integrate install && \
vcpkg integrate bash

COPY ci/custom-triplets/arm64-linux-dynamic-release.cmake opt/vcpkg/custom-triplets/arm64-linux-dynamic-release.cmake
COPY ci/vcpkg-custom-ports/ opt/vcpkg/custom-ports/
COPY ci/vcpkg.json opt/vcpkg/

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/arm64-linux-dynamic-release/lib"
RUN vcpkg install --overlay-triplets=opt/vcpkg/custom-triplets \
--overlay-ports=opt/vcpkg/custom-ports \
--feature-flags="versions,manifests" \
--x-manifest-root=opt/vcpkg \
--x-install-root=opt/vcpkg/installed && \
vcpkg list

# setting git safe directory is required for properly building wheels when
# git >= 2.35.3
RUN git config --global --add safe.directory "*"
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ requires = [
skip = ["cp36-*", "cp37-*", "pp*", "*musllinux*"]
archs = ["auto64"]
manylinux-x86_64-image = "manylinux-vcpkg-gdal:latest"
manylinux-aarch64-image = "manylinux-aarch64-vcpkg-gdal:latest"
build-verbosity = 3

[tool.cibuildwheel.linux.environment]
VCPKG_INSTALL = "$VCPKG_INSTALLATION_ROOT/installed/x64-linux-dynamic"
VCPKG_INSTALL = "$VCPKG_INSTALLATION_ROOT/installed/$VCPKG_DEFAULT_TRIPLET"
GDAL_INCLUDE_PATH = "$VCPKG_INSTALL/include"
GDAL_LIBRARY_PATH = "$VCPKG_INSTALL/lib"
GDAL_VERSION = "3.6.4"
Expand Down

0 comments on commit c4deb39

Please sign in to comment.