Redhat
在 redhat 5 上建構 Python 3.2.3:缺少 _posixsubprocess
我正在嘗試在 RHEL 5.7 機器上建構 Python3,我成功地建構了 Python 3.2.2,其中:
# Install required build dependencies yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel # Fetch and extract source. Please refer to http://www.python.org/download/releases # to ensure the latest source is used. wget http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2 tar -xjf Python-3.2.tar.bz2 cd Python-3.2 # Configure the build with a prefix (install dir) of /opt/python3, compile, and install. ./configure --prefix=/opt/python3 make
但我在 Python 3.2.3 上失敗了(?):
Failed to build these modules: _posixsubprocess
這是一個應該困擾我的問題嗎?我該如何建構它?我找到了這個更新檔,但它沒有包含在我從網站獲得的 Python 3.2.3 原始碼中……
這是標準錯誤的輸出:
~/tmp/Python-3.2.3 $ make > build.log ldd: warning: you do not have execution permission for `/usr/local/lib/libreadline.so' /usr/bin/ld: skipping incompatible /usr/local/lib/libreadline.so when searching for -lreadline /usr/bin/ld: skipping incompatible /usr/local/lib/libreadline.a when searching for -lreadline /home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.c: In function '_close_open_fd_range_safe': /home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.c:205: error: 'O_CLOEXEC' undeclared (first use in this function) /home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.c:205: error: (Each undeclared identifier is reported only once /home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.c:205: error: for each function it appears in.) /usr/bin/ld: skipping incompatible /usr/local/lib/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/local/lib/libz.so when searching for -lz ~/tmp/Python-3.2.3 $ grep posix build.log gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o ar rc libpython3.2m.a Modules/_threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/symtablemodule.o Modules/xxsubtype.o building '_posixsubprocess' extension gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -IInclude -I/home/oznahum/localroot/include -I. -I./Include -I/usr/local/include -I/home/oznahum/tmp/Python-3.2.3 -c /home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.c -o build/temp.linux-x86_64-3.2/home/oznahum/tmp/Python-3.2.3/Modules/_posixsubprocess.o _posixsubprocess
好的……我在這裡回答,而不是讓問題懸而未決。我重新下載了 Python-3.2.3 源並檢查了它們。他們確實不包括那個更新檔。
我重新應用了更新檔並在 CentOS-5.7 和 RedHat-5.7 上測試了該建構。我設法編譯沒有錯誤。
所以,我想關鍵是正確應用更新檔。我的失敗建構在 Modules/_posixsubprocess 中:
199 static void 200 _close_open_fd_range_safe(int start_fd, int end_fd, PyObject* py_fds_to_keep) 201 { 202 int fd_dir_fd; 203 if (start_fd >= end_fd) 204 return; 205 fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0); 206 #ifdef O_CLOEXEC 207 fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0); 208 #else 209 fd_dir_fd = open(FD_DIR, O_RDONLY, 0); 210 #ifdef FD_CLOEXEC
第 205 行,應該已經刪除…