-
Notifications
You must be signed in to change notification settings - Fork 225
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
make build error #316
Comments
we need setup test environment on bare metal machine not on docker.
build dynamic and run ebpf_exporter
|
|
using system provided libbpf
|
The answer is the same as with the previous issue: you need static libraries if you want to build a static binary. Your system libbpf is too old to build a dynamically linked binary. |
when I build dynamic not using libbpf system provided, the error
|
You are using system libbpf at runtime when you do this, and it's not new enough. |
we need setup test environment on bare metal machine not on docker.
environment
''' [root@localhost ebpf_exporter]# go version
go version go1.21.2 linux/amd64
[root@localhost ebpf_exporter]# uname -a
Linux localhost.localdomain 5.15.0-101.103.2.1.el9uek.x86_64 #2 SMP Tue May 2 01:10:45 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ebpf_exporter]#
'''
build static
the error
'''
[root@localhost ebpf_exporter]# make build
make build-binary GO_LDFLAGS='-extldflags "-static"'
make[1]: Entering directory '/root/go/src/github.com/cloudflare/ebpf_exporter/ebpf_exporter'
go build -o ebpf_exporter -v -ldflags="-extldflags "-static" -X github.com/prometheus/common/version.Version=v2.2.0-90-g96fe799 -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.Revision=96fe799 -X github.com/prometheus/common/version.BuildUser=[email protected] -X github.com/prometheus/common/version.BuildDate=2023-10-26T19:52:49+08:00" ./cmd/ebpf_exporter
github.com/cloudflare/ebpf_exporter/v2/cmd/ebpf_exporter
github.com/cloudflare/ebpf_exporter/v2/cmd/ebpf_exporter
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lelf
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lresolv
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:65: build-binary] Error 1
make[1]: Leaving directory '/root/go/src/github.com/cloudflare/ebpf_exporter/ebpf_exporter'
make: *** [Makefile:57: build-static] Error 2
[root@localhost ebpf_exporter]# locate libz.so
/usr/lib/libz.so
/usr/lib64/libz.so
/usr/lib64/libz.so.1
/usr/lib64/libz.so.1.2.11
[root@localhost ebpf_exporter]# locate libelf.so
/usr/lib64/libelf.so
/usr/lib64/libelf.so.1
[root@localhost ebpf_exporter]# locate libresolv.so
/usr/lib64/libresolv.so
/usr/lib64/libresolv.so.2
[root@localhost ebpf_exporter]#
'''
build dynamic and run ebpf_exporter
the error
'''
[root@localhost ebpf_exporter]# make build-dynamic
make build-binary
make[1]: Entering directory '/root/go/src/github.com/cloudflare/ebpf_exporter/ebpf_exporter'
go build -o ebpf_exporter -v -ldflags=" -X github.com/prometheus/common/version.Version=v2.2.0-90-g96fe799 -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.Revision=96fe799 -X github.com/prometheus/common/version.BuildUser=[email protected] -X github.com/prometheus/common/version.BuildDate=2023-10-26T19:54:31+08:00" ./cmd/ebpf_exporter
github.com/cloudflare/ebpf_exporter/v2/cmd/ebpf_exporter
make[1]: Leaving directory '/root/go/src/github.com/cloudflare/ebpf_exporter/ebpf_exporter'
[root@localhost ebpf_exporter]# ./ebpf_exporter --config.dir=examples --config.names=biolatency
./ebpf_exporter: /usr/lib64/libbpf.so.1: version `LIBBPF_1.2.0' not found (required by ./ebpf_exporter)
[root@localhost ebpf_exporter]#
'''
The text was updated successfully, but these errors were encountered: