From 6b36b756eb4b4c26b98d405310680ebe5679d111 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 15 May 2019 21:47:15 -0400 Subject: fix static builds of zig from requiring c compiler to be installed when linking libc. When zig links against libc, it requires a dynamic linker path. Usually this can be determined based on the architecture and operating system components of the target. However on some systems this is not correct; because of this zig checks its own dynamic linker. When zig is statically linked, this information is not available, and so it resorts to using cc -print-filename=foo to find the dynamic linker path. Before this commit, Zig incorrectly exited with an error if there was no c compiler installed. Now, Zig falls back to the dynamic linker determined based on the arch and os when no C compiler can be found. --- src/link.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/link.cpp') diff --git a/src/link.cpp b/src/link.cpp index 7566838a36..538d663b03 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -34,6 +34,7 @@ static CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, Ou child_gen->verbose_cimport = parent_gen->verbose_cimport; child_gen->verbose_cc = parent_gen->verbose_cc; child_gen->llvm_argv = parent_gen->llvm_argv; + child_gen->dynamic_linker_path = parent_gen->dynamic_linker_path; codegen_set_strip(child_gen, parent_gen->strip_debug_symbols); child_gen->want_pic = parent_gen->have_pic ? WantPICEnabled : WantPICDisabled; -- cgit v1.2.3