Skip to content

Conversation

@brettcannon
Copy link
Member

@brettcannon brettcannon commented Oct 22, 2021

#binascii binascii.c
#cmath cmathmodule.c _math.c # -lm
#math mathmodule.c _math.c # -lm
#math mathmodule.c # _math.c # -lm # Only one of cmath/math needs to compile _math.c
Copy link
Member

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.

Copy link
Member Author

@brettcannon brettcannon Oct 22, 2021

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`

Copy link
Member Author

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.

Copy link
Member

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.

@brettcannon
Copy link
Member Author

All of this was taken care of in #29179.

@brettcannon brettcannon deleted the fix-math-setup branch October 25, 2021 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants