Compiling static library with `-fPIC` throws error
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
I'm compiling python as a static library to embed in my c++ shared library, and -fPIC is necessary to get it working!
compilation command: CFLAGS=-fPIC ./configure --enable-shared=no --enable-optimizations
the following error happens:
Objects/typeobject.c: In function ‘inherit_special’:
Objects/typeobject.c:5777:1: error: the control flow of function ‘inherit_special’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
5777 | inherit_special(PyTypeObject *type, PyTypeObject *base)
| ^~~~~~~~~~~~~~~
Objects/typeobject.c:5777:1: error: the control flow of function ‘inherit_special’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
Objects/typeobject.c: In function ‘object_set_class’:
Objects/typeobject.c:4774:1: error: the control flow of function ‘object_set_class’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
4774 | object_set_class(PyObject *self, PyObject *value, void *closure)
| ^~~~~~~~~~~~~~~~
Objects/typeobject.c:4774:1: error: the control flow of function ‘object_set_class’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
Objects/obmalloc.c:1449:1: warning: ‘always_inline’ function might not be inlinable [-Wattributes]
1449 | arena_map_get(block *p, int create)
| ^~~~~~~~~~~~~
if I remove the -fPIC it compiles fine!
edit: Just tried removing --enable-optimizations and it worked, but I think it should work with optimizations?
Your environment
- CPython versions tested on: branch 3.11
- Operating system and architecture: Manjaro Linux x64
Hướng dẫn đóng góp
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.
Hướng nghiên cứu
Tái hiện vấn đề với CFLAGS=-fPIC ./configure --enable-shared=no --enable-optimizations trên CPython 3.11, sau đó so sánh với bản build thành công khi không có -fPIC hoặc --enable-optimizations. Bắt đầu với các lỗi được báo cáo trong Objects/typeobject.c và cảnh báo trong Objects/obmalloc.c; công việc được xem là hoàn tất khi bản build tĩnh đã tối ưu hoàn tất với -fPIC.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp, python
- Lĩnh vực
- build-system, compilers
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100