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

log support requires CGO #84

Open
miekg opened this issue Feb 1, 2021 · 4 comments
Open

log support requires CGO #84

miekg opened this issue Feb 1, 2021 · 4 comments

Comments

@miekg
Copy link
Collaborator

miekg commented Feb 1, 2021

#70 and #69 add log support, but it calls a clib, so now we no longer create a static build, but ref libc and friends

This also makes a releasing a no go, because I will probably have an incompatible libc.

go bc -ldflags="-extldflags=-static"  
# github.com/virtual-kubelet/systemk
/usr/bin/ld: /tmp/go-link-075005359/000015.o: in function `_cgo_d744bec0c646_Cfunc_dlopen':
/tmp/go-build/cgo-gcc-prolog:90: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-075005359/000025.o: in function `mygetgrouplist':
/home/miek/up/go/src/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
/usr/bin/ld: /tmp/go-link-075005359/000024.o: in function `mygetgrgid_r':
/home/miek/up/go/src/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
/usr/bin/ld: /tmp/go-link-075005359/000024.o: in function `mygetgrnam_r':
/home/miek/up/go/src/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
/usr/bin/ld: /tmp/go-link-075005359/000024.o: in function `mygetpwnam_r':
/home/miek/up/go/src/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
/usr/bin/ld: /tmp/go-link-075005359/000024.o: in function `mygetpwuid_r':
/home/miek/up/go/src/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
/usr/bin/ld: /tmp/go-link-075005359/000020.o: in function `_cgo_26061493d47f_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
****

This creates a static bin on my setup.
Another downside of cgo is that per go routines stack is no longer 2k, it's 1M or something

@miekg
Copy link
Collaborator Author

miekg commented Feb 1, 2021

mygetgrgid_r warning (and friends) might actually cause breakage

@miekg
Copy link
Collaborator Author

miekg commented Feb 1, 2021

it does run on debian stable

@miekg miekg changed the title Builds pulls in clibs, no longer statically linked log support requires CGO Feb 2, 2021
@miekg
Copy link
Collaborator Author

miekg commented Feb 3, 2021

ok, the dyn. linked binary runs on RH8 - which is good. I'm still going to add the PR to remove this all together, but it seems this usable at this point

miekg added a commit that referenced this issue Feb 4, 2021
This removes the CGO deps and makes for a completely static Go binary.
The downside is that is fork/execs a binary to get to the logs. It
supports the same options as the current impl. A thing that's different
is the time/date output which doesn't match up.

No real intentation to get this merged (current binary runs on RH8 which
I care about atm), but also don't want to loose the code as there were
some tricky bits about tailing the logs and not creating zombie
journalctls.

See #84

Signed-off-by: Miek Gieben <miek@miek.nl>
@pires
Copy link
Member

pires commented Feb 4, 2021

For reference, the code as is in main has been validated by me in RHEL7, RHEL8 and Ubuntu 20.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants