[Lldb-commits] [PATCH] D60180: [CMake] Don't explicitly use LLVM_LIBRARY_DIR in standalone builds
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 3 10:49:08 PDT 2019
xiaobai added a comment.
In D60180#1453106 <https://reviews.llvm.org/D60180#1453106>, @sgraenitz wrote:
> Major concern from my side is that clang does something like this too:
>
> clang/CMakeLists.txt
> 86: set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
> 125: link_directories("${LLVM_LIBRARY_DIR}")
>
>
> It looks like AddLLVM.cmake uses it in function `configure_lit_site_cfg`:
>
> # They below might not be the build tree but provided binary tree.
> set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
> set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
> string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
> string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
>
>
> So we should always have some value for `LLVM_LIBRARY_DIR`. Not sure about the `link_directories` line.
> Did you build and run test suite with this change? How does this string Replace work then?
Having the definition is fine, but the `link_directories` line is what causes the issue. I definitely built, but from I looked at my tmux history from last night and it looks like I ran the test suite from a unified build directory instead of an lldb standalone build directory, so I'll run the test suite there and report back. Knowing what I know now, I expect it to fail, so I'll need to revise and test this more thoroughly.
>> This is an issue because if you built libc++, it will try to link against that one instead of the one from the android NDK.
>
> Looking in-tree first seems like a reasonable default. You are cross-compiling only lldb-server so it can run on Android right? Everything else is built for your host platform?
No, everything is being built for android. Cross-compiling lldb-server involves cross-compiling llvm libraries, clang libraries, and if you've got swift in the picture, swift host libraries. LLVM and clang libraries are built against the libc++ from the android NDK, but in standalone builds, LLDB will try to link against the freshly built libc++ from LLVM. You get loads of undefined references to symbols from the NDK's libc++.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60180/new/
https://reviews.llvm.org/D60180
More information about the lldb-commits
mailing list