[Lldb-commits] [lldb] a52173a - Use find_library for ncurses

Galina Kistanova via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 20 16:19:44 PDT 2020


Hello Jonas, Harmen,

This commit broke one of our builders:
http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/30809

. . .
FAILED: bin/llvm-tblgen
: && /usr/bin/c++  -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default
-Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
-Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections
-O3  -static -fno-pie -Wl,-allow-shlib-undefined
 -Wl,-rpath-link,/home/buildslave/slave_as-bldslv8/lld-perf-testsuite/build/./lib
 -Wl,-O3 -Wl,--gc-sections
utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterInst.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/Attributes.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CallingConvEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeEmitterGen.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenDAGPatterns.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenHwModes.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenInstruction.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenMapTable.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenTarget.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherGen.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherOpt.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcher.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DirectiveEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/DisassemblerEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/ExegesisEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/FastISelEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/FixedLenDecoderEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/GICombinerEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/GlobalISelEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/InfoByHwMode.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrInfoEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrDocsEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/IntrinsicEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptParserEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptRSTEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/PredicateExpander.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/PseudoLoweringEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/RISCVCompressInstEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterBankEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterInfoEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/SDNodeProperties.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/SearchableTableEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetFeatureInfo.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/TableGen.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/Types.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86DisassemblerTables.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86EVEX2VEXTablesEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86FoldTablesEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86ModRMFilters.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86RecognizableInstr.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/WebAssemblyDisassemblerEmitter.cpp.o
utils/TableGen/CMakeFiles/llvm-tblgen.dir/CTagsEmitter.cpp.o  -o
bin/llvm-tblgen  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVMSupport.a
 lib/libLLVMTableGen.a  -lpthread  lib/libLLVMTableGenGlobalISel.a
 lib/libLLVMTableGen.a  lib/libLLVMSupport.a  -lrt  -ldl
 /usr/lib/x86_64-linux-gnu/libtinfo.so  -lpthread  -lm
 lib/libLLVMDemangle.a && :
