Opened 7 years ago

Closed 7 years ago

#55014 closed defect (fixed)

py35-poppler-qt4 @0.24.0_1: error: ordered comparison between pointer and zero

Reported by: avysk (Alexey Vyskubov) Owned by: dliessi (Davide Liessi)
Priority: Normal Milestone:
Component: ports Version:
Keywords: highsierra Cc:
Port: py-poppler-qt4 py-poppler-qt5

Description

Relevant part of the build log:

:info:build types.sip:30:56: error: ordered comparison between pointer and zero ('PyObject *' (aka '_object *') and 'int')
:info:build         if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)
:info:build                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
:info:build 5 warnings and 1 error generated.
:info:build error: command '/usr/bin/clang' failed with exit status 1

Change History (8)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Owner: set to dliessi
Port: py-poppler-qt4 added; py35-poppler-qt4 removed
Status: newassigned

In the future, please Cc the port maintainers (port info --maintainers py35-poppler-qt4), if any.

comment:2 Changed 7 years ago by dliessi (Davide Liessi)

comment:3 Changed 7 years ago by kencu (Ken)

Newer clangs are increasingly strict on this. You can most likely reproduce this on any system if you try building it with clang-4.0. See #54183 for another example of a similar error, and how we fixed it there.

comment:4 Changed 7 years ago by kencu (Ken)

Summary: py35-poppler-qt4 @0.24.0_1: build failure on High Sierrapy35-poppler-qt4 @0.24.0_1: error: ordered comparison between pointer and zero

comment:5 Changed 7 years ago by mneilly

I'm not familiar with CPython but from what I see PyList_SET_ITEM is a macro that does not return a value while PyList_SetItem is a function that potentially returns -1. This looks like an error in types.sip in that PyList_SetItem appears to be what should have been used.

I've been able to get the py-poppler-qt5 port to compile and install by modifying /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/python/py-poppler-qt5/files/patch-fix-qt-dirs.diff as follows:

--- setup.py
+++ setup.py
@@ -137,10 +137,10 @@ class build_ext(build_ext_base):
         build_ext_base.initialize_options(self)
         self.poppler_version = None
 
-        self.qmake_bin = 'qmake'
+        self.qmake_bin = '%%QMAKE%%'
 
         self.qt_include_dir = None
-        self.pyqt_sip_dir = None
+        self.pyqt_sip_dir = '%%PYQTSIPDIR%%'
         self.pyqt_sip_flags = None
 
     def finalize_options (self):
@@ -382,6 +382,6 @@
    
 project['cmdclass']['build_ext'] = build_ext
 setup(
-    ext_modules = [Extension("popplerqt5", ["poppler-qt5.sip"], **ext_args)],
+    ext_modules = [Extension("popplerqt5", ["poppler-qt5.sip"], extra_compile_args=["-std=c++11"], **ext_args)],
     **project
 )
--- types.sip
+++ types.sip
@@ -27,7 +27,7 @@
     foreach (Poppler::Document::RenderBackend value, set)
     {
         PyObject *obj = PyLong_FromLong ((long) value);
-        if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)
+        if (obj == NULL || PyList_SetItem (l, i, obj) < 0)
         {
             Py_DECREF(l);

comment:6 Changed 7 years ago by kencu (Ken)

I did something like this patch

--- types.sip.orig	2017-10-16 20:31:11.000000000 -0700
+++ types.sip	2017-10-16 20:31:30.000000000 -0700
@@ -27,7 +27,7 @@
     foreach (Poppler::Document::RenderBackend value, set)
     {
         PyObject *obj = PyLong_FromLong ((long) value);
-        if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)
+        if (obj == (void *)NULL || !(PyList_SET_ITEM (l, i, obj)))
         {
             Py_DECREF(l);

to build it

$ port -v installed | grep poppler
  poppler @0.57.0_0 (active) platform='darwin 17' archs='x86_64' date='2017-10-16T20:11:02-0700'
  poppler-data @0.4.8_0 (active) platform='darwin 17' archs='noarch' date='2017-10-16T20:09:23-0700'
  poppler-qt4-mac @0.57.0_0 (active) platform='darwin 17' archs='x86_64' date='2017-10-16T20:12:36-0700'

but I haven't been confident enough about it to actually recommend it so far.

comment:7 Changed 7 years ago by mojca (Mojca Miklavec)

Port: py-poppler-qt5 added

Reference to the PR: https://github.com/macports/macports-ports/pull/1064

There's exactly the same error present in py-poppler-qt5.

comment:8 Changed 7 years ago by dliessi (Davide Liessi)

Resolution: fixed
Status: assignedclosed

In 69439abe6cb20815bfd78a4790cef4fc675a0006/macports-ports:

py-poppler-qt[45]: fix compiler error

  • Replace PyList_SET_ITEM -> PyList_SetItem
  • Add maintainer's github handle

Closes #55014

Note: See TracTickets for help on using tickets.