/virtual/main.c:18:20: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'u64' (aka 'unsigned long long')
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
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
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 ""))
Exception: Failed to compile BPF module
```
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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with chapter2/hello-tail.py and the bpf_tail_call_ entry point shown in the report. Compare src/cc/export/helpers.h with the generated /virtual/include/bcc/helpers.h, then rerun hello-tail.py using the installed BCC and clang versions. Done means the example compiles without the reported pointer-to-integer error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100