Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling a py2app working build for both Leopard and Snow Leopard?

I currently am making my PyObjC application work for Snow Leopard and I successfully compiled a standalone app. My question would be, how do I make the build to be also Leopard-compatible, given these errors?

dyld: lazy symbol binding failed: Symbol not found: _fopen$UNIX2003
  Referenced from: /Applications/MyApp.app/Contents/MacOS/MyApp
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _fopen$UNIX2003
  Referenced from: /Applications/MyApp.app/Contents/MacOS/MyApp
  Expected in: /usr/lib/libSystem.B.dylib

This is a Snow Leopard-compiled py2app application. Also, when I compile on Leopard, on the other hand, this error occurs:

Traceback (most recent call last):
  File "/Users/jofell/client/dist/MyApp.app/Contents/Resources/__boot__.py", line 31, in <module>
    _run('main.py')
  File "/Users/jofell/client/dist/MyApp.app/Contents/Resources/__boot__.py", line 28, in _run
    execfile(path, globals(), globals())
  File "/Users/jofell/client/dist/MyApp.app/Contents/Resources/main.py", line 17, in <module>
    from AppKit import *
  File "AppKit/__init__.pyc", line 10, in <module>
  File "Foundation/__init__.pyc", line 10, in <module>
  File "CoreFoundation/__init__.pyc", line 17, in <module>
  File "objc/_bridgesupport.pyc", line 129, in initFrameworkWrapper
  File "objc/_bridgesupport.pyc", line 53, in _parseBridgeSupport
ValueError: Unknown typestr
2009-08-29 19:30:14.530 MyApp[445:903] MyApp Error
2009-08-29 19:30:14.534 MyApp[445:903] MyApp Error
An unexpected error has occurred during execution of the main script

Any help would be appreciated. Thanks in advance.

like image 290
jopes Avatar asked Aug 29 '09 11:08

jopes


1 Answers

I've done this recently and the trick was to build a standalone version on a Leopard installation.

By default, unless you have an open source version of Python installed, py2app creates a semi-standalone application that has symlinks to the OS files.

If instead, you create a standalone version of the application, then the interpreter and supporting files are embedded within your application and are therefore consistent on all machines running your application. Instructions on creating a fully standalone application are available here, but pay attention to the blog's comments as some things did change after the blog post was written.

If you have specific libs that you need you can reference them in the setup.py file or alternatively you can always add them manually to the dylib directory (which was easier for me as I needed to change the startup scripts and didn't want to regenerate), but make sure you use the 32-bit libs (which it will be on Leopard).

like image 83
sthartle Avatar answered Sep 30 '22 07:09

sthartle