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
lz4 fails to cross-compile due to gen_manual rule #1240
Comments
This way, in a cross-build of lz4, you can set CXX_FOR_BUILD to a native compiler that can produce a gen_manual executable to run at build-time. fix lz4#1240
A number of things to unpack here.
So, I suspect the first question is, we should talk about the need to generate |
I came here from pkgsrc, which follows the convention that I didn't investigate whether what gen_manual produces is relevant to the resulting package -- I'm just going through and fixing cross-compilation bugs in every package I stumble upon, and this is a common bug with a common fix, which is what I submitted in #1241. Is there a better target to use instead? Should it use the |
Looks like there's no trouble with leaving the target empty in pkgsrc so it will pick whatever is the default from |
The `all' target apparently includes things that aren't necessary for the build products we expect. Just use an empty target so that make selects the first one in the makefile, which according to lz4/lz4#1240 is the reasonable choice here. No change to the build products that are installed -- this just makes lz4 build fewer things.
Yeah, the regular default
Maybe it's a mis-usage of the |
Describe the bug
lz4 uses $(CXX) to compile gen_manual, and then executes it during the build.
In a cross-build, say using a cross-compiler on an x86 system to build an lz4 that runs on aarch64, $(CXX) is a cross-compiler, so using it here yields an aarch64 executable for gen_manual, which can't be executed on x86.
Expected behavior
lz4 uses a native compiler for gen_manual when cross-compiling everything else.
For example, perhaps lz4 could sprout a parameter CXX_FOR_BUILD, which defaults to $(CXX), and which is used to compile gen_manual before executing it.
To Reproduce
Cross-compile lz4.
Additional context
Many other software packages that do something similar expose CC_FOR_BUILD or CXX_FOR_BUILD parameters, so there is plenty of precedent for this approach.
The text was updated successfully, but these errors were encountered: