Comments (4)
This was somehow handled by:
But now we have to address the following:
So I would say this issue has become the issue described above.
from libbpfgo.
The Makefile
file in tracee uses pkgconfig
for the libbpf static compilation:
libbpfgo could do the same and use:
// #cgo pkg-config: libelf zlib
to have this issue addressed.
from libbpfgo.
Just faced the exact same bug when trying to run a test here in Tracee with:
tracee/cmd/tracee-ebpf/internal/printer
go test -v
from libbpfgo.
I've struggled the same or almost the same "thing".
So, this code does not work:
CGO_CFLAGS_STATIC = "-I$(abspath $(LIBBPF_DIR))"
CGO_LDFLAGS_STATIC = "-lelf -lz $(LIBBPF_STATIC_LIB)"
CGO_EXTLDFLAGS_STATIC = '-w -extldflags "-static"'
.PHONY: k8s-build-cmd
k8s-build-cmd: $(CMD_K8S_GO_SOURCE) $(TARGET_BPF)
CGO_CFLAGS=$(CGO_CFLAGS_STATIC) \
CGO_LDFLAGS=$(CGO_LDFLAGS_STATIC) \
$(GO) build -x \
-tags netgo -ldflags $(CGO_EXTLDFLAGS_STATIC) \
-o $(TARGET_K8S) ./cmd/kubernetes/$(MAIN).go
but this works well:
CGO_CFLAGS_STATIC = "-I$(abspath $(LIBBPF_DIR))"
CGO_LDFLAGS_STATIC = "-lelf -lz $(LIBBPF_STATIC_LIB)"
GO_EXTLDFLAGS_STATIC = '-w -extldflags "-static $(LIBBPF_STATIC_LIB) -lelf -lz"'
#^ librabbry order is important for GO_EXTLDFLAGS_STATIC
k8s-build-cmd: $(CMD_K8S_GO_SOURCE) $(TARGET_BPF)
CGO_CFLAGS=$(CGO_CFLAGS_STATIC) \
$(GO) build -x \
-tags netgo -ldflags $(GO_EXTLDFLAGS_STATIC) \
-o $(TARGET_K8S) ./cmd/kubernetes/$(MAIN).go
So, the only difference is moving LDFLAGS on the go build level and changing order of the libs.
from libbpfgo.
Related Issues (20)
- Reduce overhead of polling perf buffers HOT 3
- log callback isn't passing the right output level
- log callback is passing escaped output HOT 3
- v0.4.7-libbpf-1.2.0-b2e29a1 tag is released, but libblf v1.2.0 does not exist HOT 6
- Version `v0.4.8.1-libbpf-1.2.0` is not go module / semver compatible HOT 5
- Missing example/selftest: How to Attach a Socket Filter HOT 9
- How to Attach a BPF_PROG_TYPE_SK_MSG HOT 3
- NewModuleFromBufferArgs should not specify BTF if there isn't one
- Split BPFMap API into managed and unmanaged
- Split bpf module, progs, maps into own files
- Wrap C struct field handling
- Split bpf module and program into own files
- LinkType enum needs to align libbpf values
- attach xdp error
- Check type cast results
- [Error] in running go user space code HOT 1
- OSInfo singleton HOT 3
- LIBBPF_MAJOR_VERSION missing HOT 2
- Compiling a user space application that uses libbpfgo as dependency fails HOT 1
- Error compiling go programme HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbpfgo.