[p4python] P4Python build on Mac Os 10.5 Intel - SOLVED

Steven.Klass at smsc.com Steven.Klass at smsc.com
Thu May 1 14:16:56 PDT 2008


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 work.

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: 
/private/tmp/p4/P4Python-2007.3/build/lib.macosx-10.5-i386-2.5/P4API.so
      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
   curl 
http://filehost.perforce.com/perforce/r07.3/bin.macosx104x86/p4api.tar -o 
p4api.tar
   curl http://filehost.perforce.com/perforce/r07.3/tools/p4python.tgz -o 
p4python.tgz
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 
'./make.sh'
Run the install piece 'python setup.py install'

Note The testharness breaks but that's primarily due to a poor testharness 
;)

Cheers


---

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

To
p4python at perforce.com, sknop at perforce.com
cc

Subject
[p4python] P4Python build on Mac Os 10.5 
Intel&In-Reply-To=47F64500.80003 at nikondev.com






Sven Erik,

You wrote (in 
http://maillist.perforce.com/pipermail/p4python/2008-April/000051.html):

> 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
http://maillist.perforce.com/mailman/listinfo/p4python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/p4python/attachments/20080501/91f0e98b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make.sh
Type: application/octet-stream
Size: 3371 bytes
Desc: not available
URL: <http://maillist.perforce.com/pipermail/p4python/attachments/20080501/91f0e98b/attachment-0001.obj>


More information about the p4python mailing list