bytedance / netcap

Apache License 2.0
639 stars 83 forks source link

failed to build with error "not enough arguments in call to (_C2func_bcc_func_load)" #4

Open pansila opened 3 months ago

pansila commented 3 months ago

I built and installed bcc from source by following the doc https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---source but failed to build netcap.

Ubuntu 20.04 LTS AMD64
Kernel version: 5.15.112
go version go1.22.6 linux/amd64
make
# github.com/iovisor/gobpf/bcc
../../go/pkg/mod/github.com/iovisor/gobpf@v0.2.0/bcc/module.go:230:132: not enough arguments in call to (_C2func_bcc_func_load)
        have (unsafe.Pointer, _Ctype_int, *_Ctype_char, *_Ctype_struct_bpf_insn, _Ctype_int, *_Ctype_char, _Ctype_uint, _Ctype_int, *_Ctype_char, _Ctype_uint, nil)
        want (unsafe.Pointer, _Ctype_int, *_Ctype_char, *_Ctype_struct_bpf_insn, _Ctype_int, *_Ctype_char, _Ctype_uint, _Ctype_int, *_Ctype_char, _Ctype_uint, *_Ctype_char, _Ctype_int)
make: *** [Makefile:6: netcap] Error 1
evilsp commented 3 months ago

Your BCC version is lower than v0.25.0, change your BCC version and try again

FireExtin commented 3 months ago

update your go.mod to github.com/iovisor/gobpf v0.2.1-0.20221005153822-16120a1bf4d4 may help

wd34zc commented 3 months ago

我也遇到这个问题,BCC改成0.24.0版本可以修复这个问题。

git clone --branch v0.24.0 https://github.com/iovisor/bcc.git

make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd
pansila commented 3 months ago

update your go.mod to github.com/iovisor/gobpf v0.2.1-0.20221005153822-16120a1bf4d4 may help

Can't get this version from repository, not work either by directly changing go.mod as go.sum is different. Do you know what is wrong? Thanks.

go get github.com/iovisor/gobpf v0.2.1-0.20221005153822-16120a1bf4d4
go: downloading github.com/iovisor/gobpf v0.2.1-0.20221005153822-16120a1bf4d4
go: module v0.2.1-0.20221005153822-16120a1bf4d4: reading https://goproxy.cn/v0.2.1-0.20221005153822-16120a1bf4d4/@v/list: 404 Not Found
        server response: not found: v0.2.1-0.20221005153822-16120a1bf4d4@latest: unrecognized import path "v0.2.1-0.20221005153822-16120a1bf4d4": https fetch: Get "https://v0.2.1-0.20221005153822-16120a1bf4d4/?go-get=1": dial tcp: lookup v0.2.1-0.20221005153822-16120a1bf4d4 on 8.8.8.8:53: no such host
go get github.com/iovisor/gobpf v0.2.1
go: module v0.2.1: reading https://goproxy.cn/v0.2.1/@v/list: 404 Not Found
        server response: not found: v0.2.1@latest: unrecognized import path "v0.2.1": https fetch: Get "https://v0.2.1/?go-get=1": dial tcp: lookup v0.2.1 on 8.8.8.8:53: no such host
pansila commented 3 months ago

我也遇到这个问题,BCC改成0.24.0版本可以修复这个问题。

git clone --branch v0.24.0 https://github.com/iovisor/bcc.git

make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd

It works, thanks.

codecoron commented 3 months ago

我也遇到这个问题,BCC改成0.24.0版本可以修复这个问题。

git clone --branch v0.24.0 https://github.com/iovisor/bcc.git

make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd

It is brach v0.24.0 exists ?

git clone --branch v0.24.0 https://github.com/iovisor/bcc.git Cloning into 'bcc'... remote: Enumerating objects: 29230, done. remote: Counting objects: 100% (2910/2910), done. remote: Compressing objects: 100% (542/542), done. remote: Total 29230 (delta 2512), reused 2443 (delta 2366), pack-reused 26320 (from 1) Receiving objects: 100% (29230/29230), 20.49 MiB | 7.17 MiB/s, done. Resolving deltas: 100% (19488/19488), done. Note: switching to '8f40d6f57a8d94e7aee74ce358572d34d31b4ed4'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false