This is an archive of the discontinued LLVM Phabricator instance.

Fix link failures when BUILD_SHARED_LIBS=ON.
ClosedPublic

Authored by dsanders on Sep 16 2015, 3:51 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

dsanders updated this revision to Diff 34877.Sep 16 2015, 3:51 AM
dsanders retitled this revision from to Fix link failures when BUILD_SHARED_LIBS=ON..
dsanders updated this object.
dsanders added a subscriber: lldb-commits.

This patch does the trick for me but I'm not certain it's the right fix overall. Could someone take a look?

labath added a subscriber: labath.

Thanks for the patch.

LLDBDependencies.cmake sets LLDB_SYSTEM_LIBS to the list of libraries lldb depends on. Could you check if it is not sufficient to add this to the list of dependencies? I'd like to avoid replicating this if(LLDB_DISABLE_XXX) logic if it is possible.

krytarowski requested changes to this revision.Sep 18 2015, 5:03 AM
krytarowski added a reviewer: krytarowski.
krytarowski added a subscriber: krytarowski.
krytarowski added inline comments.
tools/lldb-server/CMakeLists.txt
40 ↗(On Diff #34877)

This approach of linking external entities is broken on NetBSD (pkgsrc). pkgsrc installs libraries under custom prefix and target_link_libraries is deaf to it. There is additional issue with handling includes, I need for it `config.h`.

The correct one is to use find_package(Curses) and link against ${CURSES_LIBRARIES}

if (NOT LLDB_DISABLE_CURSES)
    set(CURSES_NEED_NCURSES TRUE)
    find_package(Curses REQUIRED)

    find_library(NCURSES_PANEL_LIBRARY NAMES panel DOC "The ncureses panel library")
    if (CURSES_FOUND)
        # Add panels to the library path
        set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSES_PANEL_LIBRARY})
    endif ()
endif ()

I'm in process of preparing a proper ncurses handling, CMake is done and with autotools/gmake I need to research it bit more (properly add config.h in the autotools target).

This revision now requires changes to proceed.Sep 18 2015, 5:03 AM
dsanders updated this revision to Diff 35075.Sep 18 2015, 5:44 AM
dsanders edited edge metadata.

Pavel's suggestion to use LLDB_SYSTEM_LIBS works for me. Updated the patch.

krytarowski accepted this revision.Sep 18 2015, 5:49 AM
krytarowski edited edge metadata.
This revision is now accepted and ready to land.Sep 18 2015, 5:49 AM
This revision was automatically updated to reflect the committed changes.
labath edited edge metadata.Sep 18 2015, 7:25 AM

Committed as r247991. We can tweak this later if needed after Kamil's changes go in.