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

Makefile build options do not generate static binaries #48

Closed
atc0005 opened this issue Oct 3, 2020 · 2 comments · Fixed by #52
Closed

Makefile build options do not generate static binaries #48

atc0005 opened this issue Oct 3, 2020 · 2 comments · Fixed by #52
Assignees
Labels
bug Something isn't working builds
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Oct 3, 2020

Same here as with atc0005/check-mail#94.

@atc0005 atc0005 added bug Something isn't working builds labels Oct 3, 2020
@atc0005 atc0005 added this to the Next Release milestone Oct 3, 2020
@atc0005 atc0005 self-assigned this Oct 3, 2020
@atc0005 atc0005 changed the title Makefile build options does not generate static binaries Makefile build options do not generate static binaries Oct 3, 2020
@atc0005
Copy link
Owner Author

atc0005 commented Oct 9, 2020

$ file release_assets/*/*
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-linux-386:         ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-linux-amd64:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-windows-386.exe:   PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-windows-amd64.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-linux-386:             ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-linux-amd64:           ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-windows-386.exe:       PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-windows-amd64.exe:     PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows

Looks like the 32-bit Linux binaries are already static, but the 64-bit Linux binaries are dynamically linked. Will try applying build tags to prefer Go's user and net support.

@atc0005
Copy link
Owner Author

atc0005 commented Oct 9, 2020

Will try applying build tags to prefer Go's user and net support.

That did the trick:

$ file release_assets/*/*
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-dirty-linux-386:         ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-dirty-linux-amd64:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-dirty-windows-386.exe:   PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
release_assets/hayoh/hayoh-v0.1.2-20-ge097f3c-dirty-windows-amd64.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-dirty-linux-386:             ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-dirty-linux-amd64:           ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-dirty-windows-386.exe:       PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
release_assets/n2n/n2n-v0.1.2-20-ge097f3c-dirty-windows-amd64.exe:     PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows

atc0005 added a commit that referenced this issue Oct 9, 2020
By using these build tags we can generate native static
binaries without dynamic linkage.

refs GH-48
atc0005 added a commit that referenced this issue Oct 9, 2020
By using these build tags we can generate native static
binaries without dynamic linkage.

refs GH-48
atc0005 added a commit that referenced this issue Oct 9, 2020
By using these build tags we can generate native static
binaries without dynamic linkage.

By using `CGO_ENABLED=0` we try to prevent unintentional libc
dependencies from slipping in if we pull in additional
dependencies in the future.

refs GH-48
atc0005 added a commit that referenced this issue Oct 9, 2020
By using these build tags we can generate native static
binaries without dynamic linkage.

By using `CGO_ENABLED=0` we try to prevent unintentional libc
dependencies from slipping in if we pull in additional
dependencies in the future.

refs GH-48
atc0005 added a commit that referenced this issue Oct 9, 2020
By using these build tags we can generate native static
binaries without dynamic linkage.

By using `CGO_ENABLED=0` we try to prevent unintentional libc
dependencies from slipping in if we pull in additional
dependencies in the future.

refs GH-48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builds
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant