crawshaw / sqlite

Go SQLite3 driver
ISC License
561 stars 67 forks source link

Compile Time error #125

Closed gitpubber closed 2 years ago

gitpubber commented 3 years ago

I am getting these warning. Is there a way to disable them ?


# command-line-arguments
/bin/ld: /tmp/go-link-601814297/000024.o: in function `unixDlOpen':
/_/crawshaw.io/sqlite@v0.3.3-0.20210127221821-98b1f83c5508/./c/sqlite3.c:39880: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: /tmp/go-link-601814297/000042.o: in function `mygetgrouplist':
/_/os/user/getgrouplist_unix.go:16: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: /tmp/go-link-601814297/000041.o: in function `mygetgrgid_r':
/_/os/user/cgo_lookup_unix.go:38: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: /tmp/go-link-601814297/000041.o: in function `mygetgrnam_r':
/_/os/user/cgo_lookup_unix.go:43: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: /tmp/go-link-601814297/000041.o: in function `mygetpwnam_r':
/_/os/user/cgo_lookup_unix.go:33: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: /tmp/go-link-601814297/000041.o: in function `mygetpwuid_r':
/_/os/user/cgo_lookup_unix.go:28: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking```
anacrolix commented 3 years ago

I've had something similar, I believe a flag for statically linking fixed it.

gitpubber commented 2 years ago

@anacrolix How did you fix it on non-musl distro ? I don't get this warning only when I compile it on musl based distro like alpine

anacrolix commented 2 years ago

Here's a snippet from the build script I had to cross compile from MacOS for linux:

# You might need some cross-compiler stuff installed from Homebrew.
set -eux
CXX=x86_64-linux-musl-g++ CC=x86_64-linux-musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
    go build \
    -mod=readonly `# Ignore vendor directory produced by docker make targets` \
    -v -ldflags="-extldflags=-static"
gitpubber commented 2 years ago

Ok, I installed musl toolchain and problem got solved. Thanks @anacrolix

gitpubber commented 2 years ago

@anacrolix How to cross compile from linux to macos ? I don't have x86_64-apple-musl-gcc available