Meson: Meson sometimes decides to write files into meson-out

Created on 13 Feb 2020  Â·  11Comments  Â·  Source: mesonbuild/meson

For whatever reason meson sometimes decides that it should write files into the meson-out folder instead of the proper mirrored file structure, this can lead to problems when you generate multiple files of the same name.

See this mesa bug. I've also hit this with one of my projects, although it's not as serious for me because I don't have any code generators.

bug

All 11 comments

This appears to be related to meson changing the layout mode to flat for some reason. I need to investigate more.

Meson version is 0.51.0 if that helps.

I've been able to intermittently reproduce this on 0.52.1 as well

Happens in 0.53.1 aswell. Although i can't reproduce it consistently, it seems to happen more regularly when generating a new build folder.

Interesting, I've only been able to reproduce it by causing meson to reconfigure due to an upgrade.

Maybe this could happen if something fiddly happened in the coredata? We could merge something like this to make it barf if that happens:

--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -204,10 +204,13 @@ class Backend:

     @lru_cache(maxsize=None)
     def get_target_dir(self, target):
-        if self.environment.coredata.get_builtin_option('layout') == 'mirror':
+        layout = self.environment.coredata.get_builtin_option('layout')
+        if layout == 'mirror':
             dirname = target.get_subdir()
-        else:
+        elif layout == 'flat':
             dirname = 'meson-out'
+        else:
+            raise AssertionError('Invalid layout value {!r} found in coredata'.format(layout))
         return dirname

     def get_target_dir_relative_to(self, t, o):

This issue also happens for me, multiple times a day. Meson randomly decides to put its files in $BUILDDIR/meson-out instead of $BUILDDIR.

Any files you would like me to collect the next time this happens?

I am using meson 0.53.1 on macOS Mojave 10.14.6 installed using homebrew.

@nirbheek I applied your patch to my local meson install. Let's see if it barks

So, I did some more debugging and I found the root cause of my issue. I have an extension for vscode called vscode-meson for which I enabled the mesonbuild.configureOnOpen option.

I now discovered that the extension configured meson with the --layout=flat option by default 😅. This can be resolved by either setting mesonbuild.configureOnOpen to false or changing mesonbuild.configureOptions so it doesn't set the layout to flat.

Same for me. Had to uninstall that extension.

Noah Loomans notifications@github.com schrieb am Sa., 22. Feb. 2020,
15:04:

So, I did some more debugging and I found the root cause of my issue. I
have an extension for vscode called vscode-meson
https://github.com/asabil/vscode-meson for which I enabled the
mesonbuild.configureOnOpen option.

I now discovered that the extension configured meson with the
--layout=flat option by default 😅. This can be resolved by either
setting mesonbuild.configureOnOpen to false or changing
mesonbuild.configureOptions so it doesn't set the layout to flat.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mesonbuild/meson/issues/6623?email_source=notifications&email_token=AATV5V57NFDSSMMEBU7NR7LREEWHRA5CNFSM4KUZSHH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVBBBI#issuecomment-589959301,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AATV5V4BXBTU4ED3S5GL2PLREEWHRANCNFSM4KUZSHHQ
.

I sent a patch for that extension which was merged, just need a new release.

Was this page helpful?
0 / 5 - 0 ratings