This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Let LLDB depend on intrinsics_gen to fix non-deterministic module build failures
ClosedPublic

Authored by teemperor on Aug 14 2019, 3:23 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Aug 14 2019, 3:23 AM
JDevlieghere accepted this revision.Aug 14 2019, 8:26 AM

LGTM.

Out of curiosity, do you know why we don't see this on the CMake bot on GreenDragon, which is a modules build? Is this so infrequent that I might have missed it?

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/

This revision is now accepted and ready to land.Aug 14 2019, 8:26 AM

LGTM.

Out of curiosity, do you know why we don't see this on the CMake bot on GreenDragon, which is a modules build? Is this so infrequent that I might have missed it?

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/

Do the bots use a fresh build folder? Clang could find the generated headers from a previous build or there are headers with the same name in the possible include paths (even tough they are usually not included as the header that is generated would be before these other headers in the include path). That would be my explanation.

LGTM.

Out of curiosity, do you know why we don't see this on the CMake bot on GreenDragon, which is a modules build? Is this so infrequent that I might have missed it?

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/

Do the bots use a fresh build folder? Clang could find the generated headers from a previous build or there are headers with the same name in the possible include paths (even tough they are usually not included as the header that is generated would be before these other headers in the include path). That would be my explanation.

The bot is incremental but the workspace is cleaned once in a while. The combination of both things happening only occasionally makes sense.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2019, 12:31 AM