Skip to content
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

How to statically compile in golang so library is included? #47

Open
shrinidhi111 opened this issue Sep 12, 2023 · 0 comments
Open

How to statically compile in golang so library is included? #47

shrinidhi111 opened this issue Sep 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@shrinidhi111
Copy link

Description

When deploying the binary, it also expects the library (.so file) available at system level

I tried keeping this file next to the binary but it did not work

Is there a way to statically compile in golang so one binary has all its dependencies?

What I tried

go build -ldflags="-extldflags=-static"

Error I got

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lobjectbox: No such file or directory
/usr/bin/ld: /tmp/go-link-2309517836/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
collect2: error: ld returned 1 exit status
@shrinidhi111 shrinidhi111 added the bug Something isn't working label Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant