Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with QT 5.15 #37250

Merged
merged 9 commits into from
Jun 16, 2020

Conversation

pblottiere
Copy link
Member

Description

Backport of #37116

@pblottiere
Copy link
Member Author

This PR should fixed your issue on 3.10 @rduivenvoorde.

@github-actions github-actions bot added this to the 3.10.7 milestone Jun 16, 2020
@pblottiere pblottiere added Bug Either a bug report, or a bug fix. Let's hope for the latter! Build/Install Related to compiling or installing QGIS labels Jun 16, 2020
@rduivenvoorde
Copy link
Contributor

building this pr

@rduivenvoorde
Copy link
Contributor

Ok (for me) this fixes my build problem. Thanks!!

QGIS version 3.10.6-A Coruña QGIS code revision adb616f
Compiled against Qt 5.12.5 Running against Qt 5.12.5
Compiled against GDAL/OGR 3.1.0 Running against GDAL/OGR 3.1.0
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 (Debian 12.3-1+b1) SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.2
Compiled against PROJ 7.0.1 Running against PROJ Rel. 7.0.1, May 1st, 2020
OS Version Debian GNU/Linux bullseye/sid This copy of QGIS writes debugging output.

@pblottiere
Copy link
Member Author

Ok (for me) this fixes my build problem. Thanks!!

Good news :). Thanks for testing Richard 👍

@nyalldawson nyalldawson merged commit 38cc13d into qgis:release-3_10 Jun 16, 2020
@sebastic
Copy link
Contributor

sebastic commented Jun 17, 2020

Applying this to the 3.10.6 Debian package still fails to build:

usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::init()':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:157: undefined reference to `Py_Initialize'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:159: undefined reference to `PyEval_InitThreads'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:163: undefined reference to `PyImport_AddModule'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:164: undefined reference to `PyModule_GetDict'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::finish()':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:174: undefined reference to `PyEval_SaveThread'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::getTraceback()':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:372: undefined reference to `PyErr_Fetch'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:373: undefined reference to `PyErr_NormalizeException'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:377: undefined reference to `PyImport_ImportModule'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:381: undefined reference to `PyObject_CallMethod'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:387: undefined reference to `PyImport_ImportModule'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:394: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:391: undefined reference to `PyObject_CallMethod'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:403: undefined reference to `PyObject_CallMethod'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:411: undefined reference to `PyUnicode_AsUTF8'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::getTraceback()':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o:/usr/include/python3.8/object.h:478: more undefined references to `_Py_Dealloc' follow
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::runStringUnsafe(QString const&, bool)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:301: undefined reference to `PyGILState_Ensure'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:307: undefined reference to `PyRun_StringFlags'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:308: undefined reference to `PyErr_Occurred'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:316: undefined reference to `PyGILState_Release'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::runStringUnsafe(QString const&, bool)':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::PyObjectToQString(_object*)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:496: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:504: undefined reference to `PyUnicode_AsUTF8'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:509: undefined reference to `PyObject_Str'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:512: undefined reference to `PyUnicode_AsUTF8'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::PyObjectToQString(_object*)':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::getError(QString&, QString&)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:453: undefined reference to `PyGILState_Ensure'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:455: undefined reference to `PyErr_Occurred'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:466: undefined reference to `PyErr_Fetch'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:472: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:485: undefined reference to `PyGILState_Release'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::getError(QString&, QString&)':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::getError(QString&, QString&)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:457: undefined reference to `PyGILState_Release'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::evalString(QString const&, QString&)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:527: undefined reference to `PyGILState_Ensure'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:529: undefined reference to `PyRun_StringFlags'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::evalString(QString const&, QString&)':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::evalString(QString const&, QString&)':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:540: undefined reference to `PyGILState_Release'
/usr/bin/ld: src/python/CMakeFiles/qgispython.dir/qgspythonutilsimpl.cpp.o: in function `QgsPythonUtilsImpl::finish()':
./debian/build/../../src/python/qgspythonutilsimpl.cpp:174: undefined reference to `PyEval_SaveThread'
/usr/bin/ld: ./debian/build/../../src/python/qgspythonutilsimpl.cpp:174: undefined reference to `PyEval_SaveThread'
collect2: error: ld returned 1 exit status

