llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.24k stars 12.07k forks source link

Unable to build LLDB on Amazon Linux 2 ARM64 #52823

Open DoDoENT opened 2 years ago

DoDoENT commented 2 years ago

I'm trying to build full LLVM 13 toolchain within Amazon Linux 2 ARM64 docker and compilation of LLDB fails with:

/home/build/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:63:28: error: variable has incomplete type 'struct user_sve_header'
    struct user_sve_header sve_header;
                           ^
/home/build/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:63:12: note: forward declaration of 'user_sve_header'
    struct user_sve_header sve_header;
           ^
/home/build/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:376:13: error: use of undeclared identifier 'sve_vl_valid'
        if (sve_vl_valid(vg_value * 8)) {
            ^
/home/build/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:562:10: error: use of undeclared identifier 'sve_vl_valid'
    if (!sve_vl_valid(m_sve_header.vl)) {
         ^
/home/build/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:930:11: error: use of undeclared identifier 'sve_vl_valid'
      if (sve_vl_valid(m_sve_header.vl))
          ^
4 errors generated.

I've discovered that a similar issue has been also discovered in spack and the underlying problem is that Amazon Linux 2 is running on Kernel 4.14 which does not provide user_sve_header that has been added to kernel 4.15.

The main question is why does LLDB need a kernel with SVE support on non-SVE CPU? Should we add support for building the LLDB without SVE support?

llvmbot commented 2 years ago

@llvm/issue-subscribers-lldb

DavidSpickett commented 2 years ago

@omjavaid

omjavaid commented 2 years ago

LLDB build does not require kernel support for SVE but requires header to be present in your toolchain sysroot path. You may use a fairly recent arm toolchain like for example https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz It contains an updated ptrace.h containing user_sve_header definitions at libc/usr/include/asm/ptrace.h

EugeneZelenko commented 2 years ago

I think will be reasonable to check availability of user_sve_header definitions at CMake configuration time.