authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-11 13:39:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-11 13:39:58-07:00
logaec0e595f2a679f10e927ea4531b8f58ced7080a
treee1ec39679ef8636cbac1ad541892fd59b8a92543
parent4fd4c733d4676ee50667ca895259b277966f15c6

stage2: no condition on system libs to link native libc

Before, Zig tried to use its own libc files (e.g. glibc) when there were no system libs being linked. This prevented building against native glibc on systems that have newer glibc than the ones Zig provides. Closes #12797

1 files changed, 1 insertions(+), 3 deletions(-)

src/Compilation.zig+1-3
......@@ -1238,7 +1238,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
12381238 options.target,
12391239 options.is_native_abi,
12401240 link_libc,
1241 options.system_lib_names.len != 0 or options.frameworks.count() != 0,
12421241 options.libc_installation,
12431242 options.native_darwin_sdk != null,
12441243 );
......@@ -4522,7 +4521,6 @@ fn detectLibCIncludeDirs(
45224521 target: Target,
45234522 is_native_abi: bool,
45244523 link_libc: bool,
4525 link_system_libs: bool,
45264524 libc_installation: ?*const LibCInstallation,
45274525 has_macos_sdk: bool,
45284526) !LibCDirs {
......@@ -4539,7 +4537,7 @@ fn detectLibCIncludeDirs(
45394537
45404538 // If linking system libraries and targeting the native abi, default to
45414539 // using the system libc installation.
4542 if (link_system_libs and is_native_abi and !target.isMinGW()) {
4540 if (is_native_abi and !target.isMinGW()) {
45434541 if (target.isDarwin()) {
45444542 return if (has_macos_sdk)
45454543 // For Darwin/macOS, we are all set with getDarwinSDK found earlier.