Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Show the source line number of the Meson build definition when a Meson exception is thrown and printed #9365

Closed
lb90 opened this issue Oct 7, 2021 · 4 comments

Comments

@lb90
Copy link
Contributor

lb90 commented Oct 7, 2021

If a Meson exception is thrown then it's probably the fault of the Meson build definition (meson.build) of the project. The user is presented with a call stack but doesn't know which statement in meson.build caused that

Today I tried building GIMP using Meson from the main branch. I get a Meson exception but I don't quite know where to look at in the Meson build definitions:

$ python3 ../meson/meson.py ../gimp --buildtype=debug -Dgtk-doc=false
The Meson build system
Version: 0.59.99
Source dir: D:/gimp
Build dir: D:/gimp-dbg
Build type: native build
Project name: gimp
Project version: 2.99.7
C compiler for the host machine: cc (gcc 10.3.0 "cc (Rev5, Built by MSYS2 project) 10.3.0")
C linker for the host machine: cc ld.bfd 2.37
C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (Rev5, Built by MSYS2 project) 10.3.0")
C++ linker for the host machine: c++ ld.bfd 2.37
Host machine cpu family: x86_64
Host machine cpu: x86_64
../gimp/meson.build:89: WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases.
Message: Host machine cpu family: x86_64
Message: Host os: windows
Compiler for C supports arguments -mmx: NO
Compiler for C supports arguments -sse: NO
Compiler for C supports arguments -msse2: YES
Compiler for C supports arguments -msse4.1: YES
Compiler for C supports arguments -fdiagnostics-show-option: YES
Compiler for C supports arguments -fno-common: YES
Compiler for C supports arguments -Wformat: YES
Compiler for C supports arguments -Wformat-security: YES
Compiler for C supports arguments -Winit-self: YES
Compiler for C supports arguments -Wlogical-op: YES
Compiler for C supports arguments -Wmissing-declarations: YES
Compiler for C supports arguments -Wmissing-format-attribute: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wreturn-type: YES
Compiler for C supports arguments -Wtype-limits: YES
Compiler for C supports arguments -Wabsolute-value: YES
Compiler for C supports arguments -Wdeclaration-after-statement: YES
Compiler for C supports arguments -Wenum-conversion: YES
Compiler for C supports arguments -Wliteral-conversion: NO
Compiler for C supports arguments -Wno-strict-prototypes: YES
Compiler for C supports arguments -Wold-style-definition: YES
Compiler for C supports arguments -Wparentheses-equality: NO
Compiler for C supports arguments -W#pragma-messages: NO
Compiler for C supports arguments -Wsometimes-uninitialized: NO
Compiler for C supports arguments -Wtautological-unsigned-enum-zero-compare: NO
Compiler for C supports arguments -Wunneeded-internal-declaration: NO
Compiler for C supports arguments -Wunused-function: YES
Compiler for C supports arguments -Wunused-value: YES
Compiler for C supports arguments -Werror=implicit-function-declaration: YES
Compiler for C supports arguments -fnative-struct: NO
Compiler for C supports arguments -mms-bitfields: YES
First supported argument: -mms-bitfields
Library m found: YES
Library rpcrt4 found: YES
Library dbghelp found: YES
Library ws2_32 found: YES
Found pkg-config: D:\msys64\mingw64\bin/pkg-config.EXE (1.8.0)
Run-time dependency atk found: YES 2.36.0
Run-time dependency babl found: YES 0.1.88
Run-time dependency cairo found: YES 1.17.4
Run-time dependency fontconfig found: YES 2.13.94
Run-time dependency freetype2 found: YES 24.0.18
Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.6
Run-time dependency gegl-0.4 found: YES 0.4.32
Run-time dependency gexiv2 found: YES 0.12.3
Run-time dependency gio-2.0 found: YES 2.70.0
Run-time dependency gio-windows-2.0 found: YES 2.70.0
Run-time dependency glib-2.0 found: YES 2.70.0
Run-time dependency gobject-2.0 found: YES 2.70.0
Run-time dependency gmodule-no-export-2.0 found: YES 2.70.0
Run-time dependency gtk+-3.0 found: YES 3.24.30
Run-time dependency harfbuzz found: YES 2.9.1
Run-time dependency json-glib-1.0 found: YES 1.6.6
Run-time dependency lcms2 found: YES 2.12
Run-time dependency libmypaint found: YES 1.5.1
Run-time dependency mypaint-brushes-1.0 found: YES 1.3.1
Run-time dependency pangocairo found: YES 1.49.1
Run-time dependency pangoft2 found: YES 1.49.1
Run-time dependency librsvg-2.0 found: YES 2.50.3
Library socket found: NO
Run-time dependency appstream-glib found: YES 0.7.18
Run-time dependency libarchive found: YES 3.5.2
Library backtrace found: NO
Found CMake: D:\msys64\mingw64\bin/cmake.EXE (3.21.3)
Run-time dependency libunwind found: NO (tried pkgconfig and cmake)
Library exchndl found: YES
Checking for function "ExcHndlSetLogFileNameA" with dependency -lexchndl: YES
Run-time dependency libtiff-4 found: YES 4.3.0
Run-time dependency libjpeg found: YES 2.1.1
Run-time dependency zlib found: YES 1.2.11
Library bz2 found: YES
Run-time dependency liblzma found: YES 5.2.5
Library gs found: YES
Run-time dependency libpng found: YES 1.6.37
Library mng found: YES
Library aa found: NO
Run-time dependency xpm found: YES 4.2.0
Run-time dependency openexr found: YES 2.5.7
Run-time dependency libwebp found: YES 1.2.1
Run-time dependency libwebpmux found: YES 1.2.1
Run-time dependency libwebpdemux found: YES 1.2.1
Run-time dependency libheif found: YES 1.12.0
Vala compiler for the host machine: valac (valac 0.54.1)
Library babl-0.1 found: YES
Run-time dependency webkit2gtk-4.0 found: NO (tried pkgconfig and cmake)
Run-time dependency poppler-glib found: YES 21.09.0
Run-time dependency poppler-data found: YES 0.4.11
Run-time dependency cairo-pdf found: YES 1.17.4
Run-time dependency libwmf found: YES 0.2.12
Run-time dependency libopenjp2 found: YES 2.4.0
Run-time dependency libjxl found: NO (tried pkgconfig and cmake)
Run-time dependency libjxl_threads found: NO (tried pkgconfig and cmake)
Run-time dependency xcursor found: NO (tried pkgconfig and cmake)
WARNING: CMake Toolchain: Failed to determine CMake compilers state
Run-time dependency alsa found: NO (tried pkgconfig and cmake)
Run-time dependency gudev-1.0 found: NO (tried pkgconfig and cmake)
Program xdg-email found: NO
../gimp/meson.build:885: WARNING: Xdg-email not found, but required at runtime for email sending.
Run-time dependency iso-codes found: YES 4.7.0
Program perl found: YES (D:\msys64\usr\bin/perl.EXE)
Program python3 found: YES (D:\msys64\mingw64\bin/python3.EXE)
Message: Found Python 3.9
WARNING: Project targeting '>=0.50.0' but tried to use feature introduced in '0.60.0': str.join (varargs). List-flattening and variadic arguments
Message: Found Pygobject: true
Program gjs found: NO
Program luajit found: YES (D:\msys64\mingw64\bin/luajit.EXE)
Program xmllint found: YES (D:\msys64\mingw64\bin/xmllint.EXE)
Program xsltproc found: YES (D:\msys64\mingw64\bin/xsltproc.EXE)
Program intltool-merge found: YES (perl -w D:\msys64\usr\bin/intltool-merge)
Program desktop-file-validate found: NO
Program appstream-util found: YES (D:\msys64\mingw64\bin/appstream-util.EXE)
Program xvfb-run found: NO
Program dbus-run-session found: NO
Program tools/defcheck.py found: YES (D:/msys64/mingw64/bin/python3.exe D:/gimp/tools/defcheck.py)
Program tools/extract-vector-icon.sh found: YES (sh D:/gimp/tools/extract-vector-icon.sh)
Program tools/generate_changelog.sh found: YES (bash D:/gimp/tools/generate_changelog.sh)
Program tools/generate-news found: YES (bash D:/gimp/tools/generate-news)
Program tools/gimppath2svg.py found: YES (python2 D:/gimp/tools/gimppath2svg.py)
Program tools/module-dependencies.py found: YES (python2 D:/gimp/tools/module-dependencies.py)
Program tools/meson_install_subdir.py found: YES (D:/msys64/mingw64/bin/python3.exe D:/gimp/tools/meson_install_subdir.py)
Program tools/gimp-mkenums found: YES (perl -w D:/gimp/tools/gimp-mkenums)
Checking for function "alloca" : YES
Checking for function "dcgettext" : YES
Checking for function "difftime" : YES
Checking for function "fsync" : NO
Checking for function "getaddrinfo" : NO
Checking for function "getnameinfo" : NO
Checking for function "gettext" : YES
Checking for function "mmap" : NO
Checking for function "rint" : YES
Checking for function "thr_self" : NO
Checking for function "vfork" : NO
Header <libintl.h> has symbol "bind_textdomain_codeset" : YES
Header <libintl.h> has symbol "vprintf" : YES
Has header "alloca.h" : NO
Has header "dlfcn.h" : NO
Has header "fcntl.h" : YES
Has header "ieeefp.h" : YES
Has header "inttypes.h" : YES
Has header "locale.h" : YES
Has header "math.h" : YES
Has header "memory.h" : YES
Has header "stdint.h" : YES
Has header "stdlib.h" : YES
Has header "string.h" : YES
Has header "strings.h" : YES
Has header "sys/param.h" : YES
Has header "sys/select.h" : NO
Has header "sys/stat.h" : YES
Has header "sys/thr.h" : NO
Has header "sys/time.h" : YES
Has header "sys/times.h" : NO
Has header "sys/types.h" : YES
Has header "sys/wait.h" : NO
Has header "unistd.h" : YES
Has header "sys/mman.h" : NO
Has header "sys/ipc.h" : NO
Has header "sys/shm.h" : NO
Has header "execinfo.h" : NO
Has header "execinfo.h" : NO (cached)
Program D:/msys64/mingw64/bin/python3.exe found: YES (D:/msys64/mingw64/bin/python3.exe)
Program D:/msys64/mingw64/bin/python3.exe found: YES (D:/msys64/mingw64/bin/python3.exe)
Program D:/msys64/mingw64/bin/python3.exe found: YES (D:/msys64/mingw64/bin/python3.exe)
Program git found: NO
Configuring INSTALL using configuration
Configuring config.h using configuration
Program D:/gimp/tools/defcheck.py found: YES (D:/msys64/mingw64/bin/python3.exe D:/gimp/tools/defcheck.py)
Program meson_dist_script.sh found: YES (bash D:/gimp/meson_dist_script.sh)
Configuring gimp-plug-ins.rc using configuration
Configuring gimp.rc using configuration
Program meson found: YES (D:\msys64\mingw64\bin/meson.EXE)
Configuring gimpversion.h using configuration
Configuring gimp-tool-cursors.gresource.xml using configuration
Configuring gimp-color-picker-cursors.gresource.xml using configuration
Found pkg-config: D:\msys64\mingw64\bin/pkg-config.EXE (1.8.0)
Program glib-compile-resources found: YES (D:\msys64\mingw64\bin/glib-compile-resources.EXE)
Program glib-compile-resources found: YES (D:\msys64\mingw64\bin/glib-compile-resources.EXE)
Program sh found: YES (D:\msys64\usr\bin/sh.EXE)
Program echo found: YES (D:\msys64\usr\bin/echo.EXE)
Configuring gimp.desktop.in using configuration
Configuring org.gimp.GIMP.appdata.xml.in using configuration
Configuring gimp-data-extras.metainfo.xml.in using configuration
Configuring gimprc using configuration
Configuring gimp-core-pixbufs.gresource.xml with command
Program glib-compile-resources found: YES (D:\msys64\mingw64\bin/glib-compile-resources.EXE)
Configuring gimp-icon-pixbufs.gresource.xml with command
Program glib-compile-resources found: YES (D:\msys64\mingw64\bin/glib-compile-resources.EXE)
Configuring gimp-core-pixbufs.gresource.xml with command
Configuring gimp-icon-pixbufs.gresource.xml with command
Configuring gimp-core-pixbufs.gresource.xml with command
Configuring gimp-icon-pixbufs.gresource.xml with command
Program glib-genmarshal found: YES (D:\msys64\mingw64\bin/glib-genmarshal.EXE)
Traceback (most recent call last):
  File "D:/meson/mesonbuild/mesonmain.py", line 228, in run
    return options.run_func(options)
  File "D:/meson/mesonbuild/msetup.py", line 290, in run
    app.generate()
  File "D:/meson/mesonbuild/msetup.py", line 181, in generate
    self._generate(env)
  File "D:/meson/mesonbuild/msetup.py", line 225, in _generate
    intr.run()
  File "D:/meson/mesonbuild/interpreter/interpreter.py", line 2458, in run
    super().run()
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock
    raise e
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement
    return self.function_call(cur)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 450, in function_call
    res = func(node, func_args, kwargs)
  File "D:/meson/mesonbuild/interpreterbase/decorators.py", line 696, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "D:/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "D:/meson/mesonbuild/interpreterbase/decorators.py", line 275, in wrapper
    return f(*nargs, **wrapped_kwargs)
  File "D:/meson/mesonbuild/interpreter/interpreter.py", line 1943, in func_subdir
    self.evaluate_codeblock(codeblock)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock
    raise e
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement
    self.assignment(cur)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 562, in assignment
    value = self.evaluate_statement(node.value)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement
    return self.method_call(cur)
  File "D:/meson/mesonbuild/interpreterbase/interpreterbase.py", line 478, in method_call
    res = obj.method_call(method_name, args, kwargs)
  File "D:/meson/mesonbuild/interpreter/interpreterobjects.py", line 751, in method_call
    ret = method(state, args, kwargs)
  File "D:/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "D:/meson/mesonbuild/modules/gnome.py", line 1667, in genmarshal
    header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs)
  File "D:/meson/mesonbuild/build.py", line 2314, in __init__
    self.process_kwargs(kwargs, backend)
  File "D:/meson/mesonbuild/build.py", line 2425, in process_kwargs
    if isinstance(kwargs['install_dir'], list):
KeyError: 'install_dir'

It'd be very useful to know the meson.build and line number / op that is being parsed or interpreted.

@eli-schwartz
Copy link
Member

This is not a Meson exception. Meson exceptions do print line numbers.

This is a meson bug, throwing a python traceback and must be fixed.

@eli-schwartz
Copy link
Member

Duplicate of #9350

@eli-schwartz eli-schwartz marked this as a duplicate of #9350 Oct 7, 2021
@lb90
Copy link
Contributor Author

lb90 commented Oct 7, 2021

Ah, indeed. Thanks!

@eli-schwartz
Copy link
Member

This is not a Meson exception. Meson exceptions do print line numbers.

For the record, since 3c039f4 we report a better error on python exceptions too.

We still print the full traceback, but we follow up on that with something like:

meson.build:1234:0: ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

This also means that

it's probably the fault of the Meson build definition

this will be clearly contradicted by Meson. Meson knows that anything which produces a traceback is automatically a bug, if for no other reason than that all errors should be caught and communicated clearly with regard to why meson considers it problematic... so when Meson encounters an unrecognizable traceback, it tells you that you should report it as a bug to us.

The meson.build line number context is provided too, to help narrow down what meson.build content triggered an internal error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants