Skip to content

Commit

Permalink
chore!: pin the default glibc version to 2.17
Browse files Browse the repository at this point in the history
This is reportedly the lowest glibc version number that Zig's own
standard library supports, see
https://github.com/ziglang/zig/blob/0.12.0/lib/libc/glibc/README.md?plain=1#L33-L34.

Note, users can configure their own glibc version, see
#169.

Without this change the test at `//zig/runfiles:test` failed on the
BuildBuddy default remote execution Docker image with an error of the
form
```
/buildbuddy/remotebuilds/ace1eb7e-d203-470d-978b-3e7634972e45/bazel-out/k8-fastbuild/bin/zig/runfiles/test.runfiles/_main/zig/runfiles/test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /buildbuddy/remotebuilds/ace1eb7e-d203-470d-978b-3e7634972e45/bazel-out/k8-fastbuild/bin/zig/runfiles/test.runfiles/_main/zig/runfiles/test)
```

BREAKING CHANGE: The default glibc version is now pinned at 2.17.
  • Loading branch information
aherrmann committed May 10, 2024
1 parent 56344b5 commit a2b0e63
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
5 changes: 3 additions & 2 deletions e2e/workspace/location-expansion/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ test "-DTARGET is set" {
test "-DZIG_TARGET is set" {
const actual_target = try builtin.target.linuxTriple(std.testing.allocator);
defer std.testing.allocator.free(actual_target);
try std.testing.expectEqualStrings(
actual_target,
// TODO revert to an equality check.
try std.testing.expectStringStartsWith(
std.mem.sliceTo(zig_target, 0),
actual_target,
);
}

Expand Down
8 changes: 4 additions & 4 deletions zig/target/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ toolchain(

zig_target_toolchain(
name = "x86_32-linux-gnu",
target = "x86-linux-gnu",
target = "x86-linux-gnu.2.17",
)

toolchain(
Expand Down Expand Up @@ -112,7 +112,7 @@ toolchain(

zig_target_toolchain(
name = "x86_64-linux-gnu",
target = "x86_64-linux-gnu",
target = "x86_64-linux-gnu.2.17",
)

toolchain(
Expand Down Expand Up @@ -160,7 +160,7 @@ toolchain(

zig_target_toolchain(
name = "ppc-linux-gnu",
target = "powerpc-linux-gnu",
target = "powerpc-linux-gnu.2.17",
)

toolchain(
Expand Down Expand Up @@ -219,7 +219,7 @@ toolchain(

zig_target_toolchain(
name = "aarch64-linux-gnu",
target = "aarch64-linux-gnu",
target = "aarch64-linux-gnu.2.17",
)

toolchain(
Expand Down
20 changes: 10 additions & 10 deletions zig/tests/target_platform_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def _define_target_platform_test(target, option):
config_settings = {_TARGET_PLATFORM: target},
)

_target_platform_x86_64_linux_test = _define_target_platform_test(_PLATFORM_X86_64_LINUX, "x86_64-linux-gnu")
_target_platform_x86_64_linux_test = _define_target_platform_test(_PLATFORM_X86_64_LINUX, "x86_64-linux-gnu.2.17")
_target_platform_x86_64_linux_musl_test = _define_target_platform_test(_PLATFORM_X86_64_LINUX_MUSL, "x86_64-linux-musl")
_target_platform_aarch64_linux_test = _define_target_platform_test(_PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu")
_target_platform_aarch64_linux_test = _define_target_platform_test(_PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu.2.17")
_target_platform_aarch64_linux_none_test = _define_target_platform_test(_PLATFORM_AARCH64_LINUX_NONE, "aarch64-linux-none")
_target_platform_x86_64_windows_test = _define_target_platform_test(_PLATFORM_X86_64_WINDOWS, "x86_64-windows-gnu")
_target_platform_x86_64_windows_none_test = _define_target_platform_test(_PLATFORM_X86_64_WINDOWS_NONE, "x86_64-windows-none")
Expand All @@ -59,30 +59,30 @@ def _define_build_target_platform_test(mnemonic, target, option):
config_settings = {_TARGET_PLATFORM: target},
)

_build_exe_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu")
_build_exe_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu.2.17")
_build_exe_target_platform_x86_64_linux_musl_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_X86_64_LINUX_MUSL, "x86_64-linux-musl")
_build_exe_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu")
_build_exe_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu.2.17")
_build_exe_target_platform_aarch64_linux_none_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_AARCH64_LINUX_NONE, "aarch64-linux-none")
_build_exe_target_platform_x86_64_windows_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_X86_64_WINDOWS, "x86_64-windows-gnu")
_build_exe_target_platform_x86_64_windows_none_test = _define_build_target_platform_test("ZigBuildExe", _PLATFORM_X86_64_WINDOWS_NONE, "x86_64-windows-none")

_build_lib_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu")
_build_lib_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu.2.17")
_build_lib_target_platform_x86_64_linux_musl_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_X86_64_LINUX_MUSL, "x86_64-linux-musl")
_build_lib_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu")
_build_lib_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu.2.17")
_build_lib_target_platform_aarch64_linux_none_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_AARCH64_LINUX_NONE, "aarch64-linux-none")
_build_lib_target_platform_x86_64_windows_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_X86_64_WINDOWS, "x86_64-windows-gnu")
_build_lib_target_platform_x86_64_windows_none_test = _define_build_target_platform_test("ZigBuildLib", _PLATFORM_X86_64_WINDOWS_NONE, "x86_64-windows-none")

_build_shared_lib_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu")
_build_shared_lib_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu.2.17")
_build_shared_lib_target_platform_x86_64_linux_musl_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_X86_64_LINUX_MUSL, "x86_64-linux-musl")
_build_shared_lib_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu")
_build_shared_lib_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu.2.17")
_build_shared_lib_target_platform_aarch64_linux_none_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_AARCH64_LINUX_NONE, "aarch64-linux-none")
_build_shared_lib_target_platform_x86_64_windows_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_X86_64_WINDOWS, "x86_64-windows-gnu")
_build_shared_lib_target_platform_x86_64_windows_none_test = _define_build_target_platform_test("ZigBuildSharedLib", _PLATFORM_X86_64_WINDOWS_NONE, "x86_64-windows-none")

_build_test_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu")
_build_test_target_platform_x86_64_linux_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_X86_64_LINUX, "x86_64-linux-gnu.2.17")
_build_test_target_platform_x86_64_linux_musl_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_X86_64_LINUX_MUSL, "x86_64-linux-musl")
_build_test_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu")
_build_test_target_platform_aarch64_linux_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_AARCH64_LINUX, "aarch64-linux-gnu.2.17")
_build_test_target_platform_aarch64_linux_none_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_AARCH64_LINUX_NONE, "aarch64-linux-none")
_build_test_target_platform_x86_64_windows_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_X86_64_WINDOWS, "x86_64-windows-gnu")
_build_test_target_platform_x86_64_windows_none_test = _define_build_target_platform_test("ZigBuildTest", _PLATFORM_X86_64_WINDOWS_NONE, "x86_64-windows-none")
Expand Down

0 comments on commit a2b0e63

Please sign in to comment.