-
Notifications
You must be signed in to change notification settings - Fork 315
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
build error compiling C minimal example - 'make minimal' in examples/c #69
Comments
interestingly, on fedora 35 the
On rhel8, it doesn't work - |
Never mind - was my bad clone as mentioned in xdp-project/xdp-tutorial#93 (comment). With the correct clone ( |
actually I think this issue needs to be reopened. I carefully followed the instructions for the CMake build from https://github.com/libbpf/libbpf-bootstrap#c-examples (starting with
Do we need to add CMakefile instructions to build |
Please see #70, in case it's related. But also make sure you perform |
@dmitris do you still have a problem building examples? |
@ankryiko I'm getting this problem when building using the makefile instructions; I also get the error described in #70 if I try to use the cmake instructions. FYI: I've cloned at commit 2b5b2bb, and OS: Ubuntu 21.04 |
@pynem I faced the same problem on Ubuntu 20.04 with 5.13.0-51-generic. Quoting part of this stackoverflow answer
For now, undoing the changes in libbpf/bpftool@d97300d (commenting out/deleting the additions to diff --git a/src/skeleton/pid_iter.bpf.c b/src/skeleton/pid_iter.bpf.c
index eb05ea5..3f81545 100644
--- a/src/skeleton/pid_iter.bpf.c
+++ b/src/skeleton/pid_iter.bpf.c
@@ -38,17 +38,6 @@ static __always_inline __u32 get_obj_id(void *ent, enum bpf_obj_type type)
}
}
-/* could be used only with BPF_LINK_TYPE_PERF_EVENT links */
-static __u64 get_bpf_cookie(struct bpf_link *link)
-{
- struct bpf_perf_link *perf_link;
- struct perf_event *event;
-
- perf_link = container_of(link, struct bpf_perf_link, link);
- event = BPF_CORE_READ(perf_link, perf_file, private_data);
- return BPF_CORE_READ(event, bpf_cookie);
-}
-
SEC("iter/task_file")
int iter(struct bpf_iter__task_file *ctx)
{
@@ -80,19 +69,9 @@ int iter(struct bpf_iter__task_file *ctx)
if (file->f_op != fops)
return 0;
- __builtin_memset(&e, 0, sizeof(e));
e.pid = task->tgid;
e.id = get_obj_id(file->private_data, obj_type);
- if (obj_type == BPF_OBJ_LINK) {
- struct bpf_link *link = (struct bpf_link *) file->private_data;
-
- if (BPF_CORE_READ(link, type) == BPF_LINK_TYPE_PERF_EVENT) {
- e.has_bpf_cookie = true;
- e.bpf_cookie = get_bpf_cookie(link);
- }
- }
-
bpf_probe_read_kernel_str(&e.comm, sizeof(e.comm),
task->group_leader->comm);
bpf_seq_write(ctx->meta->seq, &e, sizeof(e)); |
@algrebe Thanks for the information! Is there a version that will work with a 5.11 kernel? |
@qmonnet is there anything we can do to make bpftool a bit less demanding about how up-to-date host kernel on the build machine has to be? Should we just define some of those used constants? |
Related: libbpf/bpftool#17 My understanding here is that the patch from Alexander would solve the issue upstream. I tried to ping him about it some time ago but didn't get an answer. I can maybe resubmit this patch this week, once it's merged we can pull it in the bpftool mirror and then in this repo. I'm not aware of any other object, beside How does that sound to you? |
@qmonnet I think it would be easier and faster to submit bpftool fix separately |
tried now and build works fine, thanks! 👍 |
When trying to run
make minimal
in theexamples/c
directory, getting the following errors - the full output in gisthttps://gist.github.com/dmitris/697849eb3c0b80e6f2ca50430cae499b:
Is it related to (or even fixed in) https://lore.kernel.org/bpf/[email protected]/ and
https://lore.kernel.org/bpf/[email protected]/ ?
I got that error with the current rhel8 and Fedora 35 -
Linux mybox.example.com 5.14.10-300.fc35.x86_64 #1 SMP Thu Oct 7 20:48:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: