I'm coming back to a project which used to build with no problems a few Rust and OS versions ago (probably around Rust 1.75 or so and Alpine 3.19) but now gives this error when I try to build statically against libpcap:
error: could not find native static library pcap, perhaps an -L flag is missing?
The library is installed and exists as /usr/lib/libpcap.a
My build script contains println!("cargo:rustc-link-lib=static=pcap");
and I've tried the LIBPCAP_VER
and LIBPCAP_LIBDIR
env vars with no difference to result.
Running cargo
through strace
shows it seems to only look for the library in rustlib/
:
[pid 20715] stat("/usr/lib/rustlib/x86_64-alpine-linux-musl/lib/libpcap.a", <unfinished ...>
[pid 20715] <... stat resumed>0x7f1f0d4e1f30) = -1 ENOENT (No such file or directory)
What am I doing wrong?