Hi folks, When cross-compiling LLVM to ARM, using CMake+Ninja, I realized that libxml2 depends on lzma, but the dependency is not explicit on the build.ninja file under the "build bin/c-index-test"'s LINK_LIBRARIES (which is the only one that cares about it). I couldn't find the place to add -llzma into the deps, and the only mention of libxml2 is in config-ix.cmake: find_package(LibXml2) if (LIBXML2_FOUND) set(CLANG_HAVE_LIBXML 1) endif () Which I could do the same with lzma? Any ideas on what the problem is, and possibly how to fix it? thanks, --renato PS: The work around is to edit the build.ninja file manually after CMake runs, but that's sub-optimal. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130903/f0243d2f/attachment.html>
On 09/03/2013 02:13 PM, Renato Golin wrote:> Hi folks, > > When cross-compiling LLVM to ARM, using CMake+Ninja, I realized that > libxml2 depends on lzma, but the dependency is not explicit on the > build.ninja file under the "build bin/c-index-test"'s LINK_LIBRARIES > (which is the only one that cares about it). > > I couldn't find the place to add -llzma into the deps, and the only > mention of libxml2 is in config-ix.cmake: > > find_package(LibXml2) > if (LIBXML2_FOUND) > set(CLANG_HAVE_LIBXML 1) > endif () > > Which I could do the same with lzma? Any ideas on what the problem is, > and possibly how to fix it?libxml2 comes with a 'xml2-config' shell script to get the right compilation / linking flags for the platform libxml2 was built on. Is '|xml2-config --libs' giving |the required depencies ? Cheers, -- Arnaud A. de Grandmaison> > thanks, > --renato > > PS: The work around is to edit the build.ninja file manually after > CMake runs, but that's sub-optimal. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Arnaud A. de Grandmaison -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130903/27b8f841/attachment.html>
On 3 September 2013 13:41, Arnaud A. de Grandmaison <arnaud.adegm at gmail.com>wrote:> libxml2 comes with a 'xml2-config' shell script to get the right > compilation / linking flags for the platform libxml2 was built on. > > Is 'xml2-config --libs' giving the required depencies ? >Oh, but that's cross-compilation, so either my host xml2-config will report the wrong deps (for the host machine), or the target xml2-config won't run on the host machine at all... I believe this has something to do with the change in ld (since 2.21) to require explicit deps on compilation command line... cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130903/71b5d04c/attachment.html>
Renato Golin <renato.golin at linaro.org> writes:> When cross-compiling LLVM to ARM, using CMake+Ninja, I realized that > libxml2 depends on lzma, but the dependency is not explicit on the > build.ninja file under the "build bin/c-index-test"'s LINK_LIBRARIES (which > is the only one that cares about it). > > I couldn't find the place to add -llzma into the deps, and the only mention > of libxml2 is in config-ix.cmake: > > find_package(LibXml2) > if (LIBXML2_FOUND) > set(CLANG_HAVE_LIBXML 1) > endif () > > Which I could do the same with lzma? Any ideas on what the problem is, and > possibly how to fix it?A quick and dirty fix is to change this on clang/tools/c-index-test/CMakeLists.txt: target_link_libraries(c-index-test ${LIBXML2_LIBRARIES} lzma) That affects that instance only (maybe it is the only one.) And if you pretend to install that change, first check that XML2 always requires lzma (to not break the build on systems where it doesn't and libzma is absent.) A more robust fix shall work on llvm/cmake/config-ix.cmake: when XML2 is detected, add lzma as a dependency. This has the some caveat mentioned on the previous paragraph. Finally, the real fix shall be implemented on FindLibXml2.cmake, which belongs to the CMake project. It should take care of declaring that xml2 libraries depend on lzma, but apparently it doesn't.> PS: The work around is to edit the build.ninja file manually after CMake > runs, but that's sub-optimal.Not sub-optimal, but `gross' :-)
Thanks Oscar! Plenty of options to choose from. ;) I'm writing a document that explains in details how to cross-compile with LLVM/Clang, adding the use case compiling x86->ARM LLVM/Clang, and I'll add the first dirty solution as a work around (so that people can cross-compile without touching the ninja files), but I'll pursue the proper libxml2 fix ( http://llvm.org/PR17085). I'll send the document in a moment for review. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130903/9f38eae8/attachment.html>