Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libXML2 fails to spot lzma when cross-compiling #17459

Closed
rengolin opened this issue Sep 3, 2013 · 7 comments
Closed

libXML2 fails to spot lzma when cross-compiling #17459

rengolin opened this issue Sep 3, 2013 · 7 comments
Assignees
Labels
bugzilla cmake

Comments

@rengolin
Copy link
Member

@rengolin rengolin commented Sep 3, 2013

Bugzilla Link 17085
Resolution FIXED
Resolved on Sep 10, 2013 10:55
Version trunk
OS Linux
CC @DougGregor,@oscarfv,@rengolin

Extended Description

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).

Oscar Fuentes proposed the following workarounds / solutions:

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.

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 3, 2013

assigned to @rengolin

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 4, 2013

Oscar,

I was reading a bit and found that, as of 2.8.0 (May 23 2012)m libXML2 depends on LZMA on all cases. On my x86 machine, Ubuntu lists it as a dependency:

$ apt-cache depends libxml2
libxml2
Depends: libc6
Depends: liblzma5
Depends: zlib1g
PreDepends: multiarch-support
multiarch-support:i386
Recommends: xml-core
Replaces: libxml2:i386
Breaks: libxml2:i386

But config doesn't show them:

$ xml2-config --libs
-L/usr/lib -lxml2

Which shouldn't break anything (since libxml2 depends on lzma, the library could only exist IF lzma is installed/compiled correctly).

But in this case, I'm copying the libraries manually (because it's for another architecture) AND ld 2.21 now requires explicit dependency declaration.

So, I think it should be safe to say that libxml2 2.8.0+ always depends on lzma. I'll send a patch for review.

@oscarfv
Copy link
Mannequin

@oscarfv oscarfv mannequin commented Sep 4, 2013

Renato,

Your description makes me think that declaring a dependency of the xml2 libraries on lzma is safe enough, but please note that I'm not the maintainer of the CMake build. So send the patch to llvm-commits as usual and wait for approval.

OTOH, it would be a good long-term investment to report this issue on the CMake build tracker.

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 5, 2013

Your description makes me think that declaring a dependency of the xml2
libraries on lzma is safe enough,

Only for 2.8.0+, I'm trying to find a way to check for version numbers. I'm not a CMake expert, and a google search only returned me custom-made solutions. :(

but please note that I'm not the
maintainer of the CMake build. So send the patch to llvm-commits as usual
and wait for approval.

Sure.

OTOH, it would be a good long-term investment to report this issue on the
CMake build tracker.

That's a good point. This issue is probably not critical enough to make a special case in Clang.

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 5, 2013

Opened a bug in libxml2, to make xml2-config report -llzma as a dependency.

https://bugzilla.gnome.org/show_bug.cgi?id=707545

But that won't fix the immediate problem, and it's not something that CMake should be doing anything, also, since the real problem is in the config tool.

Do you think we should just add a quick hack on c-index-test until that gets fixed in libxml2? It'll take a while (years?) for a fix to appear on desktop systems, making our temporary fix quite long lived, but if we don't do that, then every cross-compilation will have the same problem.

I'll find out how to do the version check...

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 5, 2013

Adding Doug (FYI), as he's the CMake expert.

@rengolin
Copy link
Member Author

@rengolin rengolin commented Sep 10, 2013

Fixed as of r190409

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla cmake
Projects
None yet
Development

No branches or pull requests

1 participant