◐ Shell
clean mode source ↗

bpo-45548: Have Modules/Setup only try to compile _math once by brettcannon · Pull Request #29177 · python/cpython

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that will work with *shared** mode.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.

/usr/bin/ld: Modules/cmathmodule.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your idea of making the functions static might actually be necessary to solve this. Not sure how _math.h influences anything as I haven't looked to see if it's included anywhere else.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relocation R_X86_64_32 against `.data' issue is a different problem. You are trying to use an .o file from a static build in a shared module. You must make clean every time you modify Modules/Setup. ccache helps a lot here.