/usr/bin/ld: attempted static link of dynamic object
`/usr/lib/x86_64-linux-gnu/libtinfo.so'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

The previous revision builds green:
http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/30948

Please have a look ASAP?

Thanks

Galina

On Mon, Aug 17, 2020 at 7:56 PM Jonas Devlieghere via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

>
> Author: Harmen Stoppels
> Date: 2020-08-17T19:52:52-07:00
> New Revision: a52173a3e56553d7b795bcf3cdadcf6433117107
>
> URL:
> https://github.com/llvm/llvm-project/commit/a52173a3e56553d7b795bcf3cdadcf6433117107
> DIFF:
> https://github.com/llvm/llvm-project/commit/a52173a3e56553d7b795bcf3cdadcf6433117107.diff
>
> LOG: Use find_library for ncurses
>
> Currently it is hard to avoid having LLVM link to the system install of
> ncurses, since it uses check_library_exists to find e.g. libtinfo and
> not find_library or find_package.
>
> With this change the ncurses lib is found with find_library, which also
> considers CMAKE_PREFIX_PATH. This solves an issue for the spack package
> manager, where we want to use the zlib installed by spack, and spack
> provides the CMAKE_PREFIX_PATH for it.
>
> This is a similar change as https://reviews.llvm.org/D79219, which just
> landed in master.
>
> Differential revision: https://reviews.llvm.org/D85820
>
> Added:
>
>
> Modified:
>     compiler-rt/cmake/config-ix.cmake
>     compiler-rt/lib/xray/tests/CMakeLists.txt
>     lldb/source/Core/CMakeLists.txt
>     llvm/cmake/config-ix.cmake
>     llvm/include/llvm/Config/config.h.cmake
>     llvm/lib/Support/CMakeLists.txt
>     llvm/lib/Support/Unix/Process.inc
>     llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/compiler-rt/cmake/config-ix.cmake
> b/compiler-rt/cmake/config-ix.cmake
> index 5f9e868de5fd..c9d0da2fc089 100644
> --- a/compiler-rt/cmake/config-ix.cmake
> +++ b/compiler-rt/cmake/config-ix.cmake
> @@ -133,17 +133,16 @@ check_library_exists(pthread pthread_create ""
> COMPILER_RT_HAS_LIBPTHREAD)
>  check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO)
>
>  # Look for terminfo library, used in unittests that depend on LLVMSupport.
> -if(LLVM_ENABLE_TERMINFO)
> -  foreach(library terminfo tinfo curses ncurses ncursesw)
> -    string(TOUPPER ${library} library_suffix)
> -    check_library_exists(
> -      ${library} setupterm "" COMPILER_RT_HAS_TERMINFO_${library_suffix})
> -    if(COMPILER_RT_HAS_TERMINFO_${library_suffix})
> -      set(COMPILER_RT_HAS_TERMINFO TRUE)
> -      set(COMPILER_RT_TERMINFO_LIB "${library}")
> -      break()
> -    endif()
> -  endforeach()
> +if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
> +  set(MAYBE_REQUIRED REQUIRED)
> +else()
> +  set(MAYBE_REQUIRED)
> +endif()
> +find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses
> ncursesw ${MAYBE_REQUIRED})
> +if(COMPILER_RT_TERMINFO_LIB)
> +  set(LLVM_ENABLE_TERMINFO 1)
> +else()
> +  set(LLVM_ENABLE_TERMINFO 0)
>  endif()
>
>  if (ANDROID AND COMPILER_RT_HAS_LIBDL)
>
> diff  --git a/compiler-rt/lib/xray/tests/CMakeLists.txt
> b/compiler-rt/lib/xray/tests/CMakeLists.txt
> index a1fbccaeb6d2..96a9db1ef877 100644
> --- a/compiler-rt/lib/xray/tests/CMakeLists.txt
> +++ b/compiler-rt/lib/xray/tests/CMakeLists.txt
> @@ -55,7 +55,7 @@ set(XRAY_UNITTEST_LINK_FLAGS
>  if (NOT APPLE)
>    # Needed by LLVMSupport.
>    append_list_if(
> -    COMPILER_RT_HAS_TERMINFO
> +    LLVM_ENABLE_TERMINFO
>      -l${COMPILER_RT_TERMINFO_LIB} XRAY_UNITTEST_LINK_FLAGS)
>
>    if (COMPILER_RT_STANDALONE_BUILD)
>
> diff  --git a/lldb/source/Core/CMakeLists.txt
> b/lldb/source/Core/CMakeLists.txt
> index a4057d11077f..01a25045081f 100644
> --- a/lldb/source/Core/CMakeLists.txt
> +++ b/lldb/source/Core/CMakeLists.txt
> @@ -11,8 +11,8 @@ set(LLDB_LIBEDIT_LIBS)
>
>  if (LLDB_ENABLE_CURSES)
>    list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES} ${PANEL_LIBRARIES})
> -  if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
> -    list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS})
> +  if(LLVM_ENABLE_TERMINFO)
> +    list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIB})
>    endif()
>    if (LLVM_BUILD_STATIC)
>      list(APPEND LLDB_CURSES_LIBS gpm)
>
> diff  --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
> index 2c20a1afeec0..67e2eb1cec14 100644
> --- a/llvm/cmake/config-ix.cmake
> +++ b/llvm/cmake/config-ix.cmake
> @@ -147,19 +147,16 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
>      else()
>        set(HAVE_LIBEDIT 0)
>      endif()
> -    if(LLVM_ENABLE_TERMINFO)
> -      set(HAVE_TERMINFO 0)
> -      foreach(library terminfo tinfo curses ncurses ncursesw)
> -        string(TOUPPER ${library} library_suffix)
> -        check_library_exists(${library} setupterm ""
> HAVE_TERMINFO_${library_suffix})
> -        if(HAVE_TERMINFO_${library_suffix})
> -          set(HAVE_TERMINFO 1)
> -          set(TERMINFO_LIBS "${library}")
> -          break()
> -        endif()
> -      endforeach()
> +    if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
> +      set(MAYBE_REQUIRED REQUIRED)
> +    else()
> +      set(MAYBE_REQUIRED)
> +    endif()
> +    find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses
> ncursesw ${MAYBE_REQUIRED})
> +    if(TERMINFO_LIB)
> +      set(LLVM_ENABLE_TERMINFO 1)
>      else()
> -      set(HAVE_TERMINFO 0)
> +      set(LLVM_ENABLE_TERMINFO 0)
>      endif()
>
>      find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
>
> diff  --git a/llvm/include/llvm/Config/config.h.cmake
> b/llvm/include/llvm/Config/config.h.cmake
> index b8c7e070eb34..a65947bf24c4 100644
> --- a/llvm/include/llvm/Config/config.h.cmake
> +++ b/llvm/include/llvm/Config/config.h.cmake
> @@ -209,7 +209,7 @@
>  #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
>
>  /* Define if the setupterm() function is supported this platform. */
> -#cmakedefine HAVE_TERMINFO ${HAVE_TERMINFO}
> +#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO}
>
>  /* Define if the xar_open() function is supported this platform. */
>  #cmakedefine HAVE_LIBXAR ${HAVE_LIBXAR}
>
> diff  --git a/llvm/lib/Support/CMakeLists.txt
> b/llvm/lib/Support/CMakeLists.txt
> index 7b45dc628160..b895f02a9df7 100644
> --- a/llvm/lib/Support/CMakeLists.txt
> +++ b/llvm/lib/Support/CMakeLists.txt
> @@ -21,10 +21,8 @@ elseif( CMAKE_HOST_UNIX )
>      STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE})
>      set(system_libs ${system_libs} ${Backtrace_LIBFILE})
>    endif()
> -  if(LLVM_ENABLE_TERMINFO)
> -    if(HAVE_TERMINFO)
> -      set(system_libs ${system_libs} ${TERMINFO_LIBS})
> -    endif()
> +  if( LLVM_ENABLE_TERMINFO )
> +    set(system_libs ${system_libs} ${TERMINFO_LIB})
>    endif()
>    if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) )
>      set(system_libs ${system_libs} atomic)
>
> diff  --git a/llvm/lib/Support/Unix/Process.inc
> b/llvm/lib/Support/Unix/Process.inc
> index 24f16b51af7b..7425d084da27 100644
> --- a/llvm/lib/Support/Unix/Process.inc
> +++ b/llvm/lib/Support/Unix/Process.inc
> @@ -313,7 +313,7 @@ unsigned Process::StandardErrColumns() {
>    return getColumns();
>  }
>
> -#ifdef HAVE_TERMINFO
> +#ifdef LLVM_ENABLE_TERMINFO
>  // We manually declare these extern functions because finding the correct
>  // headers from various terminfo, curses, or other sources is harder than
>  // writing their specs down.
> @@ -323,12 +323,12 @@ extern "C" int del_curterm(struct term *termp);
>  extern "C" int tigetnum(char *capname);
>  #endif
>
> -#ifdef HAVE_TERMINFO
> +#ifdef LLVM_ENABLE_TERMINFO
>  static ManagedStatic<std::mutex> TermColorMutex;
>  #endif
>
>  static bool terminalHasColors(int fd) {
> -#ifdef HAVE_TERMINFO
> +#ifdef LLVM_ENABLE_TERMINFO
>    // First, acquire a global lock because these C routines are thread
> hostile.
>    std::lock_guard<std::mutex> G(*TermColorMutex);
>
>
> diff  --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
> b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
> index c9e7c45fc118..35c6890efd6d 100644
> --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
> +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
> @@ -284,9 +284,9 @@ write_cmake_config("config") {
>    }
>
>    if (llvm_enable_terminfo) {
> -    values += [ "HAVE_TERMINFO=1" ]
> +    values += [ "LLVM_ENABLE_TERMINFO=1" ]
>    } else {
> -    values += [ "HAVE_TERMINFO=" ]
> +    values += [ "LLVM_ENABLE_TERMINFO=" ]
>    }
>
>    if (llvm_enable_dia_sdk) {
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200820/273708f4/attachment-0001.html>


More information about the lldb-commits mailing list