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

Add linux arm builds #33

Merged
merged 1 commit into from
Jun 17, 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
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
29 changes: 25 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@
# 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} CFLAGS_aarch64_unknown_linux_gnu=--sysroot=/usr/aarch64-linux-gnu)
set(RUST_ENV_VARS ${RUST_ENV_VARS} CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc)
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_INCLUDE_DIR=${CMAKE_BINARY_DIR}/vcpkg_installed/${VCPKG_TARGET_TRIPLET}/include)
set(RUST_PLATFORM_TARGET "aarch64-unknown-linux-gnu")
else()
set(RUST_PLATFORM_TARGET "x86_64-unknown-linux-gnu")
endif()
Expand All @@ -56,20 +64,33 @@
endif()
endif()

string(STRIP "${RUST_ENV_VARS}" RUST_ENV_VARS)

# 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}
GIT_REPOSITORY "https://github.com/nicklan/delta-kernel-rs"
GIT_TAG 181232a45562ca78be763c2f5fb46b88a2463b5c
CONFIGURE_COMMAND ""
# Prints the env variables passed to the cargo build to the terminal, useful in debugging because passing them
# through CMake is an error-prone mess
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env ${RUST_UNSET_ENV_VARS} ${RUST_ENV_VARS} env
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
Loading