[Lldb-commits] [PATCH] D66208: [lldb] Let LLDB depend on intrinsics_gen to fix non-deterministic module build failures

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 14 03:24:02 PDT 2019


teemperor created this revision.
teemperor added reviewers: sgraenitz, aprantl, JDevlieghere.
Herald added subscribers: lldb-commits, mgrang, kristof.beyls, javed.absar, mgorny.
Herald added a project: LLDB.

When building with modules we currently fail randomly to build LLDB's modules and get error messages like below:

  In file included from <module-includes>:1:                                                                                                                                                    
  In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:                                                                                                 
  llvm-project/llvm/include/llvm/IR/Attributes.h:74:14: fatal error: 'llvm/IR/Attributes.inc' file not found                                                             
      #include "llvm/IR/Attributes.inc"                                                                                                                                                         
               ^~~~~~~~~~~~~~~~~~~~~~~~  
  ...
  In file included from llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp:9:                                                                                 
  llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h:12:10: fatal error: could not build module 'lldb_Wrapper' 

The reason for this is that our source files can include Clang headers which in turn include files like Attributes.inc which
are generated by intrinsics_gen. However, it seems Clang can't express this dependency in its CMake code, so intrinsics_gen
is actually not guaranteed to be built before we start parsing LLDB source files and Clang headers. Clang worked around this
by letting all libraries depend on intrinsics_gen, which at least lets their builds pass.

As I haven't figured out how to solve these dependencies properly and I want to get the LLDB+Modules build green,
I suggest we copy Clang's hack until we figure out how to get Clang's dependencies right.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66208

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -40,6 +40,15 @@
   add_subdirectory(scripts)
 endif ()
 
+# We need the headers generated by instrinsics_gen before we can compile
+# any source file in LLDB as the imported Clang modules might include
+# some of these generated headers. This approach is copied from Clang's main
+# CMakeLists.txt, so it should kept in sync the code in Clang which was added
+# in llvm-svn 308844.
+if(LLVM_ENABLE_MODULES AND NOT LLDB_BUILT_STANDALONE)
+  list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
+endif()
+
 if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
   set(LLVM_USE_HOST_TOOLS ON)
   include(CrossCompile)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66208.215070.patch
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190814/1019c6dc/attachment.bin>


More information about the lldb-commits mailing list