Skip to content

bpo-45548: Have Modules/Setup only try to compile _math once #29177

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ time timemodule.c
#audioop audioop.c
#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.

#pyexpat -I$(srcdir)/Modules/expat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c
#unicodedata unicodedata.c

Expand All @@ -183,7 +183,7 @@ time timemodule.c
#_socket socketmodule.c # socket(2)
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
#grp grpmodule.c # grp(3)
#mmap mmapmodule.c # Also works on win32.
#mmap mmapmodule.c # Also works on win32
#ossaudiodev ossaudiodev.c
#select selectmodule.c # select(2); not on ancient System V
#spwd spwdmodule.c # spwd(3)
Expand All @@ -192,7 +192,7 @@ time timemodule.c
# Some more UNIX dependent modules -- off by default, since these
# are not supported by all UNIX systems:

#_crypt _cryptmodule.c # -lcrypt # crypt(3); breaks many builds.
#_crypt _cryptmodule.c # -lcrypt # crypt(3); breaks many builds
#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
#termios termios.c # Steen Lumholt's termios module
#resource resource.c # Jeremy Hylton's rlimit interface
Expand Down