mesonbuild / meson

The Meson Build System

Home Page:http://mesonbuild.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileNotFoundError: [Errno 2] No such file or directory: '/home/me/test01/meson-private/coredata.dat'

rusty-snake opened this issue · comments

Describe the bug

Calling meson compile outside of a build directory (or without -C builddir) shows a traceback since 0.60.

To Reproduce

$ mkdir test01 && cd test01 && python3 -m venv venv && source venv/bin/activate && pip3 install meson==0.59.4 && rehash && meson --version && meson compile
Collecting meson==0.59.4
  Using cached meson-0.59.4-py3-none-any.whl (823 kB)
Installing collected packages: meson
Successfully installed meson-0.59.4
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the '/home/me/test01/venv/bin/python3 -m pip install --upgrade pip' command.
0.59.4

ERROR: Current directory is not a meson build directory: `/home/me/test01`.
Please specify a valid build dir or change the working directory to it.
It is also possible that the build directory was generated with an old
meson version. Please regenerate it in this case.
zsh: exit 1     meson compile
$ mkdir test02 && cd test02 && python3 -m venv venv && source venv/bin/activate && pip3 install meson==0.60.1 && rehash && meson --version && meson compile
Collecting meson==0.60.1
  Using cached meson-0.60.1-py3-none-any.whl (837 kB)
Installing collected packages: meson
Successfully installed meson-0.60.1
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the '/home/me/test02/venv/bin/python3 -m pip install --upgrade pip' command.
0.60.1
Traceback (most recent call last):
  File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mesonmain.py", line 138, in run
    return options.run_func(options)
  File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mcompile.py", line 324, in run
    cdata = coredata.load(options.wd)
  File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/coredata.py", line 1030, in load
    with open(filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/me/test02/meson-private/coredata.dat'
zsh: exit 2     meson compile

Expected behavior

Same error message as in 0.59.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
  • what operating system? Fedora Linux 35
  • what Python version are you using? Python 3.10.0
  • what meson --version? 0.59.4/0.60.1
  • what ninja --version if it's a Ninja build? 1.10.2

FYI: Bisected to commit: abaa980

I can confirm this is still an issue on Meson 0.61.1 (running on Mac).

However, passing -C <builddir> is an effective workaround.

However, passing -C <builddir> is an effective workaround.

It's not a workaround.

As the original report notes, the bug here is that this is supposed to error out, with an informative error message rather than a traceback.

That informative error message literally tells you to specify a builddir.

To compile outside the build directory maybe you should just use ninja, ninja -C builddir
but yea.. meson compile -C builddir works as it's supposed to.
I saw the "This is a Meson bug and should be reported!" too so good job creating this report, it was helpful for me