Skip to content

Use static linking on AMD64 #1051

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

Closed
danielt998 opened this issue Jan 10, 2024 · 0 comments · Fixed by #1052
Closed

Use static linking on AMD64 #1051

danielt998 opened this issue Jan 10, 2024 · 0 comments · Fixed by #1052

Comments

@danielt998
Copy link

danielt998 commented Jan 10, 2024

We have noticed errors when running in an environment using GLIBC<2.32. As far as we can tell, the ARM and x86 versions are using static linking but AMD64 is dynamic. I think using static for all environments would help prevent errors like these and make things more portable, and as far as I can tell that's a pretty common practice for protoc-gen plugins.

Using file protoc-gen-validate for the ARM64 download gives:
`protoc-gen-validate: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=<....>

and AMD64:
protoc-gen-validate: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=<....>

rodaine added a commit that referenced this issue Jan 12, 2024
This patch ensures cgo is disabled when building releases for PGV,
making the binaries statically-linked for all targeted linux
architectures.

Fixes #1051 

Verified locally with `goreleaser build`:

```sh
$ file protoc-gen-validate_linux_amd64_v1/protoc-gen-validate 
protoc-gen-validate: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=tb7sMSnjQh-7-8dwj-lH/T9787ev59A_KyorW6mad/v6PRV3ZwTB6tQWHc6xHc/T7TZq-XGFpsGNognhgR4, stripped

$ file protoc-gen-validate_linux_arm64/protoc-gen-validate
protoc-gen-validate: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=vCwX0aApdg5K4vpifCvn/5E2XJTfVojTMaqafL4ut/QlkXLuZKKxztZHPB5JGZ/Gd0NEotlWEWiD4KPwzjb, stripped

$ file protoc-gen-validate_linux_386/protoc-gen-validate
protoc-gen-validate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, Go BuildID=iWuJ8rzabo476SePT-ZW/SXAZx5iKhXr-qmQoQQy7/3IJw81PJ0cqeBGfOn8B8/FFRtPeAP0sXRDg17K8TB, stripped

```
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

Successfully merging a pull request may close this issue.

1 participant