ngs / go-release.action

Automate publishing Go build artifacts for GitHub releases through GitHub Actions
https://github.com/marketplace/actions/go-release-binary
94 stars 66 forks source link

musl is required to run 64 bits binaries #6

Open BenjaminNavarro opened 4 years ago

BenjaminNavarro commented 4 years ago

I just tried to used this action on one of my project but I can't run the generated Linux AMD64 version on my Linux AMD64 machine.

It seems to be related to the dynamic linking to the musl C standard library:

./my-generated-exe-amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, Go BuildID=EmDsSWNEfmQPkFFReAgq/dJXhA5cdfTA7Hjt5NAr_/x6hwGePSXNBHuxESCok8/OgK2kl0KXGeheYHuSau3, not stripped

ldd ./my-generated-exe-amd64
    linux-vdso.so.1 (0x00007ffc7b327000)
    libc.musl-x86_64.so.1 => not found

However, the i386 version works fine and is statically linked:

file ./docker-manager
./my-generated-exe-i386: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, Go BuildID=y1r_iZoir6tGXmSRok8q/YdxAzTSJRZV17bSFn5r4/AtCijuMBQ5R07GgeAe1b/xsie6X5UnPs1fnjuhsv8, not stripped

ldd ./my-generated-exe-i386
    not a dynamic executable

Could this be solved by statically link the AMD64 version also? Or maybe switch to libc which is more commonly available?

wangyoucao577 commented 4 years ago

@BenjaminNavarro This action implements based on golang:<version>-alpine, and the musl libc dependency issue is a widely known issue of it. I have met this issue too, and I have solved it in my implementation. You may want to have a try my implementation(https://github.com/marketplace/actions/go-release-binaries) if you're still troubled on it.