facebookexperimental / facebookexperimental/ExtendedAndroidTools

Problems with building bpftools v0.24.1 in docker (wsl2)

Đang mở
#131 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Makefile
Star
266
Fork
99
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I see from the following snippet that bpftrace version used now is v0.24.1
https://github.com/facebookexperimental/ExtendedAndroidTools/blob/c80b92fb2da2d7c417bdd4cfafe9eb566baaf6e7/projects/bpftrace/build.mk#L51-L56
I compiled v0.23.4 bpftools last summer and it works flawlessly, but when I try to compile v0.24.1 now it has many problems.

1. `scripts/jammy-install-deps.sh` lacks proper error handling and `apt-get` fails silently likely due to network issues, after fixing that, during build process, another error occurs due to `xxd` not installed, `apt-get install xxd` fixed it. I think this script's content should stay in sync with https://github.com/bpftrace/bpftrace/blob/master/docker/Dockerfile.ubuntu, it has xxd in it.
2. now build succeeds and I get bpftools-arm64.tar.gz, but when I run bpftrace, linker complains it can't find **libclang-cpp.so**, I confirmed with `ldd $(which bpftrace)` on wsl2 archlinux that libclang-cpp is indeed a dependency now. And libclang-cpp-dev was added to the dockerfile between the release of v0.23.4 and v0.24.1, see https://github.com/bpftrace/bpftrace/blame/3fc827015ad48f857570bda6783cec273ed83e9c/docker/Dockerfile.ubuntu#L24-L26. After applying the following change, the linker error is fixed.
```
diff --git a/sysroot/bpftools.mk b/sysroot/bpftools.mk
index fe4360f..dc67656 100644
--- a/sysroot/bpftools.mk
+++ b/sysroot/bpftools.mk
@@ -49,6 +49,7 @@ $(BPFTOOLS):
cp $(ANDROID_OUT_DIR)/lib/libbcc_bpf.so $@/lib/
cp -a $(ANDROID_OUT_DIR)/lib/libbpf.so* $@/lib/
cp $(ANDROID_OUT_DIR)/lib/libclang.so $@/lib/
+ cp $(ANDROID_OUT_DIR)/lib/libclang-cpp.so $@/lib/
cp $(ANDROID_OUT_DIR)/lib/libc++_shared.so $@/lib/
cp -a $(ANDROID_OUT_DIR)/lib/libelf*.so* $@/lib/
cp $(ANDROID_OUT_DIR)/lib/libfl.so $@/lib/
```
3. but it still doesn't work. I found the code snippet that went wrong but I don't quite know what the error means. https://elixir.bootlin.com/llvm/llvmorg-22.1.0-rc3/source/llvm/lib/Support/CommandLine.cpp#L220
```
OP5D0DL1:/data/local/tmp/bpftools $ ./bpftrace
: CommandLine Error: Option 'disable-bpf-peephole' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.