Repository: spack/spack

Issue:
Installation issue: llvm (lldb) with external ncurses on openSUSE (missing <panel.h>)
### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install mesa
...
==> Installing llvm
==> No binary for llvm found: installing from source
==> Fetching https://spack-llnl-mirror.s3-us-west-2.amazonaws.com/_source-cache/archive/c7/c7ccb735c37b4ec470f66a6c35fbae4f029c0f88038f6977180b1a8ddc255637.tar.gz
######################################################################################################################################################################################################################################## 100.0%
==> llvm: Executing phase: 'cmake'
==> llvm: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16'

3 errors found in build log:
     44516    [ 94%] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/Highlighter.cpp.o
     44517    cd /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core && /data/tiziano/spack/lib/spack/env/gcc/g++  -DHAVE_ROUND -DLLDB_CONFIGURATION_RELEASE -D_GNU_S
              OURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core -I/tmp/tiziano/spack-
              stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source -I/tmp/tizia
              no/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/include -I/dat
              a/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libxml2-2.9.10-d65ista2et2yvwqirixg4dfv6euyv7x6/include/libxml2 -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-
              build-k6ia3mb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/llvm/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/l
              lvm/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx
              4nh4fuyoxlpq/spack-src/lldb/source/. -I/data/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libedit-3.1-20191231-sr2ifhegdk4qrqid6qra7lzwnh67jgdr/include  -std=c++11 -fPIC -fvisibility-inlines-hidden -We
              rror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-
              dtor -Wno-comment -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG     -std=c++14 -o CMakeFiles/lldbCore.dir/
              Highlighter.cpp.o -c /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core/Highlighter.cpp
     44518    [ 94%] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/IOHandler.cpp.o
     44519    cd /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core && /data/tiziano/spack/lib/spack/env/gcc/g++  -DHAVE_ROUND -DLLDB_CONFIGURATION_RELEASE -D_GNU_S
              OURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core -I/tmp/tiziano/spack-
              stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source -I/tmp/tizia
              no/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/include -I/dat
              a/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libxml2-2.9.10-d65ista2et2yvwqirixg4dfv6euyv7x6/include/libxml2 -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-
              build-k6ia3mb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/llvm/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/l
              lvm/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx
              4nh4fuyoxlpq/spack-src/lldb/source/. -I/data/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libedit-3.1-20191231-sr2ifhegdk4qrqid6qra7lzwnh67jgdr/include  -std=c++11 -fPIC -fvisibility-inlines-hidden -We
              rror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-
              dtor -Wno-comment -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG     -std=c++14 -o CMakeFiles/lldbCore.dir/
              IOHandler.cpp.o -c /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core/IOHandler.cpp
     44520    [ 94%] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/IOHandlerCursesGUI.cpp.o
     44521    cd /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core && /data/tiziano/spack/lib/spack/env/gcc/g++  -DHAVE_ROUND -DLLDB_CONFIGURATION_RELEASE -D_GNU_S
              OURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source/Core -I/tmp/tiziano/spack-
              stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/source -I/tmp/tizia
              no/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/include -I/dat
              a/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libxml2-2.9.10-d65ista2et2yvwqirixg4dfv6euyv7x6/include/libxml2 -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-
              build-k6ia3mb/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/llvm/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/l
              lvm/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb/tools/lldb/../clang/include -I/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx
              4nh4fuyoxlpq/spack-src/lldb/source/. -I/data/tiziano/spack/opt/spack/linux-opensuse_leap15-sandybridge/gcc-7.5.0/libedit-3.1-20191231-sr2ifhegdk4qrqid6qra7lzwnh67jgdr/include  -std=c++11 -fPIC -fvisibility-inlines-hidden -We
              rror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-
              dtor -Wno-comment -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG     -std=c++14 -o CMakeFiles/lldbCore.dir/
              IOHandlerCursesGUI.cpp.o -c /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core/IOHandlerCursesGUI.cpp
  >> 44522    /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-src/lldb/source/Core/IOHandlerCursesGUI.cpp:14:10: fatal error: panel.h: No such file or directory
     44523     #include <panel.h>
     44524              ^~~~~~~~~
     44525    compilation terminated.
  >> 44526    make[2]: *** [tools/lldb/source/Core/CMakeFiles/lldbCore.dir/build.make:474: tools/lldb/source/Core/CMakeFiles/lldbCore.dir/IOHandlerCursesGUI.cpp.o] Error 1
     44527    make[2]: *** Waiting for unfinished jobs....
     44528    make[2]: Leaving directory '/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb'
  >> 44529    make[1]: *** [CMakeFiles/Makefile2:94151: tools/lldb/source/Core/CMakeFiles/lldbCore.dir/all] Error 2
     44530    make[1]: Leaving directory '/tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-k6ia3mb'
     44531    make: *** [Makefile:155: all] Error 2

See build log for details:
  /tmp/tiziano/spack-stage/spack-stage-llvm-10.0.1-k6ia3mbsshjooujr23dx4nh4fuyoxlpq/spack-build-out.txt

```

### Information on your system

* **Spack:** 0.15.4-1660-f921bcbe0
* **Python:** 3.6.10
* **Platform:** linux-opensuse_leap15-sandybridge

```yaml
packages:
  ncurses:
    externals:
    - spec: ncurses@6.1.20180317+termlib
      prefix: /usr
```

### Additional information

@naromero77 
@trws

### General information

The following patch for LLVM fixes the issue: https://reviews.llvm.org/D85219


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -208,6 +208,10 @@ class Llvm(CMakePackage, CudaPackage):
     # https://bugs.llvm.org/show_bug.cgi?id=39696
     patch("thread-p9.patch", when="@develop+libcxx")
 
+    # https://github.com/spack/spack/issues/19625,
+    # merged in llvm-11.0.0_rc2
+    patch("lldb_external_ncurses-10.patch", when="@10.0.0:10.99+lldb")
+
     # The functions and attributes below implement external package
     # detection for LLVM. See:
     #


Test patch: