Perforce linux中的Python构建错误

Perforce linux中的Python构建错误,perforce,p4python,Perforce,P4python,我已经在linux上安装了reviewboard,现在正在尝试安装P4Python以使用Perforce 使用Python 2.7.6、P4Python-2014.2.962887和p4api-2014.2.978861 如何解决此错误: $python setup.py build --apidir /root/Downloads/p4api-2014.2.978861/ API Release 2014.2 running build running build_py creating bu

我已经在linux上安装了reviewboard,现在正在尝试安装P4Python以使用Perforce

使用Python 2.7.6、P4Python-2014.2.962887和p4api-2014.2.978861

如何解决此错误:

$python setup.py build --apidir /root/Downloads/p4api-2014.2.978861/
API Release 2014.2
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying P4.py -> build/lib.linux-x86_64-2.7
running build_ext
building 'P4API' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c P4API.cpp -o build/temp.linux-x86_64-2.7/P4API.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonClientAPI.cpp -o build/temp.linux-x86_64-2.7/PythonClientAPI.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonClientUser.cpp -o build/temp.linux-x86_64-2.7/PythonClientUser.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c SpecMgr.cpp -o build/temp.linux-x86_64-2.7/SpecMgr.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c P4Result.cpp -o build/temp.linux-x86_64-2.7/P4Result.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonMergeData.cpp -o build/temp.linux-x86_64-2.7/PythonMergeData.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c P4MapMaker.cpp -o build/temp.linux-x86_64-2.7/P4MapMaker.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonSpecData.cpp -o build/temp.linux-x86_64-2.7/PythonSpecData.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonMessage.cpp -o build/temp.linux-x86_64-2.7/PythonMessage.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonActionMergeData.cpp -o build/temp.linux-x86_64-2.7/PythonActionMergeData.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c PythonClientProgress.cpp -o build/temp.linux-x86_64-2.7/PythonClientProgress.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DID_OS="LINUX31X86_64" -DID_REL="2014.2" -DID_PATCH="962887" -DID_API="2014.2/978861" -DID_Y="2014" -DID_M="11" -DID_D="17" -I/root/Downloads/p4api-2014.2.978861/ -I/root/Downloads/p4api-2014.2.978861/include/p4 -I/usr/include/python2.7 -c P4PythonDebug.cpp -o build/temp.linux-x86_64-2.7/P4PythonDebug.o -DOS_LINUX -DOS_LINUX31 -DOS_LINUXX86_64 -DOS_LINUX31X86_64
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/P4API.o build/temp.linux-x86_64-2.7/PythonClientAPI.o build/temp.linux-x86_64-2.7/PythonClientUser.o build/temp.linux-x86_64-2.7/SpecMgr.o build/temp.linux-x86_64-2.7/P4Result.o build/temp.linux-x86_64-2.7/PythonMergeData.o build/temp.linux-x86_64-2.7/P4MapMaker.o build/temp.linux-x86_64-2.7/PythonSpecData.o build/temp.linux-x86_64-2.7/PythonMessage.o build/temp.linux-x86_64-2.7/PythonActionMergeData.o build/temp.linux-x86_64-2.7/PythonClientProgress.o build/temp.linux-x86_64-2.7/P4PythonDebug.o -L/root/Downloads/p4api-2014.2.978861/ -L/root/Downloads/p4api-2014.2.978861/lib -lclient -lrpc -lsupp -lp4sslstub -lrt -o build/lib.linux-x86_64-2.7/P4API.so
/usr/bin/ld: skipping incompatible /root/Downloads/p4api-2014.2.978861/lib/libclient.a when searching for -lclient
/usr/bin/ld: cannot find -lclient
/usr/bin/ld: skipping incompatible /root/Downloads/p4api-2014.2.978861/lib/librpc.a when searching for -lrpc
/usr/bin/ld: cannot find -lrpc
/usr/bin/ld: skipping incompatible /root/Downloads/p4api-2014.2.978861/lib/libsupp.a when searching for -lsupp
/usr/bin/ld: cannot find -lsupp
/usr/bin/ld: skipping incompatible /root/Downloads/p4api-2014.2.978861/lib/libp4sslstub.a when searching for -lp4sslstub
/usr/bin/ld: cannot find -lp4sslstub
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1

它可能是一个损坏的Python库下载吗?你的错误看起来就像他说的在通过二进制模式ftp而不是自动模式传输tarball后让它编译的意思。我通过firefox下载了该文件,并检查了文件大小,看起来还可以。另一种可能是编译过程中混合使用了32位和64位库。您能告诉我您是在构建32位版本的P4Python还是64位版本的P4Python吗?确保下载的库与您使用的生成环境相匹配。P4Python与平台无关。该api是针对linux26x86_64的。我通过替换2014.1 api的*.a文件,而不是原来的2014.2 api的*.a文件,实现了它的工作。谢谢你的帮助。