libdir inexplicitly overriden when installing a shared library from a subproject
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- build-system
Hướng nghiên cứu
Tái hiện việc cài đặt với các tệp meson.build đã cho bằng cách chạy python -m build -w, sau đó kiểm tra wheel được tạo bằng unzip -l. Theo dõi cách install_dir của subproject custom_target hoặc shared_library được xử lý, bao gồm py.get_install_dir() và đầu ra .foo.mesonpy.libs. Hoàn tất khi thư viện dùng chung được cài đặt dưới dạng foo/libfoo.so, trong khi wrapper và các tệp package vẫn có thể sử dụng được.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm building a ctypes-based Python wrapper for a library provided as a subproject.
I would expect such a project to have a simple layout of foo/__init__.py, foo/wrapper.py and foo/libfoo.so, like in https://github.com/joerick/python-ctypes-package-sample or even https://github.com/peppedilillo/meson-ctypes-test.
The compiled library does the following in subprojects/foo/meson.build:
foo_tgt = custom_target(
'foo',
output: 'libfoo.so',
command: [...],
install: true,
install_dir: get_option('libdir'),
)
It's a custom_target, because it's actually another wrapper, but the same issue persists with shared_library.
My meson.build looks like this:
project('foo-python')
py = import('python').find_installation(pure: false)
py.install_sources(
'foo/__init__.py',
'foo/wrapper.py',
preserve_path: true,
)
subproject(
'foo',
default_options: {
'libdir': py.get_install_dir() / 'foo',
},
)
foo/wrapper.py attempts to load the shared library with a simple ctypes.cdll.LoadLibrary(str(Path(__file__).with_name("libfoo.so"))).
And even though I explicitly specify the libdir, the built wheel contains the .so file in a completely arbitrary location:
$ python -m build -w
...
Successfully built foo-0.1.0-cp313-cp313-linux_x86_64.whl
$ unzip -l dist/foo-0.1.0-cp313-cp313-linux_x86_64.whl
Archive: dist/foo-0.1.0-cp313-cp313-linux_x86_64.whl
Length Date Time Name
--------- ---------- ----- ----
149 2025-11-01 14:50 foo-0.1.0.dist-info/METADATA
88 2025-11-01 14:50 foo-0.1.0.dist-info/WHEEL
1360680 2025-11-01 14:49 .foo.mesonpy.libs/libfoo.so
532 2025-11-01 14:17 foo/__init__.py
22526 2025-11-01 14:18 foo/wrapper.py
507 2025-11-01 14:50 foo-0.1.0.dist-info/RECORD
--------- -------
1389847 7 files
In this case I would expect libfoo.so to be placed in foo/libfoo.so.
This issue only persists when using subprojects. Without them, it's possible to simply do custom_target(..., install: true, install_dir: py.get_install_dir() / 'foo') (or the same with shared_library), as evidenced in https://github.com/peppedilillo/meson-ctypes-test (also related - https://github.com/mesonbuild/meson-python/discussions/573).
Seems to also be related to https://github.com/mesonbuild/meson-python/discussions/770.
- Ngôn ngữ chính
- Python
- Star
- 180
- Fork
- 93
- Merge trung bình
- 20 giờ 58 phút
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mesonbuild/meson-python
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
mesonbuild/meson-python#541 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
mesonbuild/meson-python#473 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement tests
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
mesonbuild/meson-python#903 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
mesonbuild/meson-python#871 · 7 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pip install overrides existing build configurationCó thể đã có người làm @Alvaro-Kothe đã nhận 112 ngày trước. Đang mởquestion
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
mesonbuild/meson-python#851 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của mesonbuild/meson-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
modelcontextprotocol/python-sdk#3648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
VenetoStato/giorgio#6 ·
-
Claiming namespace ddalusĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
EclipseFdn/open-vsx.org#13831 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày