简体   繁体   English

为Leopard和Snow Leopard编译py2app工作版本?

[英]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. 我目前正在使我的PyObjC应用程序适用于Snow Leopard并且我成功编译了一个独立的应用程序。 My question would be, how do I make the build to be also Leopard-compatible, given these errors? 我的问题是,如果出现这些错误,我如何使构建与Leopard兼容?

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. 这是一个Snow Leopard编译的py2app应用程序。 Also, when I compile on Leopard, on the other hand, this error occurs: 另外,当我在Leopard上编译时,另一方面,会发生以下错误:

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. 提前致谢。

I've done this recently and the trick was to build a standalone version on a Leopard installation. 我最近这样做了,诀窍是在Leopard安装上构建一个独立版本。

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. 默认情况下,除非您安装了Python的开源版本,否则py2app会创建一个半独立应用程序,该应用程序具有操作系统文件的符号链接。

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). 如果你有你需要的特定库你可以在setup.py文件中引用它们,或者你总是可以手动将它们添加到dylib目录(这对我来说更容易,因为我需要更改启动脚本而不想重新生成),但要确保使用32位库(它将在Leopard上)。

由于两者都在不同的架构(分别为32位和64位),我认为你必须创建2个不同的编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM