Bug 109071

Summary: meson --wipe <src> <dst> results in Exception: "FileNotFoundError: [Errno 2] No such file or directory"
Product: Mesa Reporter: Gert Wollny <gw.fossdev>
Component: OtherAssignee: Dylan Baker <baker.dylan.c>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: The options file created by the original configuration

Description Gert Wollny 2018-12-16 11:57:43 UTC
Created attachment 142820 [details]
The options file created by the original configuration

After successfully configuring the project, running "meson --wipe ..." results in this FileNotFoundError, log below and the working directory seems to have has changed to something that doesn't exist and build.ninja is not created. I report this here,  but somehow my guess is that this is actually a meson upstream bug. 

The Meson build system
Version: 0.49.0
Source dir: /home/gerddie/src/Collabora/Qemu2/samba/mesa
Build dir: /home/gerddie/src/Collabora/Qemu2/build/mesa-debug
Build type: native build
Program python found: YES (/usr/bin/python)
Project name: mesa
Project version: 19.0.0-devel
Appending CFLAGS from environment: '-Wall -Wextra -Wdeprecated-declarations -O2 -g -funroll-loops -ftree-vectorize -pthread -march=native -mtune=native -mno-xop'
Native C compiler: gcc (gcc 7.3.0 "gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0")
Appending CXXFLAGS from environment: '-Wall -Wextra -Wdeprecated-declarations -O2 -g -funroll-loops -ftree-vectorize -pthread -march=native -mtune=native -mno-xop'
Native C++ compiler: g++ (gcc 7.3.0 "g++ (Gentoo 7.3.0-r3 p1.4) 7.3.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Program pkg-config found: YES (/usr/bin/pkg-config)
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Dependency vdpau found: YES 1.1.1
Dependency xvmc found: YES 1.0.10
WARNING: Found CMake '/usr/bin/cmake' but couldn't run it
Found CMake: NO
Dependency libomxil-bellagio found: NO (tried pkgconfig and cmake)
Dependency libtizonia found: NO (tried pkgconfig and cmake)
Dependency libtizplatform found: NO (tried pkgconfig and cmake)
Dependency tizilheaders found: NO (tried pkgconfig and cmake)
Dependency libva found: YES 0.39.4
DEPRECATION: Project targetting '>= 0.45' but tried to use feature deprecated since '0.48.0': python3 module
Checking for function "bswap32" : YES
Checking for function "bswap64" : YES
Checking for function "clz" : YES
Checking for function "clzll" : YES
Checking for function "ctz" : YES
Checking for function "expect" : YES
Checking for function "ffs" : YES
Checking for function "ffsll" : YES
Checking for function "popcount" : YES
Checking for function "popcountll" : YES
Checking for function "unreachable" : YES
Checking if "__attribute__((const))" compiles: YES
Checking if "__attribute__((flatten))" compiles: YES
Checking if "__attribute__((malloc))" compiles: YES
Checking if "__attribute__((pure))" compiles: YES
Checking if "__attribute__((unused))" compiles: YES
Checking if "__attribute__((warn_unused_result))" compiles: YES
Checking if "__attribute__((weak))" compiles: YES
Checking if "__attribute__((format(...)))" compiles: YES
Checking if "__attribute__((packed))" compiles: YES
Checking if "__attribute__((returns_nonnull))" compiles: YES
Checking if "__attribute__((visibility(...)))" compiles: YES
Checking if "__attribute__((alias(...)))" compiles: YES
Checking if "__attribute__((__noreturn__))" compiles: YES
Compiler for C supports arguments -Werror=implicit-function-declaration: YES
Compiler for C supports arguments -Werror=missing-prototypes: YES
Compiler for C supports arguments -Werror=return-type: YES
Compiler for C supports arguments -fno-math-errno: YES
Compiler for C supports arguments -fno-trapping-math: YES
Compiler for C supports arguments -Qunused-arguments: NO
Compiler for C supports arguments -Wmissing-field-initializers: YES
Compiler for C supports arguments -Wformat-truncation: YES
Compiler for C supports arguments -fvisibility=hidden: YESbuild 
Compiler for C++ supports arguments -Werror=return-type: YES
Compiler for C++ supports arguments -fno-math-errno: YES
Compiler for C++ supports arguments -fno-trapping-math: YES
Compiler for C++ supports arguments -Qunused-arguments: NO
Compiler for C++ supports arguments -Wnon-virtual-dtor: YES
Compiler for C++ supports arguments -Wmissing-field-initializers: YES
Compiler for C++ supports arguments -Wformat-truncation: YES
Compiler for C supports arguments -Woverride-init: YES
Compiler for C supports arguments -Winitializer-overrides: NO
Compiler for C++ supports arguments -fvisibility=hidden: YES
Compiler for C supports arguments -Werror=pointer-arith: YES
Compiler for C++ supports arguments -Werror=pointer-arith: YES
Compiler for C supports arguments -Werror=vla: YES
Compiler for C++ supports arguments -Werror=vla: YES
Checking if "GCC atomic builtins" compiles: YES
Checking if "GCC atomic builtins required -latomic" links: YES
Checking if "GCC 64bit atomics" with dependency not-found links: YES
Header <sys/sysmacros.h> has symbol "major" : YES
Checking if "xlocale.h" compiles: NO
Checking if "sys/sysctl.h" compiles: YES
Checking if "linux/futex.h" compiles: YES
Checking if "endian.h" compiles: YES
Checking if "dlfcn.h" compiles: YES
Checking for function "strtof" : YES
Checking for function "mkostemp" : YES
Checking for function "posix_memalign" : YES
Checking for function "timespec_get" : YES
Checking for function "memfd_create" : YES
Checking if "strtod has locale support" links: YES
Checking if "Bsymbolic" links: YES
Checking if "gc-sections" links: YES
Checking if "version-script" links: YES
Checking if "dynamic-list" links: YES
Checking for function "dlopen" : NO
Library dl found: YES
Checking for function "dladdr" with dependency -ldl: YES
Checking for function "dl_iterate_phdr" : YES
Checking for function "clock_gettime" : YES
Dependency zlib found: YES 1.2.11
Dependency threads found: YES 
Checking for function "pthread_setaffinity_np" with dependency threads: YES
Dependency expat found: YES 2.2.5
Library m found: YES
Dependency libdrm_radeon found: YES 2.4.96
Dependency libdrm found: YES 2.4.96
Found llvm-config: /usr/lib/llvm/6/bin/llvm-config (6.0.1)
Dependency LLVM (modules: amdgpu, asmparser, bitreader, bitwriter, engine, ipo, mcdisassembler, mcjit, native) found: YES 6.0.1
Dependency libelf found: YES 0.170
Dependency valgrind found: YES 3.13.0
Program bison found: YES (/usr/bin/bison)
Program flex found: YES (/usr/bin/flex)
Dependency libunwind found: YES 1.21
Dependency x11 found: YES 1.6.7
Dependency xext found: YES 1.3.3
Dependency xdamage found: YES 1.1.4
Dependency xfixes found: YES 5.0.3
Dependency xcb-glx found: YES 1.13.1
Dependency xcb found: YES 1.13.1
Dependency x11-xcb found: YES 1.6.7
Dependency xcb-dri2 found: YES 1.13.1
Dependency xcb-dri3 found: YES 1.13.1
Dependency xcb-present found: YES 1.13.1
Dependency xcb-sync found: YES 1.13.1
Dependency xshmfence found: YES 1.3
Dependency dri2proto found: YES 2.8
Dependency xxf86vm found: YES 1.1.4
Dependency glproto found: YES 1.4.17
Dependency xcb-xfixes found: YES 1.13.1
Dependency xcb-randr found: YES 1.13.1
Dependency xrandr found: YES 1.5.1
Library libsensors found: YES
Program nm found: YES (/usr/bin/nm)
DEPRECATION: build_always is deprecated. Combine build_by_default and build_always_stale instead.
Checking for function "mincore" : YES
Program /usr/bin/python3.6 found: YES (/usr/bin/python3.6)
Program /usr/bin/python3.6 found: YES (/usr/bin/python3.6)
Program /usr/bin/python3.6 found: YES (/usr/bin/python3.6)
Program /usr/bin/python3.6 found: YES (/usr/bin/python3.6)
Build targets in project: 113
WARNING: Deprecated features used:
 * 0.48.0: {'python3 module'}
Option buildtype is: debug [default: debugoptimized]
Found ninja-1.8.2 at /usr/bin/ninja
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/mesonbuild/mesonmain.py", line 111, in run
    return options.run_func(options)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/msetup.py", line 217, in run
    app.generate()
  File "/usr/lib64/python3.6/site-packages/mesonbuild/msetup.py", line 148, in generate
    self._generate(env)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/msetup.py", line 197, in _generate
    intr.backend.generate(intr)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 225, in generate
    self.generate_target(t, outfile)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 432, in generate_target
    header_deps=header_deps)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 2079, in generate_single_compile
    obj_basename = self.object_filename_from_source(target, src)
  File "/usr/lib64/python3.6/site-packages/mesonbuild/backend/backends.py", line 424, in object_filename_from_source
    source = 'meson-generated_' + os.path.relpath(rel_src, targetdir)
  File "/usr/lib64/python3.6/posixpath.py", line 468, in relpath
    start_list = [x for x in abspath(start).split(sep) if x]
  File "/usr/lib64/python3.6/posixpath.py", line 376, in abspath
    cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
Comment 1 Dylan Baker 2018-12-19 17:47:47 UTC
I'm trying hard to replicate this and having a really hard time, it looks like your meson configure line looks something like:

CFLAGS='-Wall -Wextra -Wdeprecated-declarations -O2 -g -funroll-loops -ftree-vectorize -pthread -march=native -mtune=native -mno-xop' CXXFLAGS='-Wall -Wextra -Wdeprecated-declarations -O2 -g -funroll-loops -ftree-vectorize -pthread -march=native -mtune=native -mno-xop' meson build -Ddri-drivers= -Dgallium-drivers=r600,virgl,swrast -Dvulkan-drivers= -Dbuildtype=debug -Dplatforms=x11,surfaceless,drm -Dlibdir=lib -Dprefix=/tmp/install -Dvalgrind=true

Does that look right?

Also, did do any git operations like checkout, pull, or rebase between the initial configuration and the --wipe call?
Comment 2 Gert Wollny 2018-12-19 18:38:41 UTC
I did not call "meson build" but just "meson <src> <flags> like below" from the empty build directory, and then I simply tried "meson --wipe <src>", I didn't touch the mesa tree.

The CFLAGS and CXXFLAGS are not important it still fails when I unset them. 

My latest test was with 

meson  ../ -Ddri-drivers=i915 -Dgallium-drivers=r600,virgl,swrast\
-Dvulkan-drivers=intel \
-Dbuildtype=debug -Dplatforms=x11,surfaceless,drm \
-Dlibdir=lib -Dprefix=/tmp/install \
-Dvalgrind=true

because I though that the empty drivers list might be the problem, but no, it also fails like this.
Comment 3 Dylan Baker 2018-12-19 18:48:39 UTC
It's much simpler than that, calling meson --wipe from the build dir doesn't work! I can fix this
Comment 4 Gert Wollny 2018-12-19 18:55:44 UTC
Indeed, when I do meson --wipe . build it works :)
Comment 5 Dylan Baker 2018-12-19 19:39:51 UTC
Meson PR that resolves the issue. I've tagged it for inclusion in 0.49.1 as well

https://github.com/mesonbuild/meson/pull/4665
Comment 6 Dylan Baker 2018-12-20 18:32:43 UTC
Upstream patch has landed, this should be resolved for 0.49.1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.