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

missing zstd library when building statically on Ubuntu 24.04 #152

Open
mtardy opened this issue Aug 16, 2024 · 6 comments
Open

missing zstd library when building statically on Ubuntu 24.04 #152

mtardy opened this issue Aug 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mtardy
Copy link
Contributor

mtardy commented Aug 16, 2024

When building bpftool statically on Ubuntu 24.04 (note that it works fine on 22.04), -lzstd must be added to LIBS and BOOTSTRAP_LIBS. See my "live patch" cilium/tetragon@8e994cf.

Would it make sense to upstream that? I would be happy to.

I have a repro, do the following steps with ubuntu:22.04 and ubuntu:24.04 (replace clang 15 with clang 18 on 24.04)

apt-get update && apt-get install -y --no-install-recommends clang-15 libclang-common-15-dev libclang-cpp15 libllvm15 llvm-15-linker-tools libclang1-15 llvm-15 llvm-15-runtime llvm-15-linker-tools make
apt-get update && apt-get install -y curl git llvm gcc pkg-config zlib1g-dev libelf-dev libcap-dev
git clone https://github.com/libbpf/bpftool.git
cd bpftool
git submodule update --init --recursive
make -C src EXTRA_CFLAGS=--static EXTRA_LDFLAGS=-v -j $(nproc) && strip src/bpftool
@qmonnet
Copy link
Member

qmonnet commented Aug 21, 2024

Thanks for the report! We'll need to update both the kernel and the mirror repo, independently. Do you have more context on the change, by any chance? Is there a way to figure out whether the -lzstd is required without having to add a new set of probes?

@mtardy
Copy link
Contributor Author

mtardy commented Aug 22, 2024

Thanks for the report! We'll need to update both the kernel and the mirror repo, independently. Do you have more context on the change, by any chance? Is there a way to figure out whether the -lzstd is required without having to add a new set of probes?

Tbh I don't exactly know the "why", I just ended up finding that it fixed my issue when using the newer Ubuntu version. I could investigate to see!

@petrutlucian94
Copy link

petrutlucian94 commented Sep 11, 2024

I hit the same problem, for what is worth zstd is required by libelf. It could be that older versions of libelf didn't use zstd.

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress_elf':
(.text+0xd45): undefined reference to `ZSTD_decompress'

@qmonnet qmonnet added the bug Something isn't working label Sep 11, 2024
@qmonnet
Copy link
Member

qmonnet commented Sep 11, 2024

Yes. Elfutils commit a5b07cdf9c49 adds support for ZSTD compression, since elfutils 0.189.

Ubuntu 22.04 ships version 0.186 (or 0.188 in backports), Ubuntu 24.04 has 0.189 or 0.190 depending on the arch.

@qmonnet
Copy link
Member

qmonnet commented Oct 29, 2024

@mtardy Were you working on upstreaming a fix at all for this issue? I can't remember

@mtardy
Copy link
Contributor Author

mtardy commented Oct 30, 2024

@mtardy Were you working on upstreaming a fix at all for this issue? I can't remember

I'm not sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants