[Bug 43386] New: Linux headers are a required but not tested dependency

Bug ID 43386
Summary Linux headers are a required but not tested dependency
Product lldb
Version 9.0
Hardware PC
OS Linux
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter eblot.ml@gmail.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

When building for arm-none-eabi target, from a Linux host, lldb requires the
linux headers file to successfully build.

While this extra dependency may or may not be useful for a baremetal (i.e.
non-Linux based) target, the CMake build infrastructure does not test for the
presence of such headers. This means the LLVM builds fails late in the build
process (file 3404 out of 4232 on my host).

As an enhancement, it would be nice to test for such header files during the
CMake build stage to avoid such a late failure.

Linux headers may not be installed by default on Docker containers, for
example.

FAILED:
tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/NativeProcessLinux.cpp.o
/usr/bin/c++  -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLDB_CONFIGURATION_RELEASE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Itools/lldb/source/Plugins/Process/Linux
-I/toolchain/llvm/lldb/source/Plugins/Process/Linux -Itools/lldb/source
-Itools/lldb/include -I/toolchain/llvm/lldb/include -Iinclude
-I/toolchain/llvm/llvm/include -I/usr/include/python3.7m
-I/toolchain/llvm/llvm/../clang/include -Itools/lldb/../clang/include
-I/toolchain/llvm/lldb/source/. -fPIC -fvisibility-inlines-hidden
-Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic
-Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized
-Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment
-fdiagnostics-color -ffunction-sections -fdata-sections
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
-Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG    -fno-exceptions
-fno-rtti -MD -MT
tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/NativeProcessLinux.cpp.o
-MF
tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/NativeProcessLinux.cpp.o.d
-o
tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/NativeProcessLinux.cpp.o
-c /toolchain/llvm/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
In file included from
/toolchain/llvm/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h:25,
                 from
/toolchain/llvm/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:9:
/toolchain/llvm/lldb/source/Plugins/Process/Linux/ProcessorTrace.h:18:10: fatal
error: linux/perf_event.h: No such file or directory
 #include <linux/perf_event.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.