Title: Failed Python build on Fedora 27
Type: compile error Stage: resolved
Components: Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amitg-b14, xdegaye
Priority: normal Keywords:

Created on 2017-12-15 17:27 by amitg-b14, last changed 2017-12-25 10:21 by xdegaye. This issue is now closed.

File name Uploaded Description Edit
build_.txt amitg-b14, 2017-12-24 15:40
Messages (7)
msg308413 - (view) Author: Amit Ghadge (amitg-b14) Date: 2017-12-15 17:27
Hi, I'm try to build Python from source on Fedora 27 but it shows below message and build was failed,
gcc -pthread   -Xlinker -export-dynamic -o python Programs/python.o libpython3.7dm.a -lpthread -ldl  -lutil   -lm  
gcc -pthread   -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.7dm.a -lpthread -ldl  -lutil   -lm  
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
	echo "generate-posix-vars failed" ; \
	rm -f ./pybuilddir.txt ; \
	exit 1 ; \
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1141, in _install
  File "<frozen importlib._bootstrap>", line 1133, in _setup
  File "<frozen importlib._bootstrap>", line 1100, in _builtin_from_name
ImportError: no built-in module named _thread
Fatal Python error: initimport: importlib install failed

Current thread 0x00007fefeacef600 (most recent call first):
/bin/sh: line 5: 12806 Aborted                 (core dumped) ./python -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [Makefile:590: pybuilddir.txt] Error 1
msg308414 - (view) Author: Amit Ghadge (amitg-b14) Date: 2017-12-15 17:30
After the some investigation,
1f06a680de465be0c24a78ea3b610053955daa99 PR was OK,
a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 build failed but ./python run
88c60c9668f0aa732693517a60b851cc1dfce0cb build failed and same error comes after click ./python
msg308415 - (view) Author: Amit Ghadge (amitg-b14) Date: 2017-12-15 17:32
My current git log is,
Author: Victor Stinner <>
Date:   Fri Dec 15 16:29:24 2017 +0100

    bpo-32294: Fix multiprocessing test_semaphore_tracker() (#4885)
msg308997 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-12-24 15:19
I get the same build failure when the following line is commented out in Modules/Setup:

_thread _threadmodule.c         # low-level threading interface

Can you please attach the full output of the build.
msg308999 - (view) Author: Amit Ghadge (amitg-b14) Date: 2017-12-24 15:40
build failure output;
msg309000 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-12-24 15:49
Your build failure output shows that _threadmodule.c is not compiled and therefore the _thread module is missing.

You just need to overwrite the current Modules/Setup file (it is possibly corrupted somehow) as suggested at the start of your attached build output and then run make again:

$ cp Modules/Setup.dist Modules/Setup
$ make
msg309002 - (view) Author: Amit Ghadge (amitg-b14) Date: 2017-12-24 16:31
It's work and build succeed. Thanks Xavier
Date User Action Args
2017-12-25 10:21:10xdegayesetresolution: not a bug
2017-12-24 16:31:08amitg-b14setstatus: open -> closed

messages: + msg309002
stage: resolved
2017-12-24 15:49:27xdegayesetmessages: + msg309000
2017-12-24 15:40:03amitg-b14setfiles: + build_.txt

messages: + msg308999
2017-12-24 15:19:38xdegayesetnosy: + xdegaye
messages: + msg308997
2017-12-15 17:32:22amitg-b14setmessages: + msg308415
2017-12-15 17:30:01amitg-b14setmessages: + msg308414
2017-12-15 17:27:34amitg-b14create