This may be caused by this change in make-dfsg (4.3-1):

  * WARNING: Backward-incompatibility!
    Number signs (#) appearing inside a macro reference or function invocation
    no longer introduce comments and should not be escaped with backslashes:
    thus a call such as:
      foo := $(shell echo '#')
    is legal.  Previously the number sign needed to be escaped, for example:
      foo := $(shell echo '\#')
    Now this latter will resolve to "\#".  If you want to write makefiles
    portable to both versions, assign the number sign to a variable:
      H := \#
      foo := $(shell echo '$H')
    This was claimed to be fixed in 3.81, but wasn't, for some reason.
    To detect this change search for 'nocomment' in the .FEATURES variable.

And the sed expression in debian/rules to set PYTHON_LIBRARY:

PYTHON_LIBRARY=$(shell python3-config --ldflags --embed | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')

Using @ instead of \# as delimiter seems to work:

PYTHON_LIBRARY=$(shell python3-config --ldflags --embed | sed -e 's@-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$@\1/lib\2.so@')

@rduivenvoorde
Copy link
Contributor

@sebastic @jef-n this is not about compilation no?

Because I can really compile/install in a Buster VM (I just tested again).

So this is about the packaging? In which the newer make is creating havoc with '#''s?

@sebastic
Copy link
Contributor

@rduivenvoorde, it is about compilation of the Debian package.

make-dfsg (>= 4.3-1) is only in unstable, not buster nor bullseye, see:

https://tracker.debian.org/pkg/make-dfsg

To make the qgis package build successfully in a Debian unstable environment I needed both the changes from this PR and the PYTHON_LIBRARY changes, see:

https://salsa.debian.org/debian-gis-team/qgis/-/commits/debian/3.10.6+dfsg-1

@buzo-ffm
Copy link

Still does not build on Arch Linux.

  • #include <QPainterPath> is missing in a few places and
  • I don't know how to handle this error:
[  0%] Building /build/qgis-ltr/src/build/doc/INSTALL from /build/qgis-ltr/src/qgis-3.10.6/doc/INSTALL.t2t
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 2026, in parse
    opts, args = getopt.getopt(cmdline, short, long_)
  File "/usr/lib/python3.8/getopt.py", line 93, in getopt
    opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
  File "/usr/lib/python3.8/getopt.py", line 157, in do_longs
    has_arg, opt = long_has_args(opt, longopts)
  File "/usr/lib/python3.8/getopt.py", line 174, in long_has_args
    raise GetoptError(_('option --%s not recognized') % opt, opt)
getopt.GetoptError: option --toc-level not recognized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/txt2tags", line 11, in <module>
    load_entry_point('txt2tags==3.7', 'console_scripts', 'txt2tags')()
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 4865, in exec_command_line
    config, doc = process_source_file(infile)
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 4205, in process_source_file
    full_parsed = ConfigMaster(full_raw).parse()
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 2449, in parse
    self.add(key, value)
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 2338, in add
    raw_opts = CommandLine().get_raw_config(val, ignore=ignoreme)
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 2046, in get_raw_config
    options, arguments = self.parse(cmdline[:])
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 2028, in parse
    Error("%s (try --help)" % errmsg)
  File "/usr/lib/python3.8/site-packages/txt2tags.py", line 1833, in Error
    raise error(msg)
txt2tags.error: txt2tags: Error: option --toc-level not recognized (try --help)
make[2]: *** [doc/CMakeFiles/t2tdoc.dir/build.make:84: doc/INSTALL] Error 1

@sebastic
Copy link
Contributor

@buzo-ffm,

You'll need to patch doc/INSTALL.t2t & doc/news.t2t for this change in txt2tags 3.7:

  • Remove --toc-only and --toc-level options (Jendrik Seipp).

@pblottiere
Copy link
Member Author

Hi @buzo-ffm,

Still does not build on Arch Linux.
#include is missing in a few places and

Ah? I'm also on Arch and the compilation is OK here. My last upgrade is 1 week old, I take a look in the coming days.

@buzo-ffm
Copy link

buzo-ffm commented Jun 18, 2020

@sebastic: Thanks, that worked.

@pblottiere: Nice, I am maintaining the qgis-ltr package on Arch. You can find the includes which I added to fix the build here.

@rduivenvoorde
Copy link
Contributor

@pblottiere @sebastic @buzo-ffm Great cooperation!! Thanks for all these efforts!!

@rduivenvoorde
Copy link
Contributor

Mmm, now 3.12 also fails with the same error...
3.14 still not release ;-)
Should we backport this to 3.12 too?

@pblottiere
Copy link
Member Author

Hi @buzo-ffm,

Still does not build on Arch Linux.

#include is missing in a few places and

Strange, it still build without complaints even after my last upgrade. I don't think it will help but can you give me your CMakeCache.txt please? I'm curious :).

@pblottiere
Copy link
Member Author

@rduivenvoorde

3.14 still not release ;-)

Yes it is :).

archlinux-github pushed a commit to archlinux/aur that referenced this pull request Jul 29, 2022
• apply patch qgis-pyqt5-sip5.patch from community package qgis
• add missing includes
• patch for removed --toc-level in txt2tags
• apply patches from qgis/QGIS#37250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Build/Install Related to compiling or installing QGIS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants