Skip to content

Commit

Permalink
re-enable linux arm64 builds (#1060)
Browse files Browse the repository at this point in the history
Fix #1011 by avoiding
the use of `crate-type = ["cdylib"]` in native builds.

It was causing some linker errors when cross-compiling from x64-linux to
aarch64-linux, I believe the root cause is
rust-lang/cargo#4133 i.e. cargo failing to
select the right target linker during cross builds.

The `cdylib` crate type is only relevant when building wasms, so this
change just lowers that functionality into the specific commands that
build wasms.

---------

Co-authored-by: Leigh McCulloch <[email protected]>
  • Loading branch information
graydon and leighmcculloch authored Aug 25, 2023
1 parent 946f70d commit e7e5eca
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ jobs:
sys:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# TODO: Figure out why builds are broken for linux arm64 and reenable.
# https://github.com/stellar/rs-soroban-sdk/issues/1011
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
# Fix #1011 by avoiding the use of crate-type = ["cdylib"] in native
# builds that cross-compile. It causes linker errors. The root cause
# is rust-lang/cargo#4133. This workaround uses rustc to build for a
# specific crate-type, lib, such that the Cargo.toml crate-type is
# ignored.
cdylib-cross-compile-workaround: true
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
Expand All @@ -85,7 +89,10 @@ jobs:
name: cargo-hack
version: 0.5.16
- run: cargo-hack hack build --target wasm32-unknown-unknown --profile release
- run: cargo-hack hack --feature-powerset --exclude-features docs build --target ${{ matrix.sys.target }}
- if: "!matrix.sys.cdylib-cross-compile-workaround"
run: cargo-hack hack --feature-powerset --exclude-features docs build --target ${{ matrix.sys.target }}
- if: "matrix.sys.cdylib-cross-compile-workaround"
run: cargo-hack hack --feature-powerset --exclude-features docs rustc --workspace --exclude soroban-sdk-macros --crate-type lib --target ${{ matrix.sys.target }}
- if: startsWith(matrix.sys.target, 'x86_64')
run: cargo-hack hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test --target ${{ matrix.sys.target }}

Expand Down

0 comments on commit e7e5eca

Please sign in to comment.