libbpf-sys icon indicating copy to clipboard operation
libbpf-sys copied to clipboard

Could not find native static library elf, perhaps an -L flag is missing? (using static feature)

Open furkanonder opened this issue 9 months ago • 0 comments

cargo build -v --features static

Output:

       Fresh cfg_aliases v0.1.1
       Fresh libc v0.2.154
       Fresh cfg-if v1.0.0
       Fresh bitflags v2.5.0
       Fresh pkg-config v0.3.30
       Fresh cc v1.0.97
       Fresh nix v0.28.0
   Compiling libbpf-sys v1.4.1+v1.4.0 (/home/kes/libbpf-sys)
     Running `rustc --crate-name libbpf_sys --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=104 --crate-type lib --crate-type staticlib --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="static"' --cfg 'feature="static-libbpf"' --cfg 'feature="static-libelf"' --cfg 'feature="static-zlib"' --cfg 'feature="vendored-libbpf"' -C metadata=e8b69177a174d00c -C extra-filename=-e8b69177a174d00c --out-dir /home/kes/libbpf-sys/target/debug/deps -C incremental=/home/kes/libbpf-sys/target/debug/incremental -L dependency=/home/kes/libbpf-sys/target/debug/deps -L native=/home/kes/libbpf-sys/target/debug/build/libbpf-sys-ac808a735e3172a4/out -L native=/home/kes/libbpf-sys/target/debug/deps -L native=/home/kes/libbpf-sys/target/debug -L native=/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib -l static=elf -l static=z -l static=bpf`
error: could not find native static library `elf`, perhaps an -L flag is missing?

error: could not compile `libbpf-sys` (lib) due to 1 previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name libbpf_sys --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=104 --crate-type lib --crate-type staticlib --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="static"' --cfg 'feature="static-libbpf"' --cfg 'feature="static-libelf"' --cfg 'feature="static-zlib"' --cfg 'feature="vendored-libbpf"' -C metadata=e8b69177a174d00c -C extra-filename=-e8b69177a174d00c --out-dir /home/kes/libbpf-sys/target/debug/deps -C incremental=/home/kes/libbpf-sys/target/debug/incremental -L dependency=/home/kes/libbpf-sys/target/debug/deps -L native=/home/kes/libbpf-sys/target/debug/build/libbpf-sys-ac808a735e3172a4/out -L native=/home/kes/libbpf-sys/target/debug/deps -L native=/home/kes/libbpf-sys/target/debug -L native=/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib -l static=elf -l static=z -l static=bpf` (exit status: 1)

Environment

  • OS: Arch Linux x86_64
  • Kernel: 6.8.9-arch1-2

furkanonder avatar May 15 '24 18:05 furkanonder