GithubHelp home page GithubHelp logo

build failure about pwru HOT 5 CLOSED

cilium avatar cilium commented on May 27, 2024
build failure

from pwru.

Comments (5)

zhangbo1882 avatar zhangbo1882 commented on May 27, 2024 1

issue has been fixed.

from pwru.

zhangbo1882 avatar zhangbo1882 commented on May 27, 2024

KProbePWRUObjects should have nothing with Go version.

from pwru.

brb avatar brb commented on May 27, 2024

@zhangbo1882 Hey, have you run go generate . before running go build .?

from pwru.

zhangbo1882 avatar zhangbo1882 commented on May 27, 2024

@brb
[Tue Oct 19 02:16:01][#107# ] (master)$go generate .
/home/stack/go/src/github.com/zhangbo1882/pwru/bpf/kprobe_pwru.c:238:14: error: use of unknown builtin '__builtin_btf_type_id' [-Wimplicit-function-declaration]
p.type_id = bpf_core_type_id_kernel(struct sk_buff);
^
./bpf/headers/bpf_core_read.h:145:2: note: expanded from macro 'bpf_core_type_id_kernel'
__builtin_btf_type_id(*(typeof(type) )0, BPF_TYPE_ID_TARGET)
^
/home/stack/go/src/github.com/zhangbo1882/pwru/bpf/kprobe_pwru.c:238:14: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
p.type_id = bpf_core_type_id_kernel(struct sk_buff);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bpf/headers/bpf_core_read.h:145:24: note: expanded from macro 'bpf_core_type_id_kernel'
__builtin_btf_type_id(
(typeof(type) )0, BPF_TYPE_ID_TARGET)
^~~~~~~~~~~~~~~~~~
/home/stack/go/src/github.com/zhangbo1882/pwru/bpf/kprobe_pwru.c:238:14: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
./bpf/headers/bpf_core_read.h:145:24: note: expanded from macro 'bpf_core_type_id_kernel'
__builtin_btf_type_id(
(typeof(type) *)0, BPF_TYPE_ID_TARGET)
^
/home/stack/go/src/github.com/zhangbo1882/pwru/bpf/kprobe_pwru.c:267:21: warning: taking address of packed member 'print_skb_id' of class or structure 'event_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
set_skb_btf(skb, &event->print_skb_id);
^~~~~~~~~~~~~~~~~~~
2 warnings and 1 error generated.
Error: clang: exit status 1
exit status 1
main.go:28: running "go": exit status 1

from pwru.

twpayne avatar twpayne commented on May 27, 2024

What version of clang are you using, i.e. what is the output of:

$ clang --version

You need Clang version 12 or later. Depending on your distribution, you may also have to update the //go:generate lines in main.go to use clang-12 instead of clang:

diff --git a/main.go b/main.go
index 2d9428e..f279ae1 100644
--- a/main.go
+++ b/main.go
@@ -25,8 +25,8 @@ import (
        "github.com/cilium/pwru/internal/pwru"
 )
 
-//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang KProbePWRU ./bpf/kprobe_pwru.c -- -DOUTPUT_SKB -I./bpf/headers
-//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang KProbePWRUWithoutOutputSKB ./bpf/kprobe_pwru.c -- -I./bpf/headers
+//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang-12 KProbePWRU ./bpf/kprobe_pwru.c -- -DOUTPUT_SKB -I./bpf/headers
+//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang-12 KProbePWRUWithoutOutputSKB ./bpf/kprobe_pwru.c -- -I./bpf/headers
 
 func main() {
        var (

and then re-run go generate.

from pwru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.