-
Notifications
You must be signed in to change notification settings - Fork 42
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
bpf-linker
panics with Unable to open LLVM shared lib: [...]/libLLVM-18-rust-1.79.0-nightly.so: file too short
#220
Comments
|
If the similar error still occurs with the newest bpf-linker, it most likely means that Rust nightly is outdated and uses LLVM 18. Make sure that you have both up to date bpf-linker and nightly toolchain. The core of this issue is that LLVM version used by Rust compiler needs to match the LLVM version used by bpf-linker. So if you are using nightly from this month, you need LLVM 19. If you're using nightly from before they switched to LLVM 19, you need LLVM 18. But if the issue still persists with both being up to date, please post the full log. :) |
Thanks. I'll do my best to replicate it and provide more details. It was quite a strange issue when we hit it |
Thanks for your reply!
That's very good to know, was not aware of this. |
@vadorovsky would it be ok to open an issue to add a check to ensure the LLVM version of |
I also meet this problem, however when I build with the error output is
I am using nightly rustc
that's my .cargo/config.toml file [build]
target = "bpfel-unknown-none"
[unstable]
build-std = ["core"]
[target.bpfel-unknown-none]
rustflags = ["-C", "debuginfo=2", "-C", "link-arg=--btf"] bpf-linker version is 0.9.12 |
Hi, for what it's worth, I'm hitting the same thing on my setup: $ bpf-linker --version
bpf-linker 0.9.13
$ rustc --version --verbose
rustc 1.83.0-nightly (8d6b88b16 2024-09-11)
binary: rustc
commit-hash: 8d6b88b168e45ee1624699c19443c49665322a91
commit-date: 2024-09-11
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0 $ cat /home/qmo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-19-rust-1.83.0-nightly.so
INPUT(libLLVM.so.19.1-rust-1.83.0-nightly) I get a similar error message: $ cargo build --target=bpfel-unknown-none -Z build-std=core
[...]
= note: unable to open LLVM shared lib /home/qmo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-19-rust-1.83.0-nightly.so: /home/qmo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-19-rust-1.83.0-nightly.so: file too short
ERROR llvm: <unknown>:0:0: in function memmove ptr (ptr, ptr, i64): A call to built-in function 'abort' is not supported.
ERROR llvm: <unknown>:0:0: in function memmove ptr (ptr, ptr, i64): A call to built-in function 'abort' is not supported.
Error: LLVM issued diagnostic with error severity Adding |
I'm very sorry for missing this comment! Sure, we could add such check, I think it would be valuable. |
This is a different issue than the original one. I think this one is about a lack of To double-check whether that's really an issue, you could use Or you could try adding the following code in your eBPF program code: #[no_mangle]
pub unsafe extern "C" fn memmove(dest: *mut u8, src: *mut u8, n: usize) {
let delta = (dest as usize).wrapping_sub(src as usize);
if delta >= n {
// We can copy forwards because either dest is far enough ahead of src,
// or src is ahead of dest (and delta overflowed).
copy_forward(dest, src, n);
} else {
copy_backward(dest, src, n);
}
}
#[inline(always)]
unsafe fn copy_forward(dest: *mut u8, src: *mut u8, n: usize) {
for i in 0..n {
*dest.add(i) = *src.add(i);
}
}
#[inline(always)]
unsafe fn copy_backward(dest: *mut u8, src: *mut u8, n: usize) {
for i in (0..n).rev() {
*dest.add(i) = *src.add(i);
}
} Let me know whether that helps. If it doesn't, an another option might be that you have code which can panic ( |
Apologies for mixing up two different issues. Yes, it does work correctly in my case with the current HEAD from |
@qmonnet No worries, happy to hear that it works for you now! 🙂 @javierhonduco Are you still facing issues on your side? |
cc @rdelfin 👀 |
I will close this issue for now, feel free to re-open if it still occurs. The original issue reported was fixed by #214, the release was already made (0.9.13). And @qmonnet's issue is fixed by aya-rs/aya#971, which is not released yet. |
Hi,
When trying to compile https://github.com/aya-rs/book/tree/1d62046f4addf513ceb29298e38116625e776a3e/examples/xdp-hello
cargo xtask build-ebpf
panics withUnable to open LLVM shared lib: [...]/libLLVM-18-rust-1.79.0-nightly.so: file too short
, see full stack trace below. I am not sure if this could be related to #210, the stack trace contains a similar top error, but it looks a bit different. Thanks!cc @rdelfin
Full stacktrace
Environment info
The text was updated successfully, but these errors were encountered: