List Info

Thread: py2app corrupting libraries




py2app corrupting libraries
user name
2006-05-11 00:14:45

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̷0;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/distutils/core.py";, line 149, in setup

    dist.run_commands()

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

    self.run_command(cmd)

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

    cmd_obj.run()

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

    self._run()

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

    self.run_normal()

  File ";/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/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-packages/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-packages/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-packages/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''-output''/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/distutils/core.py";, line 149, in setup

    dist.run_commands()

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

    self.run_command(cmd)

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

    cmd_obj.run()

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

    self._run()

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

    self.run_normal()

  File ";/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/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-packages/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-packages/py2app/macholib/MachOStandalone.py", line 101, in run

    mm.run_file(fn)

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

    m = MachO(pathname)

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

    self.load()

  File ";/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/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-packages/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

 

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

py2app corrupting libraries
user name
2006-05-11 00:33:58
On May 10, 2006, at 5:14 PM, Kent Quirk wrote:

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

This probably isn't going to get fixed unless a patch or a
set of  
binaries to reproduce this issue is available. I'm pretty
much out of  
commission for the rest of the month though, so even with
binaries  
I'm not going to get anywhere with it any time soon.

-bob

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
py2app corrupting libraries
user name
2006-05-12 20:08:21
Bob Ippolito:
> On May 10, 2006, at 5:14 PM, Kent Quirk wrote:

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

You are probably aware of this, and even if not I'm not
sure whether it 
helps, but here it goes anyway: did you add an
"archs='ppc,i386'" to the 
py2app options? Before I did that too much stuff got thinned
away for me 
too.

Example options from setup.py:

if sys.argv[1] == 'py2app':
     import py2app
     setupOptions.update(dict(app=['taskcoach.py'],
         options=dict(py2app=dict(archs='ppc,i386',
argv_emulation=True,
             compressed=True, dist_dir=builddir, optimize=2,
             iconfile='icons.in/taskcoach.icns',
             packages=['i18n']))))

Hope that is of use, Frank
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )