-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-31171: add `-lpthread' to build multiprocessing for linux platform #13353
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
Conversation
While cross compiling on Linux, AC_RUN_IFELSE to check `-pthread' is always false, add `-lpthread' to linker, it fixed multiprocessing.BoundedSemaphore of 32-bit python did not work. Whether corss compiling or not, whether supports `-pthread' or not, the fix does not have side effect on Linux platform. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
@@ -1619,7 +1621,11 @@ def detect_multiprocessing(self): | |||
libraries=libs, | |||
include_dirs=["Modules/_multiprocessing"])) | |||
|
|||
if HOST_PLATFORM.startswith('linux'): | |||
multiprocessing_lib = ['pthread'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xdegaye Does it look right to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also cc @rossburton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Android, the Python platform name is linux
and pthread is not a standalone library but it is included in the libc (named bionic
), same as on MacOS X. Therefore -lpthread
is not used at the link stage.
IMO it is confusing to have both configure and setup.py handle the setting of -lpthread
especially since the configure implementation of pthread variants is already quite involved. It would be better to just fix configure.ac
if it is needed.
It is not clear from the comments on issue 31171 if the compiler -pthread
option is available. If that option is available then running configure with ac_cv_pthread=yes
sets CC="$CC -pthread"
and that should fix the problem raised in the issue. Quoted from gcc documentation:
'-pthread'
Define additional macros required for using the POSIX threads
library. You should use this option consistently for both
compilation and linking. This option is supported on GNU/Linux
targets, most other Unix derivatives, and also on x86 Cygwin and
MinGW targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if the cross-compiler does not support the -pthread
option then run make with LDFLAGS:
LDFLAGS=-lpthread make
|
While cross compiling on Linux, AC_RUN_IFELSE to check
-pthread' is always false, add
-lpthread' to linker, it fixed multiprocessing.BoundedSemaphoreof 32-bit python did not work.
Whether corss compiling or not, whether supports `-pthread' or not, the fix
does not have side effect on Linux platform.
Signed-off-by: Hongxu Jia hongxu.jia@windriver.com
https://bugs.python.org/issue31171