Compiling static library with `-fPIC` throws error
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el problema con CFLAGS=-fPIC ./configure --enable-shared=no --enable-optimizations en CPython 3.11 y compáralo después con la compilación correcta sin -fPIC ni --enable-optimizations. Empieza por los errores notificados en Objects/typeobject.c y la advertencia en Objects/obmalloc.c; el trabajo estará terminado cuando la compilación estática optimizada se complete con -fPIC.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp, python
- Área
- build-system, compilers
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100