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

Building the starter project xdp fails on ubuntu24.04 #1137

Open
ShyunnY opened this issue Jan 16, 2025 · 0 comments
Open

Building the starter project xdp fails on ubuntu24.04 #1137

ShyunnY opened this issue Jan 16, 2025 · 0 comments

Comments

@ShyunnY
Copy link

ShyunnY commented Jan 16, 2025

I am a newbie to the aya project. When I tried to use the official introductory case -- xdp project, I encountered a compilation problem, which puzzled me. I tried multiple ways to solve it, but couldn't do it.

The error log is as follows:

root@local:/code/rust/quick/quick-ebpf# tree ../
../
├── Cargo.toml
├── README.md
├── quick
│   ├── Cargo.toml
│   ├── build.rs
│   └── src
│       └── main.rs
├── quick-common
│   ├── Cargo.toml
│   └── src
│       └── lib.rs
├── quick-ebpf  # <---- current
│   ├── Cargo.toml
│   ├── build.rs
│   └── src
│       ├── lib.rs
│       └── main.rs
└── rustfmt.toml

root@local:/code/rust/quick/quick-ebpf# cargo build
    Updating crates.io index
     Locking 91 packages to latest compatible versions
      Adding which v6.0.3 (available: v7.0.1)
   Compiling proc-macro2 v1.0.93
   Compiling unicode-ident v1.0.14
   Compiling version_check v0.9.5
   Compiling proc-macro-error-attr v1.0.4
   Compiling rustversion v1.0.19
   Compiling proc-macro-error v1.0.4
   Compiling rustix v0.38.43
   Compiling quote v1.0.38
   Compiling aya-ebpf-cty v0.2.2
   Compiling syn v2.0.96
   Compiling linux-raw-sys v0.4.15
   Compiling aya-ebpf-bindings v0.1.1
   Compiling bitflags v2.8.0
   Compiling num_enum_derive v0.7.3
   Compiling aya-ebpf v0.1.1
   Compiling either v1.13.0
   Compiling home v0.5.11
   Compiling which v6.0.3
   Compiling num_enum v0.7.3
   Compiling aya-log-common v0.1.15
   Compiling aya-log-parser v0.1.13
   Compiling aya-ebpf-macros v0.1.1
   Compiling aya-log-ebpf-macros v0.1.0
   Compiling quick-ebpf v0.1.0 (/code/rust/quick/quick-ebpf)
   Compiling quick-common v0.1.0 (/code/rust/quick/quick-common)
   Compiling aya-log-ebpf v0.1.1
error: unwinding panics are not supported without std
  |
  = help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding
  = note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem

error: could not compile `quick-ebpf` (bin "quick") due to 1 previous error

I tried the following ways:

  • Add the following configuration to Cargo.toml
[package]
name = "quick-ebpf"
version = "0.1.0"
edition = "2021"

[dependencies]
quick-common = { path = "../quick-common" }

aya-ebpf = { workspace = true }
aya-log-ebpf = { workspace = true }

[build-dependencies]
which = { workspace = true }

[[bin]]
name = "quick"
path = "src/main.rs"

# add
[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"
  • Switch compilation command
$ cargo +nightly build -Z build-std=core,alloc,panic_abort

The following is the information of the development environment:

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
...

$ uname -r
6.8.0-38-generic

$ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.86.0-nightly (419b3e2d3 2025-01-15)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant