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

Inclusion of toolchain forces static=on Go Targets to Dynamically Link #193

Closed
zachcoleman opened this issue Aug 27, 2024 · 2 comments
Closed

Comments

@zachcoleman
Copy link

zachcoleman commented Aug 27, 2024

The description pretty much says it all.

Maybe I don't know enough about this toolchain, but including it as a module and registering Zig toolchains has forced normally statically linked Go targets to become dynamically linked.

Before:

ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for GNU/Linux 3.7.0, Go BuildID=redacted, BuildID[sha1]=a3055087e190f1087358decf3ff32c494c13fd58, stripped

After:

ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 2.0.0, Go BuildID=redacted, stripped

Using Bazel:

go_binary(
    name = ...,
    data = ...,
    embed = ...,
    static = "on",
    visibility = ["//visibility:public"],
)

Is there a way to maintain for other targets the correct behavior? This an only Go code target.

@zachcoleman
Copy link
Author

Is this due to #171 ?

@zachcoleman
Copy link
Author

Or is this a feature of Zig compiler itself that prevents the static linking of glibc (forcing good behavior).

rust-cross/cargo-zigbuild#231 (comment)

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

1 participant