Bug report #21312

recipe for target 'python/core/sip_corepart0.cpp' failed

Added by nicolas zzzz over 1 year ago. Updated over 1 year ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:Build/Install
Affected QGIS version:3.4.4 Regression?:No
Operating System:Ubuntu 18.04 64 bits Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29130

Description

Trying to compile QGIS 3.4.4 (release-3_4) from sources on Ubuntu 18.04 I end up with this error:

(...)

[ 24%] Generating core/sip_corepart0.cpp, core/sip_corepart1.cpp, core/sip_corepart2.cpp, core/sip_corepart3.cpp

sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]
python/CMakeFiles/python_module_qgis__core.dir/build.make:523: recipe for target 'python/core/sip_corepart0.cpp' failed
make[2]: *** [python/core/sip_corepart0.cpp] Error 1
make[2]: *** Deleting file 'python/core/sip_corepart0.cpp'
CMakeFiles/Makefile2:3995: recipe for target 'python/CMakeFiles/python_module_qgis__core.dir/all' failed
make[1]: *** [python/CMakeFiles/python_module_qgis__core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 24%] Built target qgis_mimedatautilstest_autogen
[ 27%] Built target qgis_analysis
[ 49%] Built target qgis_gui
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Here's the cmake-gui output:

QGIS version: 3.4.4 Madeira (30404)
Found OpenCL C++ headers: /usr/include
Could not find GRASS 7
Found Proj: /usr/local/lib/libproj.so (6.0.0)
Found GEOS: /usr/lib/x86_64-linux-gnu/libgeos_c.so (3.6.2)
Found GDAL: /usr/local/lib/libgdal.so (2.4.0dev-283265213f-dirty)
Found Expat: /usr/lib/x86_64-linux-gnu/libexpat.so
Found Spatialindex: /usr/lib/x86_64-linux-gnu/libspatialindex.so
Found Qwt: /usr/lib/libqwt-qt5.so (6.1.3)
Found libzip: /usr/lib/x86_64-linux-gnu/libzip.so
Found Sqlite3: /usr/lib/x86_64-linux-gnu/libsqlite3.so
Found PostgreSQL: /usr/lib/x86_64-linux-gnu/libpq.so
Found SpatiaLite: /usr/lib/x86_64-linux-gnu/libspatialite.so
Qt WebKit support enabled
Found Qt version: 5.9.5
Found QScintilla2: /usr/lib/libqscintilla2_qt5.so (2.10.2)
Found QtKeychain: /usr/lib/x86_64-linux-gnu/libqt5keychain.so
Found QCA: /usr/lib/x86_64-linux-gnu/libqca-qt5.so (2.1.3)
Found QCA OpenSSL plugin
Pedantic compiler settings enabled
Found Python executable: /usr/bin/python3
Found Python version: 3.6.7
Found Python library: /usr/lib/x86_64-linux-gnu/libpython3.6m.so
Found Python site-packages: /usr/lib/python3/dist-packages
Found PyQt5 version: 5.12
Found SIP version: 4.19.7
Found QScintilla2 PyQt module: 2.11.1
HDF5: Using hdf5 compiler wrapper to determine C configuration
Found GSL: -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm
Ctest Binary Directory set to: /opt/QGIS/build_34/output/bin
Configuring done
Generating done

History

#1 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to invalid
  • Status changed from Open to Closed

For compiling problems please send an email to the developers mailing list first, if a bug is confirmed than we can (re)open (the)a ticket.

#2 Updated by nicolas zzzz over 1 year ago

Actually, sip 4.19.7 which is shipped from Ubuntu 18.04 main repositories doesn't have a "-n" flag: as stated here https://www.riverbankcomputing.com/static/Docs/sip/command_line.html it was introduced in version 4.19.9.

This "-n" flag is used at line 542 (now) of file ./python/CMakeFiles/python_module_qgis__core.dir/build.make:

cd /opt/QGIS/build_master/python && /usr/bin/sip -w -e -x ANDROID -x ARM -x MOBILITY_LOCATION -n PyQt5.sip -t WS_X11 -t Qt_5_12_2 -g -o -a /opt/QGIS/build_master/python/qgis.core.api -y /opt/QGIS/build_master/output/python/qgis/_core.pyi -j 4 -c /opt/QGIS/build_master/python/core -I /opt/QGIS/build_master/python/core -I /usr/share/sip/PyQt5 -I /opt/QGIS/python /opt/QGIS/build_master/python/core/core.sip

It affects the master branch as well.

#3 Updated by nicolas zzzz over 1 year ago

  • Status changed from Closed to Reopened

#4 Updated by Giovanni Manghi over 1 year ago

  • Resolution deleted (invalid)

#5 Updated by Jürgen Fischer over 1 year ago

nicolas zzzz wrote:

Actually, sip 4.19.7 which is shipped from Ubuntu 18.04 main repositories doesn't have a "-n" flag: as stated here https://www.riverbankcomputing.com/static/Docs/sip/command_line.html it was introduced in version 4.19.9.

Known - therefore QGIS is only using -n starting with sip 4.19.11 - and builds on bionic are working fine. So it looks like a local issue.

#6 Updated by Giovanni Manghi over 1 year ago

  • Status changed from Reopened to Feedback

#7 Updated by nicolas zzzz over 1 year ago

Thanks for the hints.

Hmm, I thought the python package named PyQt5-sip from https://pypi.org/project/PyQt5-sip/ was probably making the search of SIP confused within the cmake-gui configuration step to build QGIS, so I removed it as its version from the pypi repository was 4.19.15 and the system sip from the bionic repositories is 4.19.7.

Then I force-reinstalled these two system packages with apt-get; python3-sip and python3-sip-dev to make sure everything is clean:

$ apt-get install --reinstall python3-sip python3-sip-dev
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
  Need to get 0 B/97.2 kB of archives.
  After this operation, 0 B of additional disk space will be used.
  (Reading database ... 489083 files and directories currently installed.)
  Preparing to unpack .../python3-sip_4.19.7+dfsg-1_amd64.deb ...
  Unpacking python3-sip (4.19.7+dfsg-1) over (4.19.7+dfsg-1) ...
  Preparing to unpack .../python3-sip-dev_4.19.7+dfsg-1_amd64.deb ...
  Unpacking python3-sip-dev (4.19.7+dfsg-1) over (4.19.7+dfsg-1) ...
  Setting up python3-sip (4.19.7+dfsg-1) ... 
  Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
  Setting up python3-sip-dev (4.19.7+dfsg-1) ...

And I cleaned the QGIS build directory, before re-configuring the build.
But encountered this error at the 'configure' step in cmake-gui which is telling me it was OK with the pypi package but not the official Ubuntu ones (I double checked that all dependencies containing the word 'qt' or 'sip' are installed and it's the case):

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 34, in <module>
    import PyQt5.pyqtconfig
ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 37, in <module>
    import PyQt5.QtCore
ModuleNotFoundError: No module named 'PyQt5.sip'

Found SIP version: 4.19.7
Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindQsci.py", line 45, in <module>
    from PyQt5.Qsci import QSCINTILLA_VERSION_STR
ModuleNotFoundError: No module named 'PyQt5.sip'

Some more information at this stage;

$ find /usr -iname "*sipconfig*" 
  /usr/lib/python3/dist-packages/sipconfig.py
  /usr/lib/python3/dist-packages/sipconfig_nd6.py
  /usr/lib/python3/dist-packages/__pycache__/sipconfig_nd6.cpython-36.pyc
  /usr/lib/python3/dist-packages/__pycache__/sipconfig.cpython-36.pyc
$ find /usr/bin -iname "*sip*" 
  /usr/bin/dh_sip
  /usr/bin/lsipc
  /usr/bin/sip
  /usr/bin/dh_sip3
$ find /usr/include/python3.6* -iname "*sip*" 
 /usr/include/python3.6dm/sip.h
 /usr/include/python3.6m/sip.h
$ sip -V
  4.19.7
$ which sip
  /usr/bin/sip

From a python3 console:

>>> import PyQt5.sip
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'PyQt5.sip'

The question I am currently asking myself is; from which system package(s) do PyQt5.pyqtconfig and PyQt5.sip come from?

PS:
the if statement in file /opt/QGIS/cmake/FindSIP.py (this path is stored in variable _find_sip.py within cmake-gui): is returning me:

>>> import sipconfig
>>> 
>>> sipcfg = sipconfig.Configuration()
>>> print("sip_version:%06.0x" % sipcfg.sip_version)
    sip_version:041307
>>> print("sip_version_num:%d" % sipcfg.sip_version)
    sip_version_num:267015
>>> print("sip_version_str:%s" % sipcfg.sip_version_str)
    sip_version_str:4.19.7
>>> print("sip_bin:%s" % sipcfg.sip_bin)
    sip_bin:/usr/bin/sip
>>> print("default_sip_dir:%s" % sipcfg.default_sip_dir)
    default_sip_dir:/usr/share/sip
>>> print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
    sip_inc_dir:/usr/include/python3.6m
>>> if hasattr(sipcfg, "sip_module_dir"):
...     print("sip_module_dir:%s" % sipcfg.sip_module_dir)
... else:
...     print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
... 
sip_module_dir:/usr/lib/python3.6/dist-packages

This last path doesn't exit on my system: /usr/lib/python3.6/dist-packages

$ ll /usr/lib/python3.6/dist-packages
  ls: cannot access '/usr/lib/python3.6/dist-packages': No such file or directory

But /usr/lib/python3.6/site-packages/ does exist ("site-packages" = OK, "dist-package" = NOT EXISTING...).
I also have a /usr/lib/python3/dist-packages directory here with "dist-packages" but not with "python3.6" in the directory name...

Strange.
So, what "sipcfg.sip_mod_dir" returns in python3 is not a valid path.
I think I should check from riverbank's side...

#8 Updated by Jürgen Fischer over 1 year ago

nicolas zzzz wrote:

Thanks for the hints.

Don't mix packages from debian and pypi. PyQt5 in debian/ubuntu used sip as sip module name and pypi probably PyQt5.sip - maybe that's your issue. Try building packages (3.8 in INSTALL).

Also available in: Atom PDF