[Pythonmac-SIG] pyobjc 2.0 with the python.org distribution?

David Hain dhain at zognot.org
Wed Dec 17 18:53:14 CET 2008


On Dec 17, 2008, at 3:03 AM, Reza Lotun wrote:

> Hi,
>
> As an addendum to that, what is the current status of trying to  
> build Pyobjc 2.0 for Python 2.6? I tried a few weeks ago but it  
> didn't seem to work - is it at all possible?

Yes, it is possible. I haven't tried building it against the  
python.org binary dist of 2.6, but I have a script that will build 2.6  
from source and then build pyobjc from trunk. See below for the  
important bits.

>
>
> Thanks,
> Reza
>
> On Wed, Dec 17, 2008 at 9:52 AM, David Warde-Farley <dwf at cs.toronto.edu 
> > wrote:
> Hi folks,
>
> I noticed today that while PyObjC, etc. is included in the system  
> Python in 10.5, the py2.5-fat binaries on undefined.org are 1.4.x  
> series. As I understood it, the python.org UB is the only solution  
> if you want to build redistributable applications.

Not necessarily. py2app should have no trouble using a custom built  
python.

> I also have been using it as a jumping off point so that I have a  
> completely common dev environment on 10.5 and 10.4 for other stuff I  
> do.

The solution below will only work on 10.5, but it should be possible  
to build against the 10.4 universal sdk with the appropriate  
modifications.

>
>
> Well, I'm trying to build PyObjC 2.0 from trunk with the python.org  
> package and running into all sorts of errors.
>
> For example, pyobjc-core fails to build with this:
>
> Modules/objc/bundle-variables.m: In function  
> 'PyObjC_loadBundleFunctions':
> Modules/objc/bundle-variables.m:221: error: '_localHandler'  
> undeclared (first use in this function)
> Modules/objc/bundle-variables.m:221: error: (Each undeclared  
> identifier is reported only once
> Modules/objc/bundle-variables.m:221: error: for each function it  
> appears in.)
> Modules/objc/bundle-variables.m: In function  
> 'PyObjC_loadBundleFunctions':
> Modules/objc/bundle-variables.m:221: error: '_localHandler'  
> undeclared (first use in this function)
> Modules/objc/bundle-variables.m:221: error: (Each undeclared  
> identifier is reported only once
> Modules/objc/bundle-variables.m:221: error: for each function it  
> appears in.)
> lipo: can't figure out the architecture type of: /var/folders/Hv/ 
> HvVKXkVwF3Kt9ULgIvCLP++++TI/-Tmp-//ccrLeLvv.out
> error: command 'gcc' failed with exit status 1
>
> I found one post on the mailing list from July that went unanswered  
> detailing pretty much the same situation. Any hints?
>

I ran into this problem also when first trying to build pyobjc from  
trunk. I don't know if it's possible to build against the python.org  
binaries, but if you build python from source with the options below  
it should work:

export installprefix=/opt/python    # set this to wherever you want to  
put it
export DYLD_LIBRARY_PATH=$installprefix/lib:$DYLD_LIBRARY_PATH
export DYLD_FRAMEWORK_PATH=$installprefix/Library/Frameworks: 
$DYLD_LIBRARY_PATH:$DYLD_FRAMEWORK_PATH
export MACOSX_DEPLOYMENT_TARGET=10.5
export sdk=/Developer/SDKs/MacOSX10.5.sdk
export CPPFLAGS="-I$installprefix/include -L$installprefix/lib"
export CFLAGS="-O -g -isysroot $sdk -arch i386 -arch ppc -mmacosx- 
version-min=10.5"
export LDFLAGS="-Wl,-syslibroot,$sdk -flat_namespace"

./configure \
     --enable-universalsdk=$sdk \
     --enable-framework=$installprefix/Library/Frameworks
make
make install


Then, to build pyobjc, you should be able to use 02-develop-all.sh  
from trunk, provided you modify it to use the python you just built  
above (change the paths on lines 18, 19, 24, 35, and 36).

Good luck,
-David



More information about the Pythonmac-SIG mailing list