我刚刚在 Snow Leopard 上编译了 64 位 Qt4.6 的最新预览版,没有出现任何重大问题。

http://qt.nokia.com/developer/qt-4.6-technology-preview#download-the-qt-4-1

现在,我尝试使用 River Bank 网站的最新快照对 PyQt4.6 执行相同的操作。但是,编译器会退出并出现以下问题:

g++ -c -pipe -fPIC -arch x86_64 -O2 -Wall -W -DNDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I/Users/drufat/Downloads/PyQt-mac-gpl-4.6-snapshot-20090914/qpy/QtCore -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/usr/local/Trolltech/Qt-4.6.0/mkspecs/default -I/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers -I/usr/local/Trolltech/Qt-4.6.0/include -F/Users/drufat/Downloads/PyQt-mac-gpl-4.6-snapshot-20090914/qpy/QtCore -F/usr/local/Trolltech/Qt-4.6.0/lib -o sipQtCoreQResource.o sipQtCoreQResource.cpp
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h: In copy constructor ‘QResource::QResource(const QResource&)’:
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:180: error: ‘QScopedPointer<T, Cleanup>::QScopedPointer(const QScopedPointer<T, Cleanup>&) [with T = QResourcePrivate, Cleanup = QScopedPointerDeleter<QResourcePrivate>]’ is private
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qresource.h:59: error: within this context
sipQtCoreQResource.cpp: In constructor ‘sipQResource::sipQResource(const QResource&)’:
sipQtCoreQResource.cpp:78: note: synthesized method ‘QResource::QResource(const QResource&)’ first required here 
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h: In static member function ‘static void QScopedPointerDeleter<T>::cleanup(T*) [with T = QResourcePrivate]’:
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:100:   instantiated from ‘QScopedPointer<T, Cleanup>::~QScopedPointer() [with T = QResourcePrivate, Cleanup = QScopedPointerDeleter<QResourcePrivate>]’
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qresource.h:59:   instantiated from here
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:59: error: invalid application of ‘sizeof’ to incomplete type ‘QResourcePrivate’ 
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:59: error: creating array with negative size (‘-0x00000000000000001’)
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:60: error: invalid application of ‘sizeof’ to incomplete type ‘QResourcePrivate’ 
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:60: error: creating array with negative size (‘-0x00000000000000001’)
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:62: warning: possible problem detected in invocation of delete operator:
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:54: warning: ‘pointer’ has incomplete type
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qresource.h:56: warning: forward declaration of ‘struct QResourcePrivate’
/usr/local/Trolltech/Qt-4.6.0/lib/QtCore.framework/Headers/qscopedpointer.h:62: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined.

这是 PyQt4 尝试访问 Qt4 类的私有成员时的错误吗?有人在 Snow Leopard 上成功编译 PyQt4 了吗?

有帮助吗?

解决方案

我让PyQt 4.6.2使用64位Python 2.6.1。我在这里发布了说明: http:/ /mpastell.com/2009/11/24/pyqt-4-6-2-with-snow-leopard/

其他提示

在变更日志中我看到 Phil(PyQt 的维护者) 已发布修复程序 昨天专门针对 Snow Leopard 的开发快照:

2009/09/14 12:12:49 Phil进一步修复了64位系统上的雪豹。添加了qobject.pyqtconfigure()。

您使用的是昨天构建的 PyQt 吗?

邮件列表中的此主题 也特别有趣。

PyQt 编译问题似乎是由 Snow Leopards 默认 64 位编译及其附带的 Python 64/32 位混合版本引起的。

如果事情继续出错,我会将您的问题提交到此邮件列表(以便它们能够得到修复 - 希望)并尝试(暂时)以 32 位方式重建 Qt 和 PyQt(可能还有 python)(使用 -m32编译器标志)如果您现在需要它工作。

您可能希望使用自制项目中的PyQt:直接构建,托管依赖项。

在我的MBP Unibody上运行正常,全部是64位。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top