py2app/64-bit/Mach-O Headers

View: New views
12 Messages — Rating Filter:   Alert me  

py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to bundle up a Python application that uses four-way
universal builds of Python and Tk (64-bit/32-bit for PPC and x86).
py2app chokes when trying to link the Tk frameworks in the app bundle:

linking
/Users/kevin/Programming/phynchronicity/dist/Phynchronicity.app/Contents/Frameworks/Tk.framework/Versions/Current
-> 8.5
WARNING: Mach-O header may be too large to relocate
WARNING: Mach-O header may be too large to relocate
WARNING: Mach-O header may be too large to relocate
WARNING: Mach-O header may be too large to relocate
Traceback (most recent call last):
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 589, in _run
     self.run_normal()
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 660, in run_normal
     self.create_binaries(py_files, pkgdirs, extensions, loader_files)
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 777, in create_binaries

<snip>

I ran across this error in the mailing list archives and saw that it may
pertain to the "-headerpad_max_install_names" LD flag. I added this flag
to LDFLAGS in my ~/.profile and rebuilt Tcl and Tk with the link flag,
but py2app still returns this error.

Not sure what to do here. I think py2app should be able to handle
building a Tkinter application as 64-bit without these errors; Tkinter
isn't some weird edge case. I've installed the latest dev versions of
py2app and macholib. I'm also running 10.5.8.

Thanks,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 6 Oct, 2009, at 16:30, Kevin Walzer wrote:

> I'm trying to bundle up a Python application that uses four-way  
> universal builds of Python and Tk (64-bit/32-bit for PPC and x86).  
> py2app chokes when trying to link the Tk frameworks in the app bundle:
>
> linking /Users/kevin/Programming/phynchronicity/dist/
> Phynchronicity.app/Contents/Frameworks/Tk.framework/Versions/Current  
> -> 8.5
> WARNING: Mach-O header may be too large to relocate
> WARNING: Mach-O header may be too large to relocate
> WARNING: Mach-O header may be too large to relocate
> WARNING: Mach-O header may be too large to relocate
> Traceback (most recent call last):
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 589, in _run
>    self.run_normal()
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 660, in run_normal
>    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 777, in create_binaries
>
> <snip>
>
> I ran across this error in the mailing list archives and saw that it  
> may pertain to the "-headerpad_max_install_names" LD flag. I added  
> this flag to LDFLAGS in my ~/.profile and rebuilt Tcl and Tk with  
> the link flag, but py2app still returns this error.
>
> Not sure what to do here. I think py2app should be able to handle  
> building a Tkinter application as 64-bit without these errors;  
> Tkinter isn't some weird edge case. I've installed the latest dev  
> versions of py2app and macholib. I'm also running 10.5.8.
My gut feeling is that macholib does not yet support 64-bit binaries.  
I know for sure that I have never used it with 64-bit binaries yet.

Ronald

>
> Thanks,
> Kevin
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@...
> http://mail.python.org/mailman/listinfo/pythonmac-sig


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

smime.p7s (4K) Download Attachment

Re: py2app/64-bit/Mach-O Headers

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 6 Oct, 2009, at 18:22, Ronald Oussoren wrote:

>>
>>
>> Not sure what to do here. I think py2app should be able to handle  
>> building a Tkinter application as 64-bit without these errors;  
>> Tkinter isn't some weird edge case. I've installed the latest dev  
>> versions of py2app and macholib. I'm also running 10.5.8.
>
> My gut feeling is that macholib does not yet support 64-bit  
> binaries. I know for sure that I have never used it with 64-bit  
> binaries yet.
My gut was wrong, macholib does support 64-bit code, I've verified  
this by running macho_standalone on a 3-way universal binary on OSX  
10.6.

What version of macholib do you use?

I've downloaded Tcl/Tk from <http://github.com/das/tcltk/tree/de-carbon-8-5 
 > and created a 3-way universal install using the xcode projects:

file /Library/Frameworks/Tcl.framework/Tcl
/Library/Frameworks/Tcl.framework/Tcl: Mach-O universal binary with 3  
architectures
/Library/Frameworks/Tcl.framework/Tcl (for architecture i386): Mach-O  
dynamically linked shared library i386
/Library/Frameworks/Tcl.framework/Tcl (for architecture x86_64): Mach-
O 64-bit dynamically linked shared library x86_64
/Library/Frameworks/Tcl.framework/Tcl (for architecture ppc7400): Mach-
O dynamically linked shared library ppc

Macho_standalone seems to be handle this fine (I created a standalone  
copy of Wish.app, after creating a copy of it outside of  
Tk.framework). This should mean that py2app works with it as well.

I'm using the current HEAD of the macholib repository.

Ronald

> Ronald
>
>>
>> Thanks,
>> Kevin
>>
>> --
>> Kevin Walzer
>> Code by Kevin
>> http://www.codebykevin.com
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG@...
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@...
> http://mail.python.org/mailman/listinfo/pythonmac-sig


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

smime.p7s (4K) Download Attachment

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/6/09 3:48 PM, Ronald Oussoren wrote:

>
> On 6 Oct, 2009, at 18:22, Ronald Oussoren wrote:
>
>>>
>>>
>>> Not sure what to do here. I think py2app should be able to handle
>>> building a Tkinter application as 64-bit without these errors;
>>> Tkinter isn't some weird edge case. I've installed the latest dev
>>> versions of py2app and macholib. I'm also running 10.5.8.
>>
>> My gut feeling is that macholib does not yet support 64-bit binaries.
>> I know for sure that I have never used it with 64-bit binaries yet.
>
> My gut was wrong, macholib does support 64-bit code, I've verified this
> by running macho_standalone on a 3-way universal binary on OSX 10.6.
>
> What version of macholib do you use?
>
> I've downloaded Tcl/Tk from
> <http://github.com/das/tcltk/tree/de-carbon-8-5> and created a 3-way
> universal install using the xcode projects:
>
> file /Library/Frameworks/Tcl.framework/Tcl
> /Library/Frameworks/Tcl.framework/Tcl: Mach-O universal binary with 3
> architectures
> /Library/Frameworks/Tcl.framework/Tcl (for architecture i386): Mach-O
> dynamically linked shared library i386
> /Library/Frameworks/Tcl.framework/Tcl (for architecture x86_64): Mach-O
> 64-bit dynamically linked shared library x86_64
> /Library/Frameworks/Tcl.framework/Tcl (for architecture ppc7400): Mach-O
> dynamically linked shared library ppc
>
> Macho_standalone seems to be handle this fine (I created a standalone
> copy of Wish.app, after creating a copy of it outside of Tk.framework).
> This should mean that py2app works with it as well.
>
> I'm using the current HEAD of the macholib repository.
>
> Ronald
>>

I downloaded and installed svn trunk (revision 31) of macholib from
svn.pythonmac.org--still have the same problem. Is there somewhere else
I should look?

--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried again, using the macholib from svn trunk and specifying
python-64 instead of python as the interpreter. Here's the error I get:

linking
/Users/kevin/Programming/phynchronicity/dist/Phynchronicity.app/Contents/Frameworks/Python64.framework/Versions/Current
-> 2.6
Traceback (most recent call last):
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 589, in _run
     self.run_normal()
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 660, in run_normal
     self.create_binaries(py_files, pkgdirs, extensions, loader_files)
   File
"/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",
line 768, in create_binaries
     mm.mm.run_file(runtime)
   File "build/bdist.macosx-10.5-universal/egg/macholib/MachOGraph.py",
line 66, in run_file
     m = self.createNode(MachO, pathname)
   File
"build/bdist.macosx-10.5-universal/egg/macholib/MachOStandalone.py",
line 23, in createNode
     res = super(FilteredMachOGraph, self).createNode(cls, name)
   File "build/bdist.macosx-10.5-universal/egg/altgraph/ObjectGraph.py",
line 148, in createNode
     m = cls(name, *args, **kw)
   File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py", line
63, in __init__
     self.load(file(filename, 'rb'))
   File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py", line
73, in load
     self.load_fat(fh)
   File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py", line
81, in load_fat
     self.fat = fat_header.from_fileobj(fh)
   File "build/bdist.macosx-10.5-universal/egg/macholib/ptypes.py", line
44, in from_fileobj
     return cls.from_str(f.read(cls._size_), **kw)
   File "build/bdist.macosx-10.5-universal/egg/macholib/ptypes.py", line
48, in from_str
     return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw)
error: unpack requires a string argument of length 8
 >
/Users/kevin/Programming/phynchronicity/build/bdist.macosx-10.5-universal/egg/macholib/ptypes.py(48)from_str()
-> return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw)


Any ideas?

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ronald,

Some additional testing:

1. I also tested macho_standalone against a standalone build of Wish
with 64-bit included. I get this output:

/usr/bin/strip: for architecture ppc64 object:
/Users/kevin/Desktop/Wish.app/Contents/Frameworks/Tk.framework/Versions/8.5/Tk
malformed object (load command 3 cmdsize not a multiple of 8)
/usr/bin/strip: for architecture ppc64 object:
/Users/kevin/Desktop/Wish.app/Contents/MacOS/Wish malformed object (load
command 10 cmdsize not a multiple of 8)
Macintosh:~ kevin$


The major difference between what you built and what I'm building is
that I am also supporting 64-bit PPC, while you are only supporting
three architectures (x86, ppc and x86-64). Not sure if the above is
relevant or not.

2. After a great deal of hackery and some install_name_tool, I actually
got a working build of my app with bundlebuilder (!). However, it
appears to work only with the 32-bit version of Python. (A four-way
build of Python produces two binaries, python-32 and python-64). I know
this is not a long-term solution, but at least it gets me working in the
near term.

If you're able to do a bit more testing with macholib, let me know what
you come up with. I've not been able to get a working build of my app
with py2app.

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 6 Oct, 2009, at 23:29, Kevin Walzer wrote:

> I tried again, using the macholib from svn trunk and specifying  
> python-64 instead of python as the interpreter. Here's the error I  
> get:
>
> linking /Users/kevin/Programming/phynchronicity/dist/
> Phynchronicity.app/Contents/Frameworks/Python64.framework/Versions/
> Current -> 2.6
> Traceback (most recent call last):
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 589, in _run
>    self.run_normal()
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 660, in run_normal
>    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
>  File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/py2app-0.4.2-py2.6.egg/py2app/build_app.py",  
> line 768, in create_binaries
>    mm.mm.run_file(runtime)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/
> MachOGraph.py", line 66, in run_file
>    m = self.createNode(MachO, pathname)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/
> MachOStandalone.py", line 23, in createNode
>    res = super(FilteredMachOGraph, self).createNode(cls, name)
>  File "build/bdist.macosx-10.5-universal/egg/altgraph/
> ObjectGraph.py", line 148, in createNode
>    m = cls(name, *args, **kw)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py",  
> line 63, in __init__
>    self.load(file(filename, 'rb'))
>  File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py",  
> line 73, in load
>    self.load_fat(fh)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/MachO.py",  
> line 81, in load_fat
>    self.fat = fat_header.from_fileobj(fh)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/ptypes.py",  
> line 44, in from_fileobj
>    return cls.from_str(f.read(cls._size_), **kw)
>  File "build/bdist.macosx-10.5-universal/egg/macholib/ptypes.py",  
> line 48, in from_str
>    return cls.from_tuple(struct.unpack(endian + cls._format_, s),  
> **kw)
> error: unpack requires a string argument of length 8
> > /Users/kevin/Programming/phynchronicity/build/bdist.macosx-10.5-
> universal/egg/macholib/ptypes.py(48)from_str()
> -> return cls.from_tuple(struct.unpack(endian + cls._format_, s),  
> **kw)
Time to install a 64-bit build myself, I've been running the 32-bit  
only the last couple of weeks due to the 2.6.3 release.

Ronald

>
>
> Any ideas?
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com



_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

smime.p7s (4K) Download Attachment

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/7/09 2:07 AM, Ronald Oussoren wrote:

>
> Time to install a 64-bit build myself, I've been running the 32-bit only
> the last couple of weeks due to the 2.6.3 release.
>
> Ronald

Ronald,

Thanks, please keep me posted on what you find. Will be glad to test any
patches for py2app that you come up with.

The bundlebuilder approach is actually OK as a short-term solution. I am
planning an app release in the next couple of weeks and don't want to
hold it up for the py2app issues. I'm amazed that bundlebuilder still
works!

Thanks,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 7 Oct, 2009, at 16:16, Kevin Walzer wrote:

> On 10/7/09 2:07 AM, Ronald Oussoren wrote:
>
>>
>> Time to install a 64-bit build myself, I've been running the 32-bit  
>> only
>> the last couple of weeks due to the 2.6.3 release.
>>
>> Ronald
>
> Ronald,
>
> Thanks, please keep me posted on what you find. Will be glad to test  
> any patches for py2app that you come up with.
>
> The bundlebuilder approach is actually OK as a short-term solution.  
> I am planning an app release in the next couple of weeks and don't  
> want to hold it up for the py2app issues. I'm amazed that  
> bundlebuilder still works!
I'll probably install a 64-bit build of 2.6 in the weekend, but on SL  
and hence one that doesn't include PPC64 support.

Could you post the 4-way universal build of Tcl/Tk somewhere, that way  
I can debug on SL.

Ronald



_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

smime.p7s (4K) Download Attachment

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
> Could you post the 4-way universal build of Tcl/Tk somewhere, that way I
> can debug on SL.
>
> Ronald
>

Done:

http://www.codebykevin.com/64-bit-tcl-tk-aqua.pkg.zip

Thanks,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Kevin Walzer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/7/09 6:12 PM, Kevin Walzer wrote:

>
>>
>> Could you post the 4-way universal build of Tcl/Tk somewhere, that way I
>> can debug on SL.
>>
>> Ronald
>>
>
> Done:
>
> http://www.codebykevin.com/64-bit-tcl-tk-aqua.pkg.zip
>
> Thanks,
> Kevin
>

Any update on getting py2app/macholib to work with a four-way universal
build of Python and Tk?

As I mentioned before, I'm using bundlebuilder as a workaround for now,
but it produces enormous app packages (180 megabytes) and only runs
Python in 32-bit mode. So that's obviously not a long-term solution...


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app/64-bit/Mach-O Headers

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 21 Oct, 2009, at 22:51, Kevin Walzer wrote:

> On 10/7/09 6:12 PM, Kevin Walzer wrote:
>>
>>>
>>> Could you post the 4-way universal build of Tcl/Tk somewhere, that  
>>> way I
>>> can debug on SL.
>>>
>>> Ronald
>>>
>>
>> Done:
>>
>> http://www.codebykevin.com/64-bit-tcl-tk-aqua.pkg.zip
>>
>> Thanks,
>> Kevin
>>
>
> Any update on getting py2app/macholib to work with a four-way  
> universal build of Python and Tk?
Not yet, I haven't had time to work on this due to a couple of  
projects at work.

Ronald

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

smime.p7s (4K) Download Attachment