This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: generate-posix-vars failed when building Python 2.7.14 on Linux
Type: Stage: resolved
Components: Build Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Peter Senna Tschudin, benjamin.peterson, fweimer, ned.deily, piotr.dobrogost, tgrigg
Priority: normal Keywords:

Created on 2018-04-27 15:45 by piotr.dobrogost, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg315846 - (view) Author: Piotr Dobrogost (piotr.dobrogost) Date: 2018-04-27 15:45
When building Python 2.7.14 on Fedora 28 I get the following error:

[piotr@demon]/tmp/Python-2.7.14% make
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
 echo "generate-posix-vars failed" ; \
 rm -f ./pybuilddir.txt ; \
 exit 1 ; \
/bin/sh: line 5: 25857 Segmentation fault      (core dumped) ./python -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make[2]: *** [Makefile:514: pybuilddir.txt] Error 1
make[2]: Leaving directory '/tmp/Python-2.7.14'
make[1]: *** [Makefile:444: build_all_generate_profile] Error 2
make[1]: Leaving directory '/tmp/Python-2.7.14'
make: *** [Makefile:429: profile-opt] Error 2

Running problematic command alone I get this:

[piotr@demon]/tmp/Python-2.7.14% ./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
zsh: segmentation fault (core dumped)  ./python -E -S -m sysconfig --generate-posix-vars

I found somehow related with excellent explanation by Ned Deily ( but that issue is supposedly fixed.

I have Python 3.6.5 installed at /usr/bin/python3 and Python 2.7.14 installed at /usr/bin/python{2} – both from RPM packages.

I have Python 2.7.13 installed at /usr/local/bin/python{2} – built from source.

Running `which python` returns "/usr/local/bin/python".

Trying to isolate configuration and build by prefixing commands with
PATH=/usr/bin:/usr/sbin LIBRARY_PATH= LD_LIBRARY_PATH= (…)
does not help.
msg315857 - (view) Author: Tom Grigg (tgrigg) Date: 2018-04-27 21:21
I beleive this is caused by in combination with GCC 8.

Florian Weimer proposed a patch which is included in the Fedora build:

It would be nice if this was fixed for 2.7.15 so that it would build out of the box with GCC 8 on x86_64-linux-gnu.
msg315916 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-04-29 19:25
New changeset 0b91f8a668201fc58fa732b8acc496caedfdbae0 by Benjamin Peterson (Florian Weimer) in branch '2.7':
Indicate that _PyGC_Head is only 8-byte aligned. (closes bpo-33374)
msg321044 - (view) Author: Peter Senna Tschudin (Peter Senna Tschudin) Date: 2018-07-04 14:18
I got here when trying to build Yocto Sumo on Fedora 28. python_native build was failing with a segfault. Here is how I fixed it with no elegance intended:

$ git clone
$ cd cpython/
$ git show 0b91f8a668201fc58fa732b8acc496caedfdbae0 > /tmp/gcc8-fix.patch

$ cd $HOME/poky-sumo/meta/recipes-devtools/python
$ cp /tmp/gcc8-fix.patch python-native/

$ git diff
diff --git a/meta/recipes-devtools/python/ b/meta/recipes-devtools/python/
index 7c491fa3e0..e9a8c14e9c 100644
--- a/meta/recipes-devtools/python/
+++ b/meta/recipes-devtools/python/
@@ -16,6 +16,7 @@ SRC_URI += "\
             file://builddir.patch \
             file://parallel-makeinst-create-bindir.patch \
             file://revert_use_of_sysconfigdata.patch \
+            file://gcc8-fix.patch \
 S = "${WORKDIR}/Python-${PV}"
Date User Action Args
2022-04-11 14:58:59adminsetgithub: 77555
2018-07-04 14:18:33Peter Senna Tschudinsetnosy: + Peter Senna Tschudin
messages: + msg321044
2018-04-29 19:25:54benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg315916

stage: resolved
2018-04-28 00:13:52ned.deilysetnosy: + benjamin.peterson
2018-04-27 21:24:16tgriggsetnosy: + fweimer
2018-04-27 21:21:10tgriggsetnosy: + tgrigg
messages: + msg315857
2018-04-27 15:45:47piotr.dobrogostcreate