在RedHat 6.4上编译Python 3.4 / 5失败并出现分段错误

时间:2016-06-29 11:58:21

标签: python redhat

我尝试在Redhat 6.4计算机上编译新的Python 3.x版本。在这个例子中,我使用3.5.1。

GCC是gcc版本4.4.7 20120313(Red Hat 4.4.7-3)(GCC)。

./configure --prefix=/data/tools/python3

工作正常,但失败了:

make
gcc -pthread -fPIC -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv   -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Ibuild/temp.linux-x86_64-3.5/libffi/include -Ibuild/temp.linux-x86_64-3.5/libffi -I/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src -I./Include -I. -IInclude -I/usr/local/include -I/cs/san_development/download/py3/Python-3.5.1/Include -I/cs/san_development/download/py3/Python-3.5.1 -c /cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/sysv.S -o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/sysv.o -Wall -fexceptions
gcc -pthread -shared build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/_ctypes.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/callbacks.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/callproc.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/stgdict.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/cfield.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/prep_cif.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/closures.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/ffi64.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/unix64.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/ffi.o build/temp.linux-x86_64-3.5/cs/san_development/download/py3/Python-3.5.1/Modules/_ctypes/libffi/src/x86/sysv.o -L/data/tools/python3/lib -L/usr/local/lib -o build/lib.linux-x86_64-3.5/_ctypes.cpython-35m-x86_64-linux-gnu.so
/bin/sh: line 6:  4791 Segmentation fault      CC='gcc -pthread' LDSHARED='gcc -pthread -shared  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py $quiet build
make: *** [sharedmods] Error 139

最后一个命令的单次执行显示:

CC='gcc -pthread' LDSHARED='gcc -pthread -shared  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py $quiet build
running build
running build_ext
Segmentation fault

当我删除$ quiet并将-v添加到python时,我得到:

.....
import '_csv' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fc89dbfe8d0>
# extension module '_posixsubprocess' loaded from 'build/lib.linux-x86_64-3.5/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so'
# extension module '_posixsubprocess' executed from 'build/lib.linux-x86_64-3.5/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so'
import '_posixsubprocess' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fc89dbfe978>
# extension module '_socket' loaded from 'build/lib.linux-x86_64-3.5/_socket.cpython-35m-x86_64-linux-gnu.so'
# extension module '_socket' executed from 'build/lib.linux-x86_64-3.5/_socket.cpython-35m-x86_64-linux-gnu.so'
import '_socket' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fc89dbfec50>
Segmentation fault

但那并没有真正告诉我任何事情:-)

我想我已经安装了所有依赖项

我也改变了-O3到-O2 -Os甚至-O0,但没有任何帮助。

任何帮助将不胜感激。 丹尼尔

顺便说一下,这是我在stackoverflow上的第一篇文章,希望我没有犯很多错误...

1 个答案:

答案 0 :(得分:0)

我建议使用RH Software Collection版本:http://developers.redhat.com/products/softwarecollections/get-started-rhel6-python/

此文档适用于3.4,但也有3.5版本。