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

Cross file property cmake_skip_compiler_test = true causes exception #13391

Open
denizzzka opened this issue Jul 8, 2024 · 1 comment
Open
Labels
good first issue module:cmake Issues related to the cmake module, including cmake.subproject

Comments

@denizzzka
Copy link

denizzzka commented Jul 8, 2024

Describe the bug
Cross file property cmake_skip_compiler_test = true causes Python exception

To Reproduce
To reproduce please use same files as described in #13390 with additional cross file arm_cortex_m4_cross.ini:

[host_machine]
system = 'bare metal'
cpu_family = 'arm'
cpu = 'cortex-m4'
endian = 'little'

[binaries]
d = 'ldc2'
c = 'clang'
cpp = 'clang'
d_ld = 'lld'
c_ld = 'lld'
cpp_ld = 'lld'
ar = 'llvm-ar'
strip = 'llvm-strip'
nm = 'llvm-nm'
exe_wrapper = [
        'qemu-system-arm',
            '-machine', 'netduinoplus2',
            '-nographic',
            '-semihosting',
            '-kernel',
    ]

[properties]
skip_sanity_check = true
cmake_skip_compiler_test = true

Run:

> ~/Dev/meson/meson.py setup --cross-file arm_cortex_m4_cross.ini -Ddebug=true builddir1
The Meson build system
Version: 1.5.0.rc2
Source dir: /home/denizzz/Dev/bug_meson
Build dir: /home/denizzz/Dev/bug_meson/builddir1
Build type: cross build
Project name: test project
Project version: undefined
Cross compiler sanity tests disabled via the cross file.
C compiler for the host machine: clang (clang 18.1.7 "Debian clang version 18.1.7 (1)")
C linker for the host machine: clang ld.lld 18.1.7
C++ compiler for the host machine: clang (clang 18.1.7 "Debian clang version 18.1.7 (1)")
C++ linker for the host machine: clang ld.lld 18.1.7
D compiler for the host machine: ldc2 (llvm 1.39.0 "LDC - the LLVM D compiler (1.39.0):")
D linker for the host machine: ldc2 ld.lld 18.1.7
C compiler for the build machine: ccache cc (clang 18.1.7 "Debian clang version 18.1.7 (1)")
C linker for the build machine: cc ld.bfd 2.42
C++ compiler for the build machine: ccache c++ (clang 18.1.7 "Debian clang version 18.1.7 (1)")
C++ linker for the build machine: c++ ld.bfd 2.42
D compiler for the build machine: ldc2 (llvm 1.39.0 "LDC - the LLVM D compiler (1.39.0):")
D linker for the build machine: ldc2 ld.bfd 2.42
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: arm
Host machine cpu: cortex-m4
Target machine cpu family: arm
Target machine cpu: cortex-m4

Executing subproject ldc method cmake 

ldc| Found CMake: /usr/bin/cmake (3.29.6)
Traceback (most recent call last):
  File "/home/denizzz/Dev/meson/mesonbuild/mesonmain.py", line 188, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/msetup.py", line 364, in run
    app.generate()
  File "/home/denizzz/Dev/meson/mesonbuild/msetup.py", line 187, in generate
    return self._generate(env, capture, vslite_ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/msetup.py", line 226, in _generate
    intr.run()
  File "/home/denizzz/Dev/meson/mesonbuild/interpreter/interpreter.py", line 3032, in run
    super().run()
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 169, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    raise e
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 187, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 205, in evaluate_statement
    self.assignment(cur)
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 642, in assignment
    value = self.evaluate_statement(node.value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 207, in evaluate_statement
    return self.method_call(cur)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/interpreterbase.py", line 557, in method_call
    res = obj.method_call(method_name, args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreter/interpreterobjects.py", line 854, in method_call
    ret = method(state, args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/decorators.py", line 663, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/decorators.py", line 250, in wrapper
    return f(*nargs, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreterbase/decorators.py", line 569, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/modules/cmake.py", line 429, in subproject
    subp = self.interpreter.do_subproject(dirname, kw, force_method='cmake')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreter/interpreter.py", line 948, in do_subproject
    raise e
  File "/home/denizzz/Dev/meson/mesonbuild/interpreter/interpreter.py", line 936, in do_subproject
    return methods_map[method](subp_name, subdir, default_options, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/interpreter/interpreter.py", line 1022, in _do_subproject_cmake
    cm_int.initialise(cmake_options)
  File "/home/denizzz/Dev/meson/mesonbuild/cmake/interpreter.py", line 876, in initialise
    self.configure(extra_cmake_options)
  File "/home/denizzz/Dev/meson/mesonbuild/cmake/interpreter.py", line 822, in configure
    toolchain = CMakeToolchain(cmake_exe, self.env, self.for_machine, CMakeExecScope.SUBPROJECT, self.build_dir, preload_file)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/cmake/toolchain.py", line 48, in __init__
    skip_status = self.properties.get_cmake_skip_compiler_test()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/denizzz/Dev/meson/mesonbuild/envconfig.py", line 214, in get_cmake_skip_compiler_test
    assert isinstance(raw, str)
           ^^^^^^^^^^^^^^^^^^^^
AssertionError

meson.build:7:12: ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

Expected behavior
Run without error

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?

Cross-compilation

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)

Debian Linux

  • what Python version are you using e.g. 3.8.0

3.12.4

  • what meson --version

~master and 1.4.1

@denizzzka denizzzka changed the title cross file propery cmake_skip_compiler_test = true causes exception Cross file property cmake_skip_compiler_test = true causes exception Jul 8, 2024
@dcbaker dcbaker added good first issue module:cmake Issues related to the cmake module, including cmake.subproject labels Jul 9, 2024
@dcbaker
Copy link
Member

dcbaker commented Jul 9, 2024

That assert is just bogus. It should either be removed, or the code should be refactored so that a non-string ends up in common error condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue module:cmake Issues related to the cmake module, including cmake.subproject
Projects
None yet
Development

No branches or pull requests

2 participants