mesonbuild / mesonbuild/meson-python

Can't build a project that contain only ``library()``

Open
#842 8 comments 0 reactions 0 assignees View on GitHub
bug dependency-bug
Dominant language
Python
Stars
180
Forks
93
Avg merge
2d 7h
Merged PRs (30d)
18

Description

**Problem 1**
When building my wheel on windows, I get this error:
```meson
[1/2] D:\a\test_meson\test_meson\.mesonpy-v0dib87v\example.dll
[2/2] D:\a\test_meson\test_meson\.mesonpy-v0dib87v\example.lib
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.13.12\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 389, in
main()
~~~~^^
File "C:\hostedtoolcache\windows\Python\3.13.12\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.13.12\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 280, in build_wheel
return _build_backend().build_wheel(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
wheel_directory, config_settings, metadata_directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\__init__.py", line 1203, in wrapper
return func(*args, **kwargs)
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\__init__.py", line 1257, in build_wheel
return project.wheel(out).name
~~~~~~~~~~~~~^^^^^
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\__init__.py", line 1100, in wheel
return builder.build(directory)
~~~~~~~~~~~~~^^^^^^^^^^^
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\__init__.py", line 511, in build
self._install_path(whl, src, dst)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\__init__.py", line 465, in _install_path
wheel_file.write(origin, destination.as_posix())
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\runneradmin\AppData\Local\Temp\build-env-03i4_as2\Lib\site-packages\mesonpy\_wheelfile.py", line 97, in write
with open(filename, 'rb') as f:
~~~~^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\a\\test_meson\\test_meson\\.mesonpy-v0dib87v\\example.lib'
ERROR Backend subprocess exited when trying to invoke build_wheel
```

**Problem 2**
On platform where I can build the wheel without issue, even thought I don't use python extension, the wheel is named like this: ``example-1.0.0-cp313-cp313-linux_x86_64.whl``, ``example-1.0.0-cp313-cp313-macosx_15_0_arm64.whl``.
I would have expected to be ``example-1.0.0-py3-none-linux_x86_64.whl``, ``example-1.0.0-py3-none-macosx_15_0_arm64.whl``.

**How to reproduce**
You can get the project here: https://github.com/moi15moi/test_meson
It is a really simple project. The ``meson.build`` just contain a ``library()``.

Note that you can see how I builded the wheel in the workflow: https://github.com/moi15moi/test_meson/actions/runs/24110794731
On unix, I used the command ``python -m build --wheel`` and on windows, I used the command ``python -m build --wheel -Csetup-args="--vsenv"``.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the meson.build in the linked reproduction project and the workflow commands described in the issue, then compare wheel builds on Windows, Linux, and macOS. Reproduce the missing .lib failure and inspect the generated wheel tags; done means a library-only project builds on all reported platforms and receives the expected wheel compatibility tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, macos, python
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.