Skip to content

Commit

Permalink
add linux arm64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed Jun 17, 2024
1 parent a2d6601 commit 4575e53
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
duckdb_version: v1.0.0
extension_name: delta
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64;linux_arm64'
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64'

duckdb-stable-deploy:
name: Deploy extension binaries
Expand All @@ -28,5 +28,5 @@ jobs:
with:
extension_name: delta
duckdb_version: v1.0.0
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64;linux_arm64'
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64'
deploy_latest: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
8 changes: 7 additions & 1 deletion .github/workflows/_extension_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,15 @@ jobs:
./duckdb/scripts/setup_manylinux2014.sh general aws-cli ccache ssh python_alias openssl
- name: Setup Rust
if: ${{ matrix.duckdb_arch == 'linux_amd64' }}
if: ${{ matrix.duckdb_arch == 'linux_amd64'}}
uses: dtolnay/rust-toolchain@stable

- name: Setup Rust for cross compilation
if: ${{ matrix.duckdb_arch == 'linux_arm64'}}
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu

- name: Setup Rust for manylinux (dtolnay/rust-toolchain doesn't work due to curl being old here)
if: ${{ matrix.duckdb_arch == 'linux_amd64_gcc4' }}
run: |
Expand Down
21 changes: 18 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ set(KERNEL_NAME delta_kernel)
# Set default ExternalProject root directory
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rust)

set(RUST_ENV_VARS "")

# Propagate arch to rust build for CI
set(RUST_PLATFORM_TARGET "")
if("${OS_NAME}" STREQUAL "linux")
if ("${OS_ARCH}" STREQUAL "arm64")
set(RUST_PLATFORM_TARGET "aarch64-unknown-linux-gnu")
elseif("${CMAKE_CXX_COMPILER}" MATCHES "aarch64")
set(RUST_ENV_VARS "${RUST_ENV_VARS} OPENSSL_LIB_DIR=${CMAKE_BINARY_DIR}/vcpkg_installed/${VCPKG_TARGET_TRIPLET}/lib")
set(RUST_ENV_VARS "${RUST_ENV_VARS} OPENSSL_DIR=${CMAKE_BINARY_DIR}/vcpkg_installed/${VCPKG_TARGET_TRIPLET}/include/openssl")
set(RUST_PLATFORM_TARGET "aarch64-unknown-linux-gnu")
else()
set(RUST_PLATFORM_TARGET "x86_64-unknown-linux-gnu")
endif()
Expand All @@ -56,6 +62,9 @@ elseif("${OS_NAME}" STREQUAL "osx")
endif()
endif()

# Having these set will mess up cross compilation to linux arm
set(RUST_UNSET_ENV_VARS --unset=CC --unset=CXX --unset=LD)

# Add rust_example as a CMake target
ExternalProject_Add(
${KERNEL_NAME}
Expand All @@ -65,11 +74,17 @@ ExternalProject_Add(
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
# Build debug build
BUILD_COMMAND cargo build --package delta_kernel_ffi --workspace --all-features --target=${RUST_PLATFORM_TARGET}
BUILD_COMMAND
${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS}
cargo build --package delta_kernel_ffi --workspace --all-features --target=${RUST_PLATFORM_TARGET}
# Build release build
COMMAND cargo build --package delta_kernel_ffi --workspace --all-features --release --target=${RUST_PLATFORM_TARGET}
COMMAND
${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS}
cargo build --package delta_kernel_ffi --workspace --all-features --release --target=${RUST_PLATFORM_TARGET}
# Build DATs
COMMAND cargo build --manifest-path=${CMAKE_BINARY_DIR}/rust/src/delta_kernel/acceptance/Cargo.toml
COMMAND
${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS}
cargo build --manifest-path=${CMAKE_BINARY_DIR}/rust/src/delta_kernel/acceptance/Cargo.toml
BUILD_BYPRODUCTS "${CMAKE_BINARY_DIR}/rust/src/delta_kernel/target/${RUST_PLATFORM_TARGET}/debug/libdelta_kernel_ffi.a"
BUILD_BYPRODUCTS "${CMAKE_BINARY_DIR}/rust/src/delta_kernel/target/${RUST_PLATFORM_TARGET}/release/libdelta_kernel_ffi.a"
BUILD_BYPRODUCTS "${CMAKE_BINARY_DIR}/rust/src/delta_kernel/target/ffi-headers/delta_kernel_ffi.h"
Expand Down

0 comments on commit 4575e53

Please sign in to comment.