Skip to content

Commit

Permalink
Merge pull request #3175 from reubenmiller/build-allow-setting-gnu-li…
Browse files Browse the repository at this point in the history
…bc-version

build: add support for building against specific gnu libc versions
  • Loading branch information
reubenmiller authored Oct 9, 2024
2 parents cfb537d + 267d0c0 commit daef5e3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ci/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Args:
* armv7-unknown-linux-gnueabihf
* arm-unknown-linux-gnueabihf
Linux GNU variants (controlling GNU libc version)
# Be aware of the caveats: https://github.com/rust-cross/cargo-zigbuild?tab=readme-ov-file#specify-glibc-version
* aarch64-unknown-linux-gnu.2.17
* aarch64-unknown-linux-gnu.2.27
Apple
* aarch64-apple-darwin
* x86_64-apple-darwin
Expand Down Expand Up @@ -156,6 +161,12 @@ fi
# shellcheck disable=SC1091
source ./ci/package_list.sh

# Note: cargo-zigbuild supports specifiying the specific gnu libc version to use
# but Rust doesn't, so the target needs to be normalized to match the target without
# the gnu libc version information
ZIG_TARGET="$ARCH"
ARCH=$(echo "$ZIG_TARGET" | cut -d. -f1)

# build release for target
# GIT_SEMVER should be referenced in the build.rs scripts
if [ "$BUILD" = 1 ]; then
Expand All @@ -177,8 +188,8 @@ if [ "$BUILD" = 1 ]; then
echo "zig version: $(zig version 2>/dev/null || python3 -m ziglang version 2>/dev/null ||:)"

if [ -n "$ARCH" ]; then
echo "Using target: $ARCH"
TARGET+=("--target=$ARCH")
echo "Using target: $ARCH (zig target=$ZIG_TARGET)"
TARGET+=("--target=$ZIG_TARGET")
rustup target add "$ARCH"
else
# Note: This will build the artifacts under target/release and not target/<triple>/release !
Expand Down

0 comments on commit daef5e3

Please sign in to comment.