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

meson setup panics in CUDA project #14327

Open
JackDyre opened this issue Mar 4, 2025 · 1 comment
Open

meson setup panics in CUDA project #14327

JackDyre opened this issue Mar 4, 2025 · 1 comment
Labels
bug exception Major bug that raises a python-level exception language:cuda

Comments

@JackDyre
Copy link

JackDyre commented Mar 4, 2025

Describe the bug
In a pure CUDA project that links an executable built target with a static library build target, meson setup panics if 'c' is not declared as a language in the project() along with 'cuda'

Declaring 'c' as one of the project languages makes it behave just fine.

Removing the static library build target and only compiling main.cu as a normal cuda executable makes it behave just fine.

To Reproduce

   ~/../../meson_repro ❯ ls --tree
.
├── kernels.cu
├── main.cu
└── meson.build
project(
    'meson_repro',
    # 'c',
    'cuda',
    default_options: ['warning_level=3'],
)

kernels_lib = static_library('kernels', 'kernels.cu')

executable('ml', 'main.cu', link_with: [kernels_lib])
   ~/../../meson_repro ❯ meson setup out
The Meson build system
Version: 1.7.0
Source dir: /home/riley/programming/tmp/meson_repro
Build dir: /home/riley/programming/tmp/meson_repro/out
Build type: native build
Project name: meson_repro
Project version: undefined
Cuda compiler for the host machine: nvcc (nvcc 12.8.61
Build cuda_12.8.r12.8/compiler.35404655_0)
Cuda linker for the host machine: nvcc nvlink 12.8.61
Build cuda_12.8.r12.8/compiler.35404655_0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 2

Found ninja-1.12.1 at /sbin/ninja
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mesonbuild/msetup.py", line 365, in run
    app.generate()
    ~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/mesonbuild/msetup.py", line 188, in generate
    return self._generate(env, capture, vslite_ctx)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mesonbuild/msetup.py", line 253, in _generate
    captured_compile_args = intr.backend.generate(capture, vslite_ctx)
  File "/usr/lib/python3.13/site-packages/mesonbuild/backend/ninjabackend.py", line 663, in generate
    self.generate_target(t)
    ~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/site-packages/mesonbuild/backend/ninjabackend.py", line 1097, in generate_target
    elem = self.generate_link(target, outname, final_obj_list, linker, pch_objects, stdlib_args=stdlib_args)
  File "/usr/lib/python3.13/site-packages/mesonbuild/backend/ninjabackend.py", line 3501, in generate_link
    commands = linker.compiler_args()
               ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'compiler_args'

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

Expected behavior
Not to panic.

system parameters

  • Arch Linux x86_64
  • meson 1.7.0
  • python 3.13.2
  • ninja 1.12.1
@JackDyre
Copy link
Author

JackDyre commented Mar 4, 2025

I was able to reproduce this from the the most recent commit as well as the official arch linux package

I was unable to find a good commit as to bisect from.

But, if it is helpful:

I was able to bisect to find that 0240d760c7699a059cc89e584363c6431cdd2b61 is the first commit that gives the same error message that the most recent version has.

Before this commit I found many different error messages. I did not respect MSPV when poking around for a good bisection commit. To test the different versions, I just did ../meson/meson.py from my dummy repro project.

@bonzini bonzini added the exception Major bug that raises a python-level exception label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug exception Major bug that raises a python-level exception language:cuda
Projects
None yet
Development

No branches or pull requests

3 participants