From ab187058d89d38a655ce90d7a6291b3321f427fa Mon Sep 17 00:00:00 2001 From: Michal R Date: Fri, 5 Dec 2025 15:47:33 +0100 Subject: [PATCH 1/3] ci: Enable `llvm-link-static` feature for bpf-linker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rust CI does not provide dynamic libLLVM tarballs for macOS—only static ones. Since recent versions of bpf-linker require explicit linkage configuration for libLLVM, enable the `llvm-link-static` feature to ensure correct static linking. Make sure bpf-linker's build.rs sees the downloaded LLVM by adding it to PATH. On macOS, set the `{CXXSTDLIB,ZLIB}_PATH` variables to point to the brew prefixes with static libraries it needs. Given that now we link statically all libLLVM's dependencies and macOS provides only dynamic zlib, we need to install static zlib from brew. --- .github/workflows/ci.yml | 12 +++++++++++- Brewfile | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55ed4e99..d8c33e73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -279,6 +279,10 @@ jobs: brew bundle echo $(brew --prefix curl)/bin >> $GITHUB_PATH echo $(brew --prefix llvm)/bin >> $GITHUB_PATH + # Point bpf-linker's build.rs to the brew prefixes with static + # libraries it needs. + echo "CXXSTDLIB_PATH=$(brew --prefix llvm)/lib/c++" >> $GITHUB_ENV + echo "ZLIB_PATH=$(brew --prefix zlib)/lib" >> $GITHUB_ENV # https://github.com/actions/setup-python/issues/577 find /usr/local/bin -type l -exec sh -c 'readlink -f "$1" \ @@ -328,6 +332,7 @@ jobs: ;; macOS) target=${arch}-apple-darwin + echo "LLVM_LINK_FEATURE=llvm-link-static" >> $GITHUB_ENV ;; *) echo "::error::Unsupported runner OS: ${{ runner.os }}" @@ -341,8 +346,13 @@ jobs: # NB: rustc doesn't ship libLLVM.so on macOS, so disable proxying (default feature). We also # --force so that bpf-linker gets always relinked against the latest LLVM downloaded above. # + # Add the downloaded LLVM to PATH for this build step. + # # Do this on all system (not just macOS) to avoid relying on rustc-provided libLLVM.so. - - run: cargo install --git https://github.com/aya-rs/bpf-linker.git bpf-linker --no-default-features --features llvm-21 --force + - run: | + cargo install \ + --git https://github.com/aya-rs/bpf-linker.git bpf-linker \ + --no-default-features --features "llvm-21,${LLVM_LINK_FEATURE}" --force - uses: actions/cache@v4 with: diff --git a/Brewfile b/Brewfile index 285773b9..fe52a392 100644 --- a/Brewfile +++ b/Brewfile @@ -12,6 +12,9 @@ brew "lynx" brew "pkg-config" brew "qemu" +# macOS provides only dynamic zlib. Install the static one. +brew "zlib" + # We need a musl C toolchain to compile our `test-distro` since some of our # dependencies have build scripts that compile C code (i.e xz2). tap "filosottile/musl-cross" From 800f9f9feac2f3aa2eac9e532e920bc85ab1366d Mon Sep 17 00:00:00 2001 From: Michal R Date: Fri, 5 Dec 2025 21:33:54 +0100 Subject: [PATCH 2/3] ci/lint: Do not install stable toolchain We run clippy and miri only with nightly. --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8c33e73..8d724ca5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,6 @@ jobs: with: components: clippy,miri,rustfmt,rust-src - # Installed *after* nightly so it is the default. - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@v2 From 28ae4b9826b57671d7e748a90fc3a5d7687cda53 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 10 Dec 2025 12:01:56 -0500 Subject: [PATCH 3/3] test: properly spell "dependency" --- test/integration-test/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration-test/Cargo.toml b/test/integration-test/Cargo.toml index e81d705c..aed0ab90 100644 --- a/test/integration-test/Cargo.toml +++ b/test/integration-test/Cargo.toml @@ -48,7 +48,7 @@ aya-build = { path = "../../aya-build" } cargo_metadata = { workspace = true } # TODO(https://github.com/rust-lang/cargo/issues/12375): this should be an artifact dependency, but # it's not possible to tell cargo to use `-Z build-std` to build it. We cargo-in-cargo in the build -# script to build this, but we want to teach cargo about the dependecy so that cache invalidation +# script to build this, but we want to teach cargo about the dependency so that cache invalidation # works properly. # # Finally note that *any* usage of `artifact = ...` in *any* Cargo.toml in the workspace breaks