[PyQt] build error with pyqt 4.4
Phil Thompson
phil at riverbankcomputing.com
Tue May 13 23:01:44 BST 2008
On Tuesday 13 May 2008 18:55:15 Erick Tryzelaar wrote:
> It looks like a change in between this release and
> 4.4-snapshot-20080508_0 broke my build. Here's the error:
>
> g++ -c -pipe -Os -Wall -W -fPIC
> -DPYTHON_LIB=\"Python.framework/Versions/2.4/Python\" -DQT_NO_DEBUG
> -DQT_PLUGIN -DQT_SCRIPT_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB
> -DQDESIGNER_EXPORT_WIDGETS -DQT_SHARED
> -I/opt/local/share/qt4-mac/mkspecs/macx-g++ -I.
> -I/opt/local/Library/Frameworks/QtDesigner.framework/Versions/4/Headers
> -I/opt/local/include/qt4-mac/QtDesigner
> -I/opt/local/Library/Frameworks/QtCore.framework/Versions/4/Headers
> -I/opt/local/include/qt4-mac/QtCore
> -I/opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers
> -I/opt/local/include/qt4-mac/QtGui
> -I/opt/local/Library/Frameworks/QtXml.framework/Versions/4/Headers
> -I/opt/local/include/qt4-mac/QtXml
> -I/opt/local/Library/Frameworks/QtScript.framework/Versions/4/Headers
> -I/opt/local/include/qt4-mac/QtScript -I/opt/local/include/qt4-mac
> -I/opt/local/Library/Frameworks/Python.framework/Versions/2.4/include/pytho
>n2.4 -I. -I. -F/opt/local/Library/Frameworks -o pluginloader.o
> pluginloader.cpp
> pluginloader.cpp: In static member function 'static PyObject*
> PyCustomWidgets::getModuleAttr(const char*, const char*)':
> pluginloader.cpp:284: error: invalid conversion from 'const char*' to
> 'char*' pluginloader.cpp:284: error: initializing argument 1 of
> 'PyObject* PyImport_ImportModule(char*)'
> pluginloader.cpp:296: error: invalid conversion from 'const char*' to
> 'char*' pluginloader.cpp:296: error: initializing argument 2 of
> 'PyObject* PyObject_GetAttrString(PyObject*, char*)'
> make[1]: *** [pluginloader.o] Error 1
> make: *** [all] Error 2
>
>
> Looking at a diff, it looks like this was a recent addition:
>
> -PyObject *PyCustomWidgets::getModuleAttr(char *module, char *attr)
> +PyObject *PyCustomWidgets::getModuleAttr(const char *module, const char
> *attr) {
> +#if PY_VERSION_HEX >= 0x020500
> PyObject *mod = PyImport_ImportModule(module);
> +#else
> + PyObject *mod = PyImport_ImportModule(const_cast<char *>(module));
> +#endif
>
> if (!mod)
> {
> PyErr_Print();
> return 0;
> }
>
> +#if PY_VERSION_HEX >= 0x020500
> PyObject *obj = PyObject_GetAttrString(mod, attr);
> +#else
> + PyObject *obj = PyObject_GetAttrString(mod, const_cast<char *>(attr));
> +#endif
> +
> Py_DECREF(mod);
>
> if (!obj)
> {
> PyErr_Print();
>
>
> I'm building this on leopard that has python 2.5 installed, but I'm
> building it against python 2.4, so I think something's getting
> confused somewhere.
Oh dear. The fix is to change the "0x020500" to "0x02050000" in the two lines
above.
Looks like there will be a v4.4.1 fairly soon...
Phil
More information about the PyQt
mailing list