Just got
Meson encountered an error:
Build directory has been generated with Meson version 0.39.1, which is incompatible with current version 0.40.0.
Please delete this build directory AND create a new one.
I guess meson could handle this automatically.
A similar issue is when doing "meson build" twice I guess, where meson fires an error instead of removing the build directory and creating it again.
This is on purpose, because it would be very surprising if an accidental meson builddir/ would cause the build directory to be wiped and require a re-build which might take a while for large projects (especially with subprojects).
We do have ninja reconfigure if you want to force a reconfigure.
But the errors is telling me to wipe it and create a new one. How that helps me if I have to do manually anyway, when it could be done automatically?
Well, for instance you could downgrade to an older meson version if you really want to continue working with your current directory. If we do this automatically, we will get 2x more bug reports saying that we shouldn't do it automatically :)
Ah okay, closing then
This it's starting to be a pain in the ass.
The GNOME stack is switching to meson more and more, so people are hitting the "this build was configured with a different version" for all the stack when doing a full rebuild.
This needs either to provide a programatically way to catch this error so tools like jhbuild or Builder can handle this, or handle this automatically on the meson part (so we don't need to do all this code on our side, as it was fine with autotools).
@csoriano89 why not just meson $(mktemp -d)?
@arteymix hey, not sure I understand that solution.
This problems comes when we already generated the build with meson build, then these tools just do ninja, and sundenly this command raises this error of the bug report.
How creating a temp directory helps?
I can't see that happen unless Meson is being updated in the meantime. If you need to build from scratch, just configure and unique build directory and invoke ninja into it.
You could as well include Meson version in the build directory pattern (i.e. build/$(meson --version)). That would allow you to determine if the project should be reconfigured if the installed version changes.
The configuration state intrinsically depends on Meson version.
configure and unique build directory and invoke ninja into it.
If you have CCache, then always recreating the build dir (IIRC has be to the same path) and compiling is almost as fast as an incremental build.
@arteymix well of course, otherwise the error wouldn't appear in the first place. This happen because the user updated meson, which for now, is quite regularly since is a fast moving project.
You could as well include Meson version in the build directory pattern (i.e. build/$(meson --version)).
That's one solution indeed, at that point, why not make meson do it internally instead of doing it externally on every IDE/build orquestration tool/user? So far I can count 3 projects that would need this handling on GNOME: Flatpak, jhbuild and Builder (the IDE).
@jpakkane ah that sounds nice, but if I remember correctly the point to disallow doing "meson build" multiple times was because of this reason, or is not that important nowadays and "meson build" could just recreate the build directory fine?
Running meson build on a directory that has already been set up as a build dir is an error.
Maybe an argument just for automated tools? --force-clean or such that removes the directory if incompatible. @
@TingPing @csoriano89 that's exactly what #1662 is about.
Hi again,
Over this time (a year now) I have seen many contributors still confused by this. Shouldn't the default behaviour be changed so that it's always recreated except if you pass an argument to the build for those special projects that take hours to build?
I think we can safely say those will be the exception, not the norm.
@csoriano1618 would this fix this issue for you?
https://github.com/mesonbuild/meson/issues/2026#issuecomment-326902033
See also: https://github.com/mesonbuild/meson/issues/2354 (for CI)
Hey @nirbheek, not sure I understand fully that one, how does that prevents the confusion?
edit: Nevermind, I'm being too vague. I will ask around to the other contributors that were confused and try to write it down here. However, there is also a case for inconvenience for optimizing to the (in my anecdotal opinion) least common case, which is projects taking hours to build.
Most helpful comment
@TingPing @csoriano89 that's exactly what #1662 is about.