Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2985 closed patch (fixed)

qgis broken with new py-sip

Reported by: jasperla Owned by: nobody
Priority: minor: annoyance Milestone: Version 1.6.0
Component: Build/Install Version: 1.5.0
Keywords: sip build failure Cc: rdieter, aatiis
Must Fix for Release: Yes Platform: Gentoo
Platform Version: Awaiting user input: no

Description

After updating py-sip to the latest 4.11 release, qgis 1.5.0 doesn't build anymore. It bails out with the following error:

cd /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python && /usr/local/bin/sip -x VendorID -t WS_X11 -x PyQt_NoPrintRangeBug -t Qt_4_6_3 -x Py_v3 -g -j 4 -c /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core -I /usr/local/share/sip -I /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core/core.sip
sip: /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core/conversions.sip:269: Mapped type has already been defined in another module
*** Error code 1

I can attach the full build log if needed.

Change History (10)

comment:1 by sthen, 14 years ago

The following diff fixes things with sip>=4.11; I showed it to Phil Banks who thinks it's ok as a workaround and suggests it is made conditional depending on the version of SIP that is found.

--- python/core/conversions.sip.orig	Tue Sep  7 00:14:55 2010
+++ python/core/conversions.sip	Tue Sep  7 00:17:23 2010
@@ -265,59 +265,6 @@ template <TYPE>
 
 
 
-%MappedType QSet<int>
-{
-%TypeHeaderCode
-#include <QSet>
-#if (SIP_VERSION >= 0x040900)
-#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString))
-#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
-#endif
-%End
-
-%ConvertFromTypeCode
-  // Create the list.
-  PyObject *l;
-
-  if ((l = PyList_New(sipCpp->size())) == NULL)
-    return NULL;
-      
-  // Set the list elements.
-  QSet<int>::iterator it = sipCpp->begin();
-  for (int i = 0; it != sipCpp->end(); ++it, ++i)
-  {
-    PyObject *tobj;
-
-    if ((tobj = PyInt_FromLong(*it)) == NULL)
-    {
-      Py_DECREF(l);
-      return NULL;
-    }
-    PyList_SET_ITEM(l, i, tobj);
-  }
-
-  return l;
-%End
-
-%ConvertToTypeCode
-  // Check the type if that is all that is required.
-  if (sipIsErr == NULL)
-    return PyList_Check(sipPy);
-
-  QSet<int> *qset = new QSet<int>;
-
-  for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
-  {
-    qset->insert(PyInt_AsLong(PyList_GET_ITEM(sipPy, i)));
-  }
-
-  *sipCppPtr = qset;
-  return sipGetState(sipTransferObj);
-%End
-
-};
-
-
 template <TYPE>
 %MappedType QSet<TYPE>
 {

comment:2 by volter, 14 years ago

Doesn't work for me with QGIS 1.5, SIP 4.11 and Qt 4.7:

[ 95%] Generating ui_qgsplugininstallerbase.py cd /builddir/build/BUILD/qgis-1.5.0/python/plugins/plugin_installer && /usr/bin/pyuic4 /builddir/build/BUILD/qgi s-1.5.0/python/plugins/plugin_installer/qgsplugininstallerbase.ui -o /builddir/build/BUILD/qgis-1.5.0/python/plu gins/plugin_installer/ui_qgsplugininstallerbase.py An unexpected error occurred. Check that you are using the latest version of PyQt and send an error report to support@…, including the following information:

  • your version of PyQt (4.7.6)
  • the UI file that caused this error
  • the debug output of pyuic4 (use the -d flag when calling pyuic4)

make[2]: Leaving directory `/builddir/build/BUILD/qgis-1.5.0' make[1]: Leaving directory `/builddir/build/BUILD/qgis-1.5.0' make[2]: * [python/plugins/plugin_installer/ui_qgsplugininstallerbase.py] Error 1 make[1]: * [python/plugins/plugin_installer/CMakeFiles/pluginstaller.dir/all] Error 2 make: * [all] Error 2

comment:3 by sthen, 14 years ago

Ah sorry I forgot to mention that one; it is a regression with pyuic 4.7.6 on python 2.x - please use a development snapshot of py-qt4 instead or remove "encoding='utf8'" from pyuic/uic/driver.py around line 60.

comment:4 by rdieter, 14 years ago

Cc: rdieter added

comment:5 by jctull, 14 years ago

Using PyQt-4.7.7, released today, along with sip-4.11, I still get the originally posted error. The above patch worked for me. Should this be applied to trunk?

comment:6 by lutra, 14 years ago

Type: bugpatch

comment:7 by jef, 14 years ago

Resolution: fixed
Status: newclosed

Actually it's not a SIP problem, but a PyQt4 problem. PyQt4 contains QSet<int> starting with 4.7.5. r14325 enables QGIS' version of QSet<int> only for earlier versions.

comment:8 by aatiis, 13 years ago

Cc: aatiis added
Platform: OpenBSDGentoo
Priority: major: does not work as expectedminor: annoyance
Resolution: fixed
Status: closedreopened

I'm reopening this because changeset 14325 introduced a Developer Warning that has still not been fixed. Please change "trunk/qgis/python/CMakeLists.txt" line 44 to match the opening IF statement arguments (on line 42).

comment:9 by jef, 13 years ago

Resolution: fixed
Status: reopenedclosed

comment:10 by aatiis, 13 years ago

Ouch. Now how the hell did I miss that.

In that case, sorry for making noise here; and thanks very much for your work, jef. I've merged the diffs from r14323, r14324, r14325 and r14330 into a patch to backport this fix to version 1.5.0 in Gentoo, it works pretty well.

Note: See TracTickets for help on using tickets.