[p4python] P4Python build on Mac Os 10.5 Intel

Wilken Rivera wrivera at nikondev.com
Fri Apr 4 08:10:56 PDT 2008


Hello,

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 
‘Py_ssize_t*’
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: 
/var/folders/ej/ejOGnR1WGCG65nykTZiwDU+++TI/-Tmp-//ccMkcDFQ.out
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 
-Ip4api-2007-2/include/p4 
-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








More information about the p4python mailing list