Python 2.6.1 urllib error on Mac os x PPC

ati atiware at gmx.net
Tue Mar 3 15:21:39 EST 2009


On Mon, 2009-03-02 at 13:59 -0800, Ned Deily wrote:
Am 2.3.2009 22:59 Uhr schrieb "Ned Deily" unter <nad at acm.org>:

> 
> First, make sure this is the real problem by trying this snippet:
> 
> /usr/local/test/python/bin/python2.6
>>>> from ctypes import cdll
>>>> from ctypes.util import find_library
>>>> sc = cdll.LoadLibrary(find_library("SystemConfiguration"))
>>>> x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)
> 
> Presumably, if your original test failed, this snippet should fail,
too.

Yes, it fails on PPC and runs without errors on Intel:

/usr/local/test/python/bin/python2.6 /tmp/tt.py
Traceback (most recent call last):
  File "/tmp/tt.py", line 4, in <module>
    x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)
  File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line
366,
in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line
371,
in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, CFStringCreateWithCString): symbol
not
found


Content of /tmp/tt.py:

from ctypes import cdll
from ctypes.util import find_library
sc = cdll.LoadLibrary(find_library("SystemConfiguration"))
x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)


I recompiled Python-2.6.1 with MACOSX_DEPLOYMENT_TARGET=10.3, but no
change..
I updated developertools to xcode312_2621, no change..

Btw.. Python-2.5.4 compiled from scratch works fine.

I forgot to mention the ppc computer is a Mac OS X Server version and
the Intel computer is a normal Mac OS X.


Some detailed info about the macs:

ppc:
Model Name: Xserve G5
Model Identifier: RackMac3,1
Processor Name: PowerPC G5  (3.1)
Processor Speed: 2.3 GHz
Number Of CPUs: 2
L2 Cache (per CPU): 512 KB
Boot ROM Version: 5.1.7f2
System Version: Mac OS X Server 10.5.6 (9G55)
Kernel Version: Darwin 9.6.0


intel:
Model Name: MacBook Pro
Model Identifier: MacBookPro3,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Bus Speed: 800 MHz
Boot ROM Version: MBP31.0070.B07
SSC Version: 1.16f8
System Version: Mac OS X 10.5.6 (9G55)
Kernel Version: Darwin 9.6.0



> 
> If you can, download the python.org 2.6.1 OSX installer and make sure
> your original test works with it.  If so, perhaps you don't need to
> build your own?  That install works on both Intel and PPC.  One
> difference: it is built with MACOX_DEPLOYMENT_TARGET=10.3, meaning it
> will work on systems >= 10.3 but if you really need 10.5 only there
> might be some side-effects that are important to you.

I have to compile my own python, because i can't install the dmg under
/usr/local/bin,lib, etc..

I have to install python under /usr/local/some_other_dir/python. (this
is a custom install for an application and i can't change ist
requirements...)

I don't need universal binaries, i need only ppc, the intel version was
just a test. (but precompiled universql binary is o.k., if it installs
under a custom directory)


> Otherwise, you might want to try rebuilding on the PPC from scratch
> (i.e. an empty build directory) using the 2.6.1 tarball.  By "same
> build" on Intel CPU, you do mean you've rebuilt on PPC?  You could
build
> a "fat" Universal python on either architecture that will work on both
> but you'll need to add a few more options to configure to do that.

It was build from scratch. I rebuild it on intel with the same
configuration to test it, but on intel runs whitout errors.

I dig a bit deeper with otool and discover some differences:

Intel MacOS.so: Carbon, libSystem.B.dylib, CoreServices,
ApplicationServices

PPC MacOS.so: Carbon, libmx.A.dylib, libSystem.B.dylib

Intel _ctypes.so: libSystem.B.dylib
PPC _ctypes.so: libmx.A.dylib, libSystem.B.dylib

-----------
Intel with deploymant target 10.3, xcode312:
-----------
sh-3.2# otool
-L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so
/usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so:
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.0.0, current version 136.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)
    
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
(compatibility version 1.0.0, current version 32.0.0)
    
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Applicat
ionServices (compatibility version 1.0.0, current version 34.0.0)

-------

sh-3.2# otool
-L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so
/usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)

----------
PPC with deployment_target 10.3, xcode312_2621
----------

otool -L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so
/usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so:
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.0.0, current version 136.0.0)
    /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version
47.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)

-------


otool -L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so
/usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so:
    /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version
47.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)


There is something messy with the libs.






More information about the Python-list mailing list