hillu / go-yara

Go bindings for YARA
BSD 2-Clause "Simplified" License
356 stars 113 forks source link

static build failed: undefined reference to `log2' #113

Closed wangdawai closed 1 year ago

wangdawai commented 1 year ago

Build command: GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-extldflags "-static"' -tags yara_static gcc -v: gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) centos7

go build can build success.

error log

/tmp/go-link-2475465565/000035.o: In function mygetgrouplist': /_/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 /tmp/go-link-2475465565/000034.o: In functionmygetgrgidr': //os/user/cgo_lookup_cgo.go:45: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/go-link-2475465565/000034.o: In function mygetgrnam_r': /_/os/user/cgo_lookup_cgo.go:54: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/go-link-2475465565/000034.o: In functionmygetpwnamr': //os/user/cgo_lookup_cgo.go:36: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/go-link-2475465565/000034.o: In function mygetpwuid_r': /_/os/user/cgo_lookup_cgo.go:27: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/go-link-2475465565/000004.o: In function_cgo_cbcce81e6342_C2func_getaddrinfo': /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 /home/chenshichao/download/libyara/lib/libyara.a(math.o): In function string_entropy': math.c:(.text+0x91b): undefined reference tolog2' /home/chenshichao/download/libyara/lib/libyara.a(math.o): In function data_entropy': math.c:(.text+0x10a8): undefined reference tolog2' collect2: error: ld returned 1 exit status