-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix compile error: bcc_elf.c: undefined reference to `debuginfod_begin' #2411
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rtoax
force-pushed
the
patch-33-cmake-findlibdebuginfod
branch
from
November 3, 2022 15:02
729aa50
to
44cbb4d
Compare
If libdebuginfod is installed on the system and bpftrace is compiled with static linking to BCC (STATIC_BPF_BCC), then libbcc.a requires the dynamic library -ldebuginfod, in which case a compilation error will be reported if bpftrace is compiled without linking libdebuginfod. We just need to add bcc's FindLibDebuginfod.cmake to bpftrace to solve this problem. How to reproduce the error: $ sudo dnf install -y elfutils-debuginfod* $ cd bpftrace $ mkdir build && cd build $ ../build-libs.sh $ cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_BUILD_TYPE=Debug .. $ make -j$(nproc) ... [ 91%] Linking CXX executable bpftrace [ 92%] Linking CXX executable bpftrace_test /usr/bin/ld: ../build-libs/lib64/libbcc.a(bcc_elf.c.o): in function `find_debug_file': bcc_elf.c:(.text+0x10df): undefined reference to `debuginfod_begin' /usr/bin/ld: bcc_elf.c:(.text+0x10fd): undefined reference to `debuginfod_find_debuginfo' /usr/bin/ld: bcc_elf.c:(.text+0x1110): undefined reference to `debuginfod_end' collect2: error: ld returned 1 exit status make[2]: *** [src/CMakeFiles/bpftrace.dir/build.make:121: src/bpftrace] Error 1 make[1]: *** [CMakeFiles/Makefile2:1328: src/CMakeFiles/bpftrace.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/bin/ld: ../build-libs/lib64/libbcc.a(bcc_elf.c.o): in function `find_debug_file': bcc_elf.c:(.text+0x10df): undefined reference to `debuginfod_begin' /usr/bin/ld: bcc_elf.c:(.text+0x10fd): undefined reference to `debuginfod_find_debuginfo' /usr/bin/ld: bcc_elf.c:(.text+0x1110): undefined reference to `debuginfod_end' collect2: error: ld returned 1 exit status make[2]: *** [tests/CMakeFiles/bpftrace_test.dir/build.make:364: tests/bpftrace_test] Error 1 make[1]: *** [CMakeFiles/Makefile2:2230: tests/CMakeFiles/bpftrace_test.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 Signed-off-by: Rong Tao <[email protected]>
Rtoax
force-pushed
the
patch-33-cmake-findlibdebuginfod
branch
from
November 3, 2022 15:05
44cbb4d
to
15edc4b
Compare
danobi
reviewed
Nov 3, 2022
I landed iovisor/bcc#4308 in bcc to add ENABLE_LIBDEBUGINFOD, so we can configure it without it. In general this know-about-all-your-dependencies-trees approach is absolutely unsustainable. We could use this as an opportunity to test the vendored libs flow:
|
BurntBrunch
pushed a commit
to BurntBrunch/bpftrace
that referenced
this pull request
Nov 3, 2022
As an alternative to bpftrace#2411, this updates to the exact commit in bcc that adds ENABLE_LIBDEBUGINFOD and passes that flag in our local build. Because we're not using any functionality not in v0.25, this technically does not raise the minimum bcc version for the bpftrace package - distros would build against a dynamic, system bcc anyway.
@BurntBrunch thanks a lot, i'll try use ENABLE_LIBDEBUGINFOD. |
Rtoax
added a commit
to Rtoax/bpftrace
that referenced
this pull request
Nov 4, 2022
If libdebuginfod is installed on the system and bpftrace is compiled with static linking to BCC (STATIC_BPF_BCC), then libbcc.a requires the dynamic library -ldebuginfod, in which case a compilation error will be reported if bpftrace is compiled without linking libdebuginfod. checkout bcc to commit 8c0272979e40("Allow libdebuginfod to be excluded even if present") and disable libdebuginfod in build-libs.sh, solved undefined reference to `debuginfod_begin' compile error. How to reproduce the error: $ sudo dnf install -y elfutils-debuginfod* $ cd bpftrace $ mkdir build && cd build $ ../build-libs.sh $ cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_BUILD_TYPE=Debug .. $ make -j$(nproc) ... [ 91%] Linking CXX executable bpftrace [ 92%] Linking CXX executable bpftrace_test /usr/bin/ld: ../build-libs/lib64/libbcc.a(bcc_elf.c.o): in function `find_debug_file': bcc_elf.c:(.text+0x10df): undefined reference to `debuginfod_begin' /usr/bin/ld: bcc_elf.c:(.text+0x10fd): undefined reference to `debuginfod_find_debuginfo' /usr/bin/ld: bcc_elf.c:(.text+0x1110): undefined reference to `debuginfod_end' collect2: error: ld returned 1 exit status make[2]: *** [src/CMakeFiles/bpftrace.dir/build.make:121: src/bpftrace] Error 1 make[1]: *** [CMakeFiles/Makefile2:1328: src/CMakeFiles/bpftrace.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/bin/ld: ../build-libs/lib64/libbcc.a(bcc_elf.c.o): in function `find_debug_file': bcc_elf.c:(.text+0x10df): undefined reference to `debuginfod_begin' /usr/bin/ld: bcc_elf.c:(.text+0x10fd): undefined reference to `debuginfod_find_debuginfo' /usr/bin/ld: bcc_elf.c:(.text+0x1110): undefined reference to `debuginfod_end' collect2: error: ld returned 1 exit status make[2]: *** [tests/CMakeFiles/bpftrace_test.dir/build.make:364: tests/bpftrace_test] Error 1 make[1]: *** [CMakeFiles/Makefile2:2230: tests/CMakeFiles/bpftrace_test.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 Link: bpftrace#2411 Signed-off-by: Rong Tao <[email protected]>
@BurntBrunch @danobi Hi, i just start a new PR #2415, maybe close this PR later. |
BurntBrunch
pushed a commit
that referenced
this pull request
Nov 4, 2022
As an alternative to #2411, this updates to the exact commit in bcc that adds ENABLE_LIBDEBUGINFOD and passes that flag in our local build. Because we're not using any functionality not in v0.25, this technically does not raise the minimum bcc version for the bpftrace package - distros would build against a dynamic, system bcc anyway.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If libdebuginfod is installed on the system and bpftrace is compiled with static linking to BCC (STATIC_BPF_BCC), then libbcc.a requires the dynamic library -ldebuginfod, in which case a compilation error will be reported if bpftrace is compiled without linking libdebuginfod. We just need to add bcc's FindLibDebuginfod.cmake to bpftrace to solve this problem.
How to reproduce the error: