[Lldb-commits] [PATCH] D85820: Use find_library for ncurses

Petr Hosek via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 25 14:52:25 PDT 2020


phosek added a comment.

In D85820#2235461 <https://reviews.llvm.org/D85820#2235461>, @haampie wrote:

> @gkistanova It's true that this change has lead to more issues I could ever imagine, but I think the link you provided is the last remaining problem.
>
> Pinging @phosek for a similar issue w.r.t. zlib: since https://reviews.llvm.org/D79219 zlib gets disabled on static builds of LLVM.  The reason is `find_package(ZLIB)` finds a shared library, and `check_symbol_exists(compress2 zlib.h HAVE_ZLIB)` tries to statically link to that -- it can't so zlib is disabled. I guess that's a regression too?
>
> What would be the best way forward @phosek? A quick fix for ncurses is to add a simple `check_symbol_exists` test too, but that would in practice just disable ncurses in static builds. And additionally we could find static libs by adding explicit names like `libtinfo.a` to find_library when `LLVM_BUILD_STATIC=ON`. This trick won't help for zlib though, the find_library stuff is hidden inside find_package, and there is no way to target static libs it seems.

@haampie `find_package` and `find_library` uses `CMAKE_FIND_LIBRARY_SUFFIXES` to determine the suffix of the library (the default is `".so" ".a"` which is why it always picks shared library). I think we should extend this block https://github.com/llvm/llvm-project/blob/master/llvm/CMakeLists.txt#L626 and filter out `CMAKE_SHARED_LIBRARY_SUFFIX` from `CMAKE_FIND_LIBRARY_SUFFIXES` when `LLVM_BUILD_STATIC` is enabled which will handle this case globally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85820/new/

https://reviews.llvm.org/D85820



More information about the lldb-commits mailing list