buger/goreplay

make build error, ldbus

tianxiao1988 opened this issue · 0 comments

Hi,
I want to build goreplay myself, I build it in docker, this is my Dockerfile,

FROM golang:1.19

安装 tcpdump 和 curl

RUN apt-get update && apt-get install -y tcpdump curl libpcap-dev ruby vim-common flex bison
#RUN apt-get -y dbus-devel

将 Dockerfile 所在目录下的所有源码复制到容器中

COPY . /goreplay

设置工作目录

WORKDIR /goreplay
#RUN go mod vendor

执行 make build

RUN make build

but when I run docker build with this dockerfile, I met error:

=> ERROR [5/5] RUN make build 404.0s

[5/5] RUN make build:
#7 0.274 go build -mod=vendor -o gor -ldflags "-X main.VERSION=DEV-1687924070 -extldflags "-static" -X main.DEMO="
#7 403.4 # github.com/buger/goreplay
#7 403.4 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
#7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000026.o: in function mygetgrouplist': #7 403.4 /_/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000025.o: in function mygetgrgid_r':
#7 403.4 //os/user/cgo_lookup_unix.go:37: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000025.o: in function mygetgrnam_r': #7 403.4 /_/os/user/cgo_lookup_unix.go:42: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000025.o: in function mygetpwnam_r':
#7 403.4 /
/os/user/cgo_lookup_unix.go:32: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000025.o: in function mygetpwuid_r': #7 403.4 /_/os/user/cgo_lookup_unix.go:27: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #7 403.4 /usr/bin/ld: /tmp/go-link-1496318900/000004.o: in function _cgo_2ac87069779a_C2func_getaddrinfo':
#7 403.4 /tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function pcap_nametoaddr': #7 403.4 (.text+0x5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function pcap_nametonetaddr':
#7 403.4 (.text+0xed): warning: Using 'getnetbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function pcap_nametoproto': #7 403.4 (.text+0x49f): warning: Using 'getprotobyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function dbus_write':
#7 403.4 (.text+0xff): undefined reference to dbus_message_demarshal' #7 403.4 /usr/bin/ld: (.text+0x115): undefined reference to dbus_connection_send'
#7 403.4 /usr/bin/ld: (.text+0x11e): undefined reference to dbus_connection_flush' #7 403.4 /usr/bin/ld: (.text+0x126): undefined reference to dbus_message_unref'
#7 403.4 /usr/bin/ld: (.text+0x174): undefined reference to dbus_error_free' #7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function dbus_read':
#7 403.4 (.text+0x1c0): undefined reference to dbus_connection_pop_message' #7 403.4 /usr/bin/ld: (.text+0x1e2): undefined reference to dbus_connection_pop_message'
#7 403.4 /usr/bin/ld: (.text+0x1f8): undefined reference to dbus_connection_read_write' #7 403.4 /usr/bin/ld: (.text+0x262): undefined reference to dbus_message_is_signal'
#7 403.4 /usr/bin/ld: (.text+0x27e): undefined reference to dbus_message_marshal' #7 403.4 /usr/bin/ld: (.text+0x2e6): undefined reference to dbus_free'
#7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function dbus_cleanup': #7 403.4 (.text+0x34c): undefined reference to dbus_connection_unref'
#7 403.4 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function dbus_activate': #7 403.4 (.text+0x3f6): undefined reference to dbus_connection_open'
#7 403.4 /usr/bin/ld: (.text+0x40e): undefined reference to dbus_bus_register' #7 403.4 /usr/bin/ld: (.text+0x4fc): undefined reference to dbus_bus_add_match'
#7 403.4 /usr/bin/ld: (.text+0x504): undefined reference to dbus_error_is_set' #7 403.4 /usr/bin/ld: (.text+0x54b): undefined reference to dbus_bus_get'
#7 403.4 /usr/bin/ld: (.text+0x57c): undefined reference to dbus_error_free' #7 403.4 /usr/bin/ld: (.text+0x58d): undefined reference to dbus_bus_add_match'
#7 403.4 /usr/bin/ld: (.text+0x595): undefined reference to dbus_error_is_set' #7 403.4 /usr/bin/ld: (.text+0x5ce): undefined reference to dbus_error_free'
#7 403.4 /usr/bin/ld: (.text+0x5da): undefined reference to dbus_connection_unref' #7 403.4 /usr/bin/ld: (.text+0x606): undefined reference to dbus_bus_get'
#7 403.4 /usr/bin/ld: (.text+0x642): undefined reference to dbus_error_free' #7 403.4 /usr/bin/ld: (.text+0x655): undefined reference to dbus_connection_set_max_received_size'
#7 403.4 /usr/bin/ld: (.text+0x666): undefined reference to dbus_connection_unref' #7 403.4 /usr/bin/ld: (.text+0x6dc): undefined reference to dbus_error_free'
#7 403.4 /usr/bin/ld: (.text+0x71a): undefined reference to `dbus_error_free'
#7 403.4 collect2: error: ld returned 1 exit status
#7 403.4
#7 403.9 make: *** [Makefile:81: build] Error 2


executor failed running [/bin/sh -c make build]: exit code: 2

I have try to :
LDFLAGS += -ldbus
but not work

also I try to install with command: apt-get install -y dbus-devel, but fail when try to install dbus-devel.

What should I do now? I need your help ~~