@@ -440,9 +440,13 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
440440 # build-id is not supported on macOS compilers
441441 if ! Sys. isapple (p)
442442 # Windows build-id requires binutils 2.25+, which we only have for GCC 5+
443- if ! Sys. iswindows (p) || (Sys. iswindows (p) && gcc_version ≥ v " 5" )
443+ if ! Sys. iswindows (p) || (Sys. iswindows (p) && gcc_version ≥ v " 5" && ! clang_use_lld )
444444 # Use a known algorithm to embed the build-id for reproducibility
445445 push! (flags, " -Wl,--build-id=sha1" )
446+ elseif Sys. iswindows (p) && clang_use_lld
447+ # This is reproducible as we set `-Wl,--no-insert-timestamp` elsewhere
448+ # See https://github.com/llvm/llvm-project/issues/74238#issuecomment-1839640836
449+ push! (flags, " -Wl,--build-id" )
446450 end
447451 end
448452 end
@@ -550,6 +554,10 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
550554 # The `-sdk_version` flag is not implemented in lld yet.
551555 append! (flags, min_macos_version_linker_flags ())
552556 end
557+ elseif Sys. iswindows (p) && gcc_version ≥ v " 5"
558+ # Do not embed timestamps, for reproducibility:
559+ # https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/1232
560+ push! (flags, " -Wl,--no-insert-timestamp" )
553561 end
554562
555563 buildid_link_flags! (p, flags)
@@ -1573,7 +1581,10 @@ function runner_setup!(workspaces, mappings, workspace_root, verbose, kwargs, pl
15731581 if ! isdir (ccache_dir ())
15741582 mkpath (ccache_dir ())
15751583 end
1576- push! (workspaces, ccache_dir () => envs[" CCACHE_DIR" ])
1584+ if haskey (envs, " CCACHE_DIR" )
1585+ # When bootstrapping, `CCACHE_DIR` is not defined.
1586+ push! (workspaces, ccache_dir () => envs[" CCACHE_DIR" ])
1587+ end
15771588 end
15781589
15791590 return platform, envs, shards
0 commit comments