Skip to content

Commit e385ea9

Browse files
KenoValentin Churavy
andcommitted
Fix race condition when building LLVM for Windows
`llvm-tblgen` and `llvm-config` both try to build in the same NATIVE directory and end up stomping on each other. Co-authored-by: Valentin Churavy <vchuravy@gmail.com>
1 parent a882d9b commit e385ea9

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

deps/llvm.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ $(eval $(call LLVM_PATCH,llvm-D49832-SCEVPred)) # Remove for 7.0
506506
$(eval $(call LLVM_PATCH,llvm-rL323946-LSRTy)) # Remove for 7.0
507507
$(eval $(call LLVM_PATCH,llvm-D50010-VNCoercion-ni))
508508
$(eval $(call LLVM_PATCH,llvm-D50167-scev-umin))
509+
$(eval $(call LLVM_PATCH,llvm-windows-race))
509510
endif # LLVM_VER
510511

511512
# Remove hardcoded OS X requirements in compilter-rt cmake build

deps/patches/llvm-windows-race.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
commit c0be37352f6d91505d964a7d33ad79b40750d370
2+
Author: Keno Fischer <keno@juliacomputing.com>
3+
Date: Fri Aug 3 21:03:32 2018 -0400
4+
5+
[CrossCompile] Add a dependency llvm-config-host -> llvm-tblgen-host
6+
7+
These use the same working directory and without a dependency
8+
edge between them race to build some of the utility libraries
9+
causing build failures.
10+
11+
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
12+
index f59402ac4b0..f3b4e60fd99 100644
13+
--- a/tools/llvm-config/CMakeLists.txt
14+
+++ b/tools/llvm-config/CMakeLists.txt
15+
@@ -77,5 +77,10 @@ if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH)
16+
add_custom_target(${project}NativeLLVMConfig DEPENDS ${${project}_LLVM_CONFIG_EXE})
17+
add_dependencies(${project}NativeLLVMConfig CONFIGURE_LLVM_NATIVE)
18+
19+
+ # Add a dependency on the host tblgen, which uses the same working
20+
+ # directory and with which we're otherwise racing to build some
21+
+ # of the utility libraries.
22+
+ add_dependencies(${project}NativeLLVMConfig LLVM-tablegen-host)
23+
+
24+
add_dependencies(llvm-config ${project}NativeLLVMConfig)
25+
endif(CMAKE_CROSSCOMPILING)

0 commit comments

Comments
 (0)