[Pythonmac-SIG] py2app corrupting libraries

Kent Quirk kquirk at solidworks.com
Thu May 11 02:14:45 CEST 2006


Hi, all.

 

We have a large mixed Python and C++ application with about a dozen
frameworks which cross-reference one another.

 

We've been shipping it for almost a year on PPC Macs using py2app to
package things - so we know we have the py2app stuff approximately
correct. We've been trying off and on to get a fat version of the app
working. All the C++ code compiles and links cleanly on both
architectures. We've installed fat Python 2.4.3 (the April 7 version).

 

When we run the current (0.2-maint) branch of py2app on our Intel Mac,
somewhere along the way, it tells us that it's "Thinning" our "Events"
library to the i386 part only...then, later on, it tries to thin the
same library to both the ppc and i386 versions...but doesn't find the
ppc version anymore and crashes.

 

Possibly of interest, but possibly a red herring: py2app spends a fair
amount of time building the dependency graph and doing many operations
over and over (the graph of our library dependencies is basically a web,
not a hierarchy, and it seems to be doing a pretty exhaustive walk of
the graph). 

 

We tried going into the macholib/util.py and stubbing out the
thin_to_archs() function. As we only build the two architectures we care
about, and we want both, we figured this should be safe.  But then
py2app crashes with an unrecognized magic number in some of the
libraries. So we changed thin_to_archs() so that it always used both
architectures, no matter what it was asked to build...and got the same
(magic) problem. We even tried reversing the order of the two in case
there was an order dependency somewhere.

 

I know the macholib stuff is fairly tricky and at this point we're kinda
stumped. 

 

Below are the stack traces from the two types of crashes.

 

Any advice or suggestions would be appreciated.

 

            Kent

 

 

First one, unmodified py2app:

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-

Thinning /Users/cb/blobs/trunk/Python/dist/Cosmic
Blobs.app/Contents/Frameworks/Events.framework/Versions/A/Events to ppc,
i386

/usr/bin/lipo: -extract ppc specified but fat file:
/Users/cb/blobs/trunk/Python/dist/Cosmic
Blobs.app/Contents/Frameworks/Events.framework/Versions/A/Events does
not contain that architecture Traceback (most recent call last):

  File "setup.py", line 145, in ?

    argv_emulation=True,

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/core.py", line 149, in setup

    dist.run_commands()

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/dist.py", line 946, in run_commands

    self.run_command(cmd)

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/dist.py", line 966, in run_command

    cmd_obj.run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 373, in run

    self._run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 494, in _run

    self.run_normal()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 554, in run_normal

    self.create_binaries(py_files, pkgdirs, extensions, loader_files)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 652, in create_binaries

    platfiles = mm.run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachOStandalone.py", line 147, in run

    thin_to_archs(filename, nodearchs)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/util.py", line 146, in thin_to_archs

    raise ValueError, 'Error %d returned by: %s' % (retval,
''.join(["'%s'" % arg for arg in command]))

ValueError: Error 1 returned by:
'/usr/bin/lipo''/Users/cb/blobs/trunk/Python/dist/Cosmic
Blobs.app/Contents/Frameworks/Events.framework/Versions/A/Events''-outpu
t''/tmp/tmpxlJYOq''-extract''ppc''-extract''i386'

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-

 

Second one, thin_to_archs() body commented out, is the same as the third
try, with body of thin_to_archs() restored but archs param forced to
("ppc", "i386"), and also the same as the fourth try with the args
reversed:

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-

Graphing /Users/cb/blobs/trunk/Python/dist/Cosmic
Blobs.app/Contents/Frameworks/Events.framework/Versions/A/Events (ppc)
Traceback (most recent call last):

  File "setup.py", line 145, in ?

    argv_emulation=True,

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/core.py", line 149, in setup

    dist.run_commands()

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/dist.py", line 946, in run_commands

    self.run_command(cmd)

  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distut
ils/dist.py", line 966, in run_command

    cmd_obj.run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 373, in run

    self._run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 494, in _run

    self.run_normal()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 554, in run_normal

    self.create_binaries(py_files, pkgdirs, extensions, loader_files)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/py2app/build_app.py", line 652, in create_binaries

    platfiles = mm.run()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachOStandalone.py", line 101, in run

    mm.run_file(fn)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachOGraph.py", line 62, in run_file

    m = MachO(pathname)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachO.py", line 254, in __init__

    self.load()

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachO.py", line 287, in load

    self.archs = self.load_fat(fat, fh)

  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pa
ckages/py2app/macholib/MachO.py", line 273, in load_fat

    raise ValueError, "got unrecognized magic of %08x" % (header.magic,
MH_MAGIC, MH_CIGAM)

TypeError: not all arguments converted during string formatting

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20060510/4953aacc/attachment-0001.html 


More information about the Pythonmac-SIG mailing list