Fix XZ build when bundled LZMA header shadows liblzma#62
Open
xiongxianfei wants to merge 3 commits intodevttys0:masterfrom
Open
Fix XZ build when bundled LZMA header shadows liblzma#62xiongxianfei wants to merge 3 commits intodevttys0:masterfrom
xiongxianfei wants to merge 3 commits intodevttys0:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR builds on #56 and fixes a long-standing XZ build failure where the bundled legacy LZMA SDK header shadows the system XZ Utils/liblzma header.
When both
XZ_SUPPORTand legacyLZMA_SUPPORTare enabled,xz_wrapper.cincludes<lzma.h>and expects the system liblzma header fromliblzma-dev.However, the Makefile adds bundled legacy LZMA include paths globally, including:
That can cause GCC to include:
instead of the system liblzma header:
The bundled legacy header does not define XZ/liblzma types such as
lzma_vli,lzma_filter, andlzma_options_lzma, so the build fails.Fix
This PR adds a small follow-up patch,
patches/patch1.txt, and updatesbuild.shto apply allpatch*.txtfiles in order.The patch keeps legacy LZMA include paths for the legacy LZMA code, but removes them when compiling
xz_wrapper.o, allowing<lzma.h>to resolve to the system liblzma header without hardcoding/usr/include/lzma.h.Why not hardcode
/usr/include/lzma.h?Hardcoding this:
works on Ubuntu, but it is not portable to other Linux distributions, sysroots, cross-compilers, or custom install prefixes. Fixing the Makefile include path is more maintainable.
Tested
Tested with:
Before:
After:
Also verified that the final binary links against liblzma:
ldd ./sasquatch | grep lzmaRelated
lzma_vli/lzma_filterfailure: I've done something wrong #6