<div dir="ltr">On MacPorts we are seeing intermittent error reports from some users when building compiler-rt from clang-12 using parallel builds on faster machines.<br><br><<a href="https://trac.macports.org/ticket/63085">https://trac.macports.org/ticket/63085</a>><br><br>CMake Error: failed to create symbolic link '/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-12/clang-12/work/build/projects/compiler-rt/lib/builtins/outline_atomic_helpers.dir/outline_atomic_ldset1_2.S': file already exists<br><br>I believe this is due to this add_custom_command invocation:<br><br><<a href="https://github.com/llvm/llvm-project/blob/4c92e31dd0f1bd152eda883af20ff7fbcaa14945/compiler-rt/lib/builtins/CMakeLists.txt#L534">https://github.com/llvm/llvm-project/blob/4c92e31dd0f1bd152eda883af20ff7fbcaa14945/compiler-rt/lib/builtins/CMakeLists.txt#L534</a>><br><br>I am not a cmake expert, but I believe this issue is covered by cmake here:<br><br>"Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use the add_custom_target() command to drive the command and make the other targets depend on that one)."<br><br><br><<a href="https://cmake.org/cmake/help/v3.19/command/add_custom_command.html">https://cmake.org/cmake/help/v3.19/command/add_custom_command.html</a>><br><br>If so, it seems that the proper solution to this would be to add_custom_target a dependency on "${helper_asm}", perhaps something like this?<br><br><br>add_custom_target(compiler-rt-asm ALL DEPENDS ${helper_asm})<br><br><br>I defer now to the cmake experts.<br><br><br>Ken<br></div>