mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.51k stars 1.6k forks source link

AttributeError: 'NoneType' object has no attribute 'get_debug_crt_args' with cross-compile on 0.52 #6095

Closed bvibber closed 4 years ago

bvibber commented 4 years ago

In my emscripten cross-compile of the dav1d AV1 decoder, I've encountered a regression with meson 0.52. Meson is installed via homebrew on macOS Catalina. Error occurs on both asm.js and WebAssembly target builds; I've included the cross file for the asm.js build as it comes first in the build process.

Internal error message is AttributeError: 'NoneType' object has no attribute 'get_debug_crt_args' which seems to indicate a problem with the detected linker.

Steps to repro:

Actual meson invocation:

meson ../../../dav1d \
  --cross-file=../../../buildscripts/dav1d-asmjs-cross.txt \
  --prefix="$dir/build/js/root" \
  -Dbuild_asm=false \
  -Dbuild_tests=false \
  -Dbuild_tools=false \
  -Dbitdepths='["8"]' \
  -Ddefault_library=static \
  -Dfake_atomics=true \
  --buildtype release

Cross file:

[binaries]
c = 'emcc'
ar = 'emar'
install_name_tool = 'echo'
#exe_wrapper = 'node'
# disable exe_wrapper for the "sanity check" file which is an .exe so doesn't get made as JS/wasm
exe_wrapper = 'echo'

[properties]
c_args = ['-s', 'WASM=0', '-s', 'WASM_OBJECT_FILES=0']
c_link_args = []
needs_exe_wrapper = true

[host_machine]
system = 'linux'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'

Output:

The Meson build system
Version: 0.52.0
Source dir: /Users/brion/src/media/ogv.js/dav1d
Build dir: /Users/brion/src/media/ogv.js/build/js/dav1d
Build type: cross build
Project name: dav1d
Project version: 0.3.1
C compiler for the build machine: cc (clang 11.0.0 "Apple clang version 11.0.0 (clang-1100.0.33.8)")
C linker for the build machine: APPLE ld 512.4
Traceback (most recent call last):
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 129, in run
    return options.run_func(options)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/msetup.py", line 245, in run
    app.generate()
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/msetup.py", line 159, in generate
    self._generate(env)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/msetup.py", line 176, in _generate
    intr = interpreter.Interpreter(b)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2106, in __init__
    self.parse_project()
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 397, in parse_project
    self.evaluate_codeblock(self.ast, end=1)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock
    raise e
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement
    return self.function_call(cur)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 778, in function_call
    return func(node, posargs, kwargs)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 143, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2753, in func_project
    self.add_languages(proj_langs, True)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2814, in add_languages
    success &= self.add_languages_for(args, required, MachineChoice.HOST)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2832, in add_languages_for
    comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/compilers/c.py", line 60, in sanity_check
    return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/compilers/mixins/clike.py", line 221, in sanity_check_impl
    cargs, largs = self._get_basic_compiler_args(environment, mode)
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/compilers/mixins/clike.py", line 302, in _get_basic_compiler_args
    cargs += self.get_linker_debug_crt_args()
  File "/usr/local/Cellar/meson/0.52.0/lib/python3.7/site-packages/mesonbuild/compilers/compilers.py", line 1156, in get_linker_debug_crt_args
    return self.linker.get_debug_crt_args()
AttributeError: 'NoneType' object has no attribute 'get_debug_crt_args'
dcbaker commented 4 years ago

I think this is a duplicate, or very closely related to #5900. Also, can you test with current master, this may be fixed now.

bvibber commented 4 years ago

Confirmed fixed since those fixes landed. Thanks!