Closed tamird closed 3 weeks ago
not sure if I missed anything, but this doesn't seem to work:
lielfridman@Liels-MacBook-Pro ebpf-auditer % AYA_BUILD_EBPF=true \
CC=${ARCH}-linux-musl-gcc \
RUSTFLAGS="-C linker=${ARCH}-linux-musl-gcc" \
cargo build --package ebpf-auditer --release --target=${ARCH}-unknown-linux-musl
Compiling ebpf-auditer v0.1.0 (/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer)
The following warnings were emitted during compilation:
warning: ebpf-auditer@0.1.0: Compiling ebpf-auditer-ebpf v0.1.0 (/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer-ebpf)
warning: ebpf-auditer@0.1.0: error: linking with `aarch64-linux-musl-gcc` failed: exit status: 1
warning: ebpf-auditer@0.1.0: |
warning: ebpf-auditer@0.1.0: = note: LC_ALL="C" PATH="/Users/lielfridman/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/openjdk@21/bin:/opt/homebrew/opt/llvm/bin:/Users/lielfridman/flutter/bin:/Users/lielfridman/.local/bin:/Users/lielfridman/.rbenv/shims:/opt/homebrew/opt/mysql-client/bin:/Users/lielfridman/.nvm/versions/node/v20.11.0/bin:/Users/lielfridman/.pyenv/shims:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/lielfridman/.cargo/bin:/Users/lielfridman/Library/Application Support/JetBrains/Toolbox/scripts:/Users/lielfridman/go/bin" VSLANG="1033" "aarch64-linux-musl-gcc" "--export-symbols" "/var/folders/nq/j57y61v91bqfgbx4qpy0jb_40000gn/T/rustcF5nzZH/symbols" "/var/folders/nq/j57y61v91bqfgbx4qpy0jb_40000gn/T/rustcF5nzZH/symbols.o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/ebpf_auditer-b96c95dc76996da2.ebpf_auditer.badf010e8e002827-cgu.0.rcgu.o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_log_ebpf-c9131489510da28c.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_log_common-e45c9f8c3c14f18f.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libnum_enum-e1b5a306ee8f5ea5.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf-1d4bf08ce8ea8fd8.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf_bindings-8cd067c8051990e8.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf_cty-3cf779c1bb043e7e.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/librustc_std_workspace_core-050bc42c86a0fc8d.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libcore-72540679a78b0f72.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libcompiler_builtins-83738ce13aeccd0f.rlib" "--cpu" "generic" "-o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/ebpf_auditer-b96c95dc76996da2" "-O3" "--debug"
warning: ebpf-auditer@0.1.0: = note: aarch64-linux-musl-gcc: error: generic: No such file or directory
warning: ebpf-auditer@0.1.0: aarch64-linux-musl-gcc: error: unrecognized command line option '--export-symbols'
warning: ebpf-auditer@0.1.0: aarch64-linux-musl-gcc: error: unrecognized command line option '--cpu'
warning: ebpf-auditer@0.1.0:
warning: ebpf-auditer@0.1.0:
warning: ebpf-auditer@0.1.0:
warning: ebpf-auditer@0.1.0: error: could not compile `ebpf-auditer-ebpf` (bin "ebpf-auditer") due to 1 previous error
error: failed to run custom build command for `ebpf-auditer v0.1.0 (/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer)`
Caused by:
process didn't exit successfully: `/Users/lielfridman/Projects/Rust/ebpf-auditer/target/release/build/ebpf-auditer-776137e4fecc6045/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=AYA_BUILD_EBPF
cargo:rerun-if-changed=/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer-ebpf
cargo:warning= Compiling ebpf-auditer-ebpf v0.1.0 (/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer-ebpf)
cargo:warning=error: linking with `aarch64-linux-musl-gcc` failed: exit status: 1
cargo:warning= |
cargo:warning= = note: LC_ALL="C" PATH="/Users/lielfridman/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/openjdk@21/bin:/opt/homebrew/opt/llvm/bin:/Users/lielfridman/flutter/bin:/Users/lielfridman/.local/bin:/Users/lielfridman/.rbenv/shims:/opt/homebrew/opt/mysql-client/bin:/Users/lielfridman/.nvm/versions/node/v20.11.0/bin:/Users/lielfridman/.pyenv/shims:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/lielfridman/.cargo/bin:/Users/lielfridman/Library/Application Support/JetBrains/Toolbox/scripts:/Users/lielfridman/go/bin" VSLANG="1033" "aarch64-linux-musl-gcc" "--export-symbols" "/var/folders/nq/j57y61v91bqfgbx4qpy0jb_40000gn/T/rustcF5nzZH/symbols" "/var/folders/nq/j57y61v91bqfgbx4qpy0jb_40000gn/T/rustcF5nzZH/symbols.o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/ebpf_auditer-b96c95dc76996da2.ebpf_auditer.badf010e8e002827-cgu.0.rcgu.o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_log_ebpf-c9131489510da28c.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_log_common-e45c9f8c3c14f18f.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libnum_enum-e1b5a306ee8f5ea5.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf-1d4bf08ce8ea8fd8.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf_bindings-8cd067c8051990e8.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libaya_ebpf_cty-3cf779c1bb043e7e.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/librustc_std_workspace_core-050bc42c86a0fc8d.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libcore-72540679a78b0f72.rlib" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/libcompiler_builtins-83738ce13aeccd0f.rlib" "--cpu" "generic" "-o" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf/bpfel-unknown-none/release/deps/ebpf_auditer-b96c95dc76996da2" "-O3" "--debug"
cargo:warning= = note: aarch64-linux-musl-gcc: error: generic: No such file or directory
cargo:warning= aarch64-linux-musl-gcc: error: unrecognized command line option '--export-symbols'
cargo:warning= aarch64-linux-musl-gcc: error: unrecognized command line option '--cpu'
cargo:warning=
cargo:warning=
cargo:warning=
cargo:warning=error: could not compile `ebpf-auditer-ebpf` (bin "ebpf-auditer") due to 1 previous error
--- stderr
thread 'main' panicked at ebpf-auditer/build.rs:153:9:
assertion `left == right` failed: cd "/Users/lielfridman/Projects/Rust/ebpf-auditer/ebpf-auditer-ebpf" && env -u RUSTC -u RUSTUP_TOOLCHAIN CARGO_CFG_BPF_TARGET_ARCH="aarch64" "cargo" "build" "-Z" "build-std=core" "--bins" "--message-format=json" "--release" "--target" "bpfel-unknown-none" "--target-dir" "/Users/lielfridman/Projects/Rust/ebpf-auditer/target/aarch64-unknown-linux-musl/release/build/ebpf-auditer-af3b67f9e39190a6/out/ebpf-auditer-ebpf" failed: ExitStatus(unix_wait_status(25856))
left: Some(101)
right: Some(0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I'll work on adding cross compilation on Mac to our CI.
@lielfr yeah, the instructions were wrong, setting RUSTFLAGS="-C linker=..."
ends up trying to use that linker for ebpf instead of ebpf-linker. cc @alessandrod
See #131.
The instructions in the book are now out of date for projects generated with this template. Since the instructions are much shorter these days, put them in the README.
Fixes #127.