Bugfix: ensure meson gets correct compiler flags - #5222
Conversation
Signed-off-by: SSE4 <tomskside@gmail.com>
| def _run(self, command): | ||
| with tools.vcvars(self._settings, | ||
| output=self._conanfile.output) if self._vcvars_needed else tools.no_op(): | ||
| env_build = AutoToolsBuildEnvironment(self._conanfile) |
There was a problem hiding this comment.
At first sight it doesn't feel great to use another build helper and especially that one based only on the env vars.
Is there another thing we can do like write a file to be injected to meson?
There was a problem hiding this comment.
seems like writing to file is something we will need to solve #4529
but I think it's blocked by #5184
we need to do some design decisions on how to handle such kind of files, are they produced by their own generators, or by existing generators, or some other entities.
I think right now it's too much for the original particular problem.
I prefer to go by small iterations, like first solve flags issue, then solve cross-compiling issue, and then solve toolchain file design problems. I think it's too much to do at single shot.
for the AutoToolsBuildEnvironment, why not re-use it, at least for the first iteration? as soon as meson is compatible with auto-tools variables, we can re-use the code, especially as it's already well-tested and proven to work correctly.
|
I would have a look at the Meson build description ( |
|
this approach may work: https://mesonbuild.com/Cross-compilation.html |
|
I'm very confused about the new generator for cross building with Meson that you introduced. Here you are suggesting to go step by step and then suddenly invent a new generator? EDIT: There are no single test using the new generator so I suppose it is not necessary to solve the flags issue. right? |
|
@lasote I am going to remove that generator from the PR, it's still incomplete, |
d2b0d1d to
22e64c4
Compare
|
generator code was removed. it will go to its own PR, probably after the #5184 |
lasote
left a comment
There was a problem hiding this comment.
Ok. You are right, there is no simple way to improve and applying AutoToolsBuildEnvironment is very straightforward.
|
I agree with adding all those flags to Meson build helper, they are needed and very useful. I also like the implementation on top of My only concern is related to the stability as none of this build helpers are marked as experimental and we are changing the flags that are currently used:
How does this play with existing recipes? Is this breaking existing behavior? Does it require to change existing recipes so they no longer use the ugly workaround? Can we consider it a bug and just fix it? |
|
@jgsogo yes, we may change recipes to remove existing workarounds. right now we have to deal with compiler.runtime manually, e.g.: |
|
...but if someone was not adding all those flags, now he will. Is this breaking, @lasote? Is it enough to add a paragraph in the release blog-post? |
|
if someone didn't add those flags, he got incorrect package. anyway, it's up to you to decide. |
Well, probably yes. Could the previous behavior be considered a bug? probably yes... Is the usage of meson very limited? I would say yes, In general it improves the situation.... probably yes. I would say we should try to introduce it and if someone report as a breaking change we could reconsider based on the specific use case. |
|
Ok, thanks, so let's go with it! |
closes: #4573
tags: @slow, @svn
Changelog: Bugfix: Meson build-helper gets correct compiler flags, AutoTools build environment adds compiler.runtime flags
Docs: omit
short story: currently meson build helper doesn't propagate required compiler flags, like
AutoToolsBuildEnvironment,CMakeorMSBuilddo. it requires ugly workarounds in each recipe:as meson supports the same way as auto-tools, I've re-used
AutoToolsBuildEnvironmentbuild helper in order to set up correct compile flags.see also: https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages
developbranch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.