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

Compiling static library with -fPIC throws error #100707

Open
nonunknown opened this issue Jan 3, 2023 · 0 comments
Open

Compiling static library with -fPIC throws error #100707

nonunknown opened this issue Jan 3, 2023 · 0 comments
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@nonunknown
Copy link

nonunknown commented Jan 3, 2023

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
@nonunknown nonunknown added the type-bug An unexpected behavior, bug, or error label Jan 3, 2023
@hauntsaninja hauntsaninja added the build The build process and cross-build label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants