authorgravatar for hb@hash.aihaze <hb@hash.ai> 2020-07-15 22:37:04-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-07-15 22:37:04-04:00
log82562b205f9d99c27c4d5224311734e141bf2fda
tree809850807d9c3ac439f3b5e1a5d652f538198dd0
parent6b103324d2d935260138584877dbe1593790b953
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

On darwin, only add the self exe to the cache hash for compiler id (#5880)

Now that Big Sur does not have system libraries on the filesystem, zig can no longer read them and add them to the cache hash for the compiler id. This changes it so that only the first library path returned by os_self_exe_shared_libs is added to the cache hash under Darwin. I looked into methods on getting the system version to keep parity with older versions, but @fengb reported that this works on Catalina (a version behind Big Sur) Signed-off-by: Haze Booth <isnt@haze.cool>

1 files changed, 8 insertions(+), 0 deletions(-)

src/compiler.cpp+8
...@@ -38,11 +38,19 @@ Error get_compiler_id(Buf **result) {...@@ -38,11 +38,19 @@ Error get_compiler_id(Buf **result) {
38 ZigList<Buf *> lib_paths = {};38 ZigList<Buf *> lib_paths = {};
39 if ((err = os_self_exe_shared_libs(lib_paths)))39 if ((err = os_self_exe_shared_libs(lib_paths)))
40 return err;40 return err;
41 #if defined(ZIG_OS_DARWIN)
42 // only add the self exe path on mac os
43 Buf *lib_path = lib_paths.at(0);
44 if ((err = cache_add_file(ch, lib_path)))
45 return err;
46 #else
41 for (size_t i = 0; i < lib_paths.length; i += 1) {47 for (size_t i = 0; i < lib_paths.length; i += 1) {
42 Buf *lib_path = lib_paths.at(i);48 Buf *lib_path = lib_paths.at(i);
43 if ((err = cache_add_file(ch, lib_path)))49 if ((err = cache_add_file(ch, lib_path)))
44 return err;50 return err;
45 }51 }
52 #endif
53
46 if ((err = cache_final(ch, &saved_compiler_id)))54 if ((err = cache_final(ch, &saved_compiler_id)))
47 return err;55 return err;
4856