[p4python] P4Python build on Mac Os 10.5 Intel
Sven Erik Knop
sknop at perforce.com
Fri Apr 4 09:16:18 PDT 2008
I assume you are using the P4Python module from the Perforce public
depot. You should try to use the officially supported version of
P4Python from the Perforce website, which you can find here:
The problem with the line you cannot compile is that it is not 64 bit
clean. Py_ssize_t is an int on 32 bit architectures, but a long on 64
bit architectures. You can simply replace the definition of the
to solve the compilation problem - or, use the officially supported version.
We have tested the official P4Python 2007.3 on Mac OS and it compiles
and tests without any problems. You will need the P4API 2007.3 to
compile, but you can download this from the Perforce website as well.
Wilken Rivera wrote:
> I have been trying to build P4Python on a Intel Core Duo machine running
> Mas Os 10.5 with the default install of python 2.5.
> After downloading the p4api 2007-2 and the latest p4python 1-1 I
> proceeded to follow the build instructions. Which returned the following
> two errors on compilation:
> P4Clientmodule.cc:344: error: invalid conversion from ‘int*’ to
> P4Clientmodule.cc:344: error: initializing argument 2 of ‘int
> PyDict_Next(PyObject*, Py_ssize_t*, PyObject**, PyObject**)’
> lipo: can't figure out the architecture type of:
> error: command 'gcc' failed with exit status 1
> So looking into the output generated by "python setup.py build" I
> noticed that -arch was being passed two times, -arch ppc and -arch
> i386, to gcc so I decided to try and run the gcc command manually with
> only the -arch i386 flag.
> gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
> -fno-common -dynamic -DNDEBUG -g -O3 -Ip4api-2007-2
> -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c
> P4Clientmodule.cc -o build/temp.macosx-10.3-i386-2.5/P4Clientmodule.o
> -DOS_DARWIN -DP4_API_VER=2007.2
> This seemed to address the "can't figure out the architecture" and
> failed with "invalid conversion from ‘int*’ to ‘Py_ssize_t*’".
> So to address that error I opened the P4Clientmodule.cc source file and
> changed line 342 from "int pos = 0;" to "Py_ssize_t pos = 0;"
> I then tried another manual build via gcc with the command line listed
> above. This resulted in a successful build.
> After the manual build I ran "python setup.py install" and the
> installation completed as expected.
> I am now able to use the p4 module in python.
> I would like to know if my changes are legitimate and if my P4 module
> will work as expected.
> Thank you in advance for your help.
> Wilken Rivera
> p4python mailing list
> p4python at perforce.com
More information about the p4python