-
Notifications
You must be signed in to change notification settings - Fork 990
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
[bug] meson toolchain incorrectly handles cross-compilation on same os/arch tuple. #15392
Comments
Also noting #11035, it seems that this was overlooked as |
* conan-io#15392: MesonToolchain was only using the internal cross_building test and not using can_run (which respects the conf value). Fix this so we can force cross-compilation where the host cannot run the binary despite it seeming like it should be able to.
bump. This remains an issue and needs to be fixed. |
Implemented in #15616 as |
Can you please explain this in the context of the previous decisions around #11035 and why adding another option was necessary rather than just using the existing one in the way it was intended (despite the name, it's pretty much exactly what it would appear to be for). My concern is that this is another divergent setting for conan build integration and recipe maintainers to get wrong, and this change will create another ripple of broken recipes as we have to fix them to use the New Logic rather than the pre-existing logic. |
Because those are very different things. So |
Uh, that's a somewhat incomplete opinion on cross-compilation. In the case where the binaries are transparently executable, then you do not need to use full cross-compilation approaches as binary tests can be executed - these typically fall into the native build flow (ie: not a full cross-compile), whereas the converse, where you are not doing something which fits the normal criteria of cross-building (such as my cross-ABI on same OS & kernel builds) where you cannot run the binaries at all must use a full cross-compile flow. The The distinction as to if something is or isn't a cross-compile is far less useful than the distinction as to if cross-compilation handling is required. |
This is not an opinion on cross-compilation, this is knowledge about what Conan should do based on the needs and feedback of thousands users using Conan. As an example, there are users doing builds for Android or some Nvidia platforms, from different OSs, Windows, Linux, OSX. Those are clearly cross-builds and all the build system integrations need to configure the toolchains for cross-builds, with the "build" and "host" context profiles being different, tools in the "build" context, binaries for Android/Nvidia in the "host" context, etc. Some of these users have capabilities of running some of those executables from Conan recipes, in the "build" machine, by emulators or remote execution. They need to control whether they can run those executables, depending on the machine doing the cross-build having the running capabilities, like the emulator or the remote connection to the device. While |
Right, so whilst I take your point - if you're going to go so far as to say that conan supports the semi-cross modes through emulation/remote execution despite putting none of the other configuration options in that they need (such as the ability to configure remote execution or emulation options) then I can see the point in adding the distinction, but as this doesn't actually introduce the changes for that, this really feels like you've superficially fixed the problem and ignored the actual one. Yes, now I can override it using a separate value, but |
The other issue, and this is why your approach rubs me completely wrong, is you're mistaking the means for the end. We know the parameters and behaviours of the systems and tools. We know what we have and what we want. As the consumer, we do not particularly care about how Conan or a recipe gets there in the end. What we care about is we get artifacts for the host platform using tools on the build platform. We care that the tools and the recipes have the information they need to make the right decisions. We do not actually care at the end of the day if the method is that tool's cross-compile method or not. If it's a cross-compile without using explicit cross-compilation support, it's still a cross-compile. Moreover, the requirements to pick a specific build approach are not necessarily uniform by build tool or project. The tools and recipes should be making the judgements about which flows to use based on the properties of the host and build platforms specified, not because we set some magic flag on - that sort of black and white thinking just results in being equally useless when somebody hits another edgecase. This is pretty much a text-book anti-pattern of making the user deal with internal details, rather than having them deal with the details they have and can control.
You claim it's not connected to cross-compilation, but at the end of the day it is - it's a key determinant property for if a full cross-compile strategy is required vs a softer one for many tools (such as cmake, autotools and meson all alike). That was recognized in #11035, even if only by accident - because in the circumstances described, you have the ability for the outputs to run transparently, many tools stop needing to assume it's a cross-build and can treat it like a native one with just the normal tool overrides and they'll get a cross-compiled output, but without using a cross-compiled flow. It's still a cross-compile, but it's not using the tools internal cross-compile mechanisms because they're superfluous in those cases. The thing is, If you're going to insist the new flag is useful, that's fine - I disagree for the points above - but at least fix the Meson bug too before closing this ticket. |
fundamental issue reported in this ticket is still not fixed DESPITE @memsharded's claims otherwise. Per last line of the report: "Even if it's not a full cross_compile, if it can't run the binaries, Meson needs to use the cross_compilation flow." @memsharded trying to pass this off as a case for a global "is_crosscompiling" does not fix the actual bug reported which is meson must respect can_run (which defaults to using the same decision process as cross_compiling, but also respects the ability to run objects transparently). |
Environment details
Steps to reproduce
tools.build.cross_building:can_run=no
set in[conf]
.(Note: Support for this to work is necessary as it's entirely possible to have incompatible ABIs between Linux distributions and this is already a problem that plagues binaries hosted by conan-center - In our case, my development distro can't produce binaries that run on our embedded x86_64 distro and vice versa due to ld.so and libc differences so we need to use a cross compilation flow despite the architectures being compatible/identical.)
A quick check of the code shows that MesonToolchain only checks cross_compiling, and not can_run. Even if it's not a full cross_compile, if it can't run the binaries, Meson needs to use the cross_compilation flow.
Logs
The text was updated successfully, but these errors were encountered: