[p4python] P4Python build on Mac Os 10.5 Intel - SOLVED
daryl.spitzer at gmail.com
Fri Oct 3 10:41:25 PDT 2008
Steven (or anyone with experience or interest in building P4Python for
Mac OS X),
I now have an Intel Mac (running Mac OS X 10.5.5) and I'm at a new job
where I'd like to get P4Python working on Mac OS X.
I followed your instructions but I got the following (when I tried
`python setup.py build`):
$ python setup.py build
API Release 2007.3
copying P4.py -> build/lib.darwin-9.5.0-i386-2.4
building 'P4API' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
-mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-DID_OS="MACOSX104X86" -DID_REL="2007.3" -DID_PATCH="151416"
-DID_API="2007.3" -DID_Y="2008" -DID_M="04" -DID_D="09"
-I/build/toolchain/mac32/python-2.4.3/include/python2.4 -c P4API.cpp
-o build/temp.darwin-9.5.0-i386-2.4/P4API.o -DOS_MACOSX -DOS_MACOSX104
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for C/ObjC but not for C++
P4API.cpp: In function â€˜int P4Adapter_init(P4Adapter*, PyObject*,
P4API.cpp:105: error: â€˜Py_ssize_tâ€™ was not declared in this scope
P4API.cpp:105: error: expected `;' before â€˜posâ€™
P4API.cpp:107: error: â€˜posâ€™ was not declared in this scope
P4API.cpp: In function â€˜PyObject* P4Adapter_run(P4Adapter*, PyObject*)â€™:
P4API.cpp:177: error: â€˜Py_ssize_tâ€™ was not declared in this scope
P4API.cpp:177: error: expected `;' before â€˜iâ€™
P4API.cpp:177: error: â€˜iâ€™ was not declared in this scope
error: command 'gcc' failed with exit status 1
I got these same errors both before and after I added 'extra_link_args
= ["-framework", "Carbon"]' to setup.py as described in
`which gcc` returns /usr/bin/gcc and `gcc -v` returns:
Using built-in specs.
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--build=i686-apple-darwin9 --with-arch=apple --with-tune=generic
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)
`python -V` returns Python 2.4.3.
Do you know what's wrong?
On Thu, May 1, 2008 at 2:16 PM, <Steven.Klass at smsc.com> wrote:
> Hi all,
> I figured I'd pass along how I was able to compile the latest p4api
> (p4api-2007.3.143793) with the Perforce supported p4python (P4Python-2007.3)
> on Mac OSX 10.5 Intel hardware. This should work with PPC too but a minor
> tweak (arch) will need to be done.
> So basically here is the problem with compiling on mac OS X. By default
> python wants to compile universal binaries. I got an email from support that
> warned me this would be a problem.
> Since I'm not too familiar with the inners of compiling c (interaction with
> setup.py) from within python this hack fixes it so P4Python will compile and
> Normally if you left it alone and ran setup.py you would see the following
> errors upon trying to import P4..
> Traceback (most recent call last):
> File "p4test.py", line 6, in <module>
> import P4
> File "build/lib.macosx-10.5-i386-2.5/P4.py", line 185, in <module>
> import P4API
> ImportError: dlopen(build/lib.macosx-10.5-i386-2.5/P4API.so, 2): Symbol
> not found: ___CFConstantStringClassReference
> Referenced from:
> Expected in: dynamic lookup
> Corrections made - see the script..
> As you can see arch has been reduced to only look at intel and we removed
> -Wstrict-prototypes as this isn't used for C++
> When you get down to the linking stage things changed. In addition to
> removing the universal capability we also
> had to put in the Carbon frameworks.
> This script will replace 'python setup.py build'. I would suggest the
> following process to get P4Python working:
> Get the API Tree and P4Perforce untar / gunzip and put the api tree into
> P4Python-2007.3 directory
> http://filehost.perforce.com/perforce/r07.3/bin.macosx104x86/p4api.tar -o
> curl http://filehost.perforce.com/perforce/r07.3/tools/p4python.tgz -o
> Update the setup.cfg to point the p4_api=./p4api-2007.3.143793
> Run a baseline 'python setup.py build' - This will create all of the
> necessary trees.
> Place this script in the P4Python directory. Then run this script
> Run the install piece 'python setup.py install'
> Note The testharness breaks but that's primarily due to a poor testharness
> Steven M. Klass
> Manager, Design Automation
> Analog/Mixed Signal Tools and Methodologies
> Phone: (480) 225-1112
> Email: steven.klass at smsc.com
> "Daryl Spitzer" <daryl.spitzer at gmail.com>
> Sent by: p4python-bounces at perforce.com
> 05/01/08 09:11 AM
> p4python at perforce.com, sknop at perforce.com
> [p4python] P4Python build on Mac Os 10.5
> Intel&In-Reply-To=47F64500.80003 at nikondev.com
> Sven Erik,
> You wrote (in
>> 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.
> Did you see my description of my problem in
> http://maillist.perforce.com/pipermail/p4python/2008-April/000052.html? As
> I wrote in the thread, I contacted Perforce tech support and was told that
> Mac OS X is not supported. But I thought that since you wrote the above,
> you may be able to diagnose my problem.
> Daryl Spitzer
> p4python mailing list
> p4python at perforce.com
More information about the p4python