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

/virtual/main.c:18:20: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'u64' (aka 'unsigned long long') #4898

Open
NobinPegasus opened this issue Feb 2, 2024 · 0 comments

Comments

@NobinPegasus
Copy link

While trying to run the bpf_tail_call_ function I'm facing the following error:

pegasus@pegasus:~/Documents/eBPF/learning-ebpf/chapter2$ sudo ./hello-tail.py 
[sudo] password for pegasus: 
/virtual/main.c:18:20: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'u64' (aka 'unsigned long long') [-Wint-conversion]
    bpf_tail_call_((void *)bpf_pseudo_fd(1, -1), ctx, opcode);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/virtual/include/bcc/helpers.h:552:25: note: passing argument to parameter 'map_fd' here
void bpf_tail_call_(u64 map_fd, void *ctx, int index) {
                        ^
1 error generated.
Traceback (most recent call last):
  File "/home/pegasus/Documents/eBPF/learning-ebpf/chapter2/./hello-tail.py", line 41, in <module>
    b = BPF(text=program)
        ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 479, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

Inside bcc/src/cc/export/helpers.h I've the following code:

void bpf_tail_call_(void *map_fd, void *ctx, int index) {
  ((void (*)(void *, u64, int))BPF_FUNC_tail_call)(ctx, (u64)map_fd, index);
}

I tried to install BCC using the following commands:

git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake ..
make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd

Can anyone provide any suggestions, why am I still facing the same error? Although it's solved in the src
My clang version:

pegasus@pegasus:~/Documents/eBPF/learning-ebpf/chapter2$ clang --version
Homebrew clang version 17.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/linuxbrew/.linuxbrew/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant