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

Fails to build with Python 3.8 #34034

Closed
sebastic opened this issue Jan 26, 2020 · 2 comments
Closed

Fails to build with Python 3.8 #34034

sebastic opened this issue Jan 26, 2020 · 2 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers

Comments

@sebastic
Copy link
Contributor

As reported by Gianfranco Costamagna in Debian Bug #949864:

Hello, when built on experimental, the python3-config command needs a new flag to find correctly the python3.8 library (thanks Doko for the suggestion)

so, the following (unfortunately non-retro-compatible) patch, fixes the issue:

--- qgis-3.4.15+dfsg/debian/changelog 2020-01-22 05:57:39.000000000 +0100
+++ qgis-3.4.15+dfsg/debian/changelog 2020-01-25 22:17:14.000000000 +0100
@@ -1,3 +1,10 @@
+qgis (3.4.15+dfsg-1.1) experimental; urgency=medium
+
+  * Manually add --embed to rules file to fix FTBFS due to change in
+    behaviour of python3-config --ldflags (from doko) (Closes: #-1)
+
+ -- Gianfranco Costamagna <locutusofborg@debian.org>  Sat, 25 Jan 2020 22:17:14 +0100
+
 qgis (3.4.15+dfsg-1) unstable; urgency=medium

   * Move from experimental to unstable.
diff -Nru qgis-3.4.15+dfsg/debian/rules qgis-3.4.15+dfsg/debian/rules
--- qgis-3.4.15+dfsg/debian/rules     2019-11-11 09:07:24.000000000 +0100
+++ qgis-3.4.15+dfsg/debian/rules     2020-01-25 22:17:14.000000000 +0100
@@ -93,7 +93,7 @@
      -DWITH_SERVER_PLUGINS=TRUE \
      -DWITH_QWTPOLAR=FALSE \
      -DQT_PLUGINS_DIR=$(QT_PLUGINS_DIR) \
-     -DPYTHON_LIBRARY=$(shell python3-config --ldflags | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')
+     -DPYTHON_LIBRARY=$(shell python3-config --ldflags --embed | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')

 ifneq ($(SHA),)
      CMAKE_OPTS += -DSHA=$(SHA)

To make the suggested patch work with older Python as well, the following change was applied to the Debian package:

--- a/debian/rules
+++ b/debian/rules
@@ -57,6 +57,8 @@ GRASS=grass$(subst .,,$(shell pkg-config --modversion grass|cut -d. -f1,2))
 GRASSVER=$(subst .,,$(shell pkg-config --modversion grass|cut -d. -f1))
 GRASSABI=$(subst .,,$(shell pkg-config --modversion grass|cut -d. -f1,2,3|sed -e 's/RC/-/'))
 
+PYTHON_GE_38=$(shell python3 -c 'import sys; print(1) if(sys.version_info[0] > 3 or (sys.version_info[0] == 3 and sys.version_info[1] >= 8)) else print(0)')
+
 # Include percentage of started edges
 export NINJA_STATUS=[%f/%t %p]
 
@@ -92,8 +94,13 @@ CMAKE_OPTS := \
        -DWITH_SERVER=TRUE \
        -DWITH_SERVER_PLUGINS=TRUE \
        -DWITH_QWTPOLAR=FALSE \
-       -DQT_PLUGINS_DIR=$(QT_PLUGINS_DIR) \
-       -DPYTHON_LIBRARY=$(shell python3-config --ldflags | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')
+       -DQT_PLUGINS_DIR=$(QT_PLUGINS_DIR)
+
+ifeq ($(PYTHON_GE_38),1)
+       CMAKE_OPTS += -DPYTHON_LIBRARY=$(shell python3-config --ldflags --embed | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')
+else
+       CMAKE_OPTS += -DPYTHON_LIBRARY=$(shell python3-config --ldflags | sed -e 's\#-L\(.*\) -L/usr/lib -l\([^ ]*\) .*$$\#\1/lib\2.so\#')
+endif
 
 ifneq ($(SHA),)
        CMAKE_OPTS += -DSHA=$(SHA)
@sebastic sebastic added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 26, 2020
@roya0045
Copy link
Contributor

Still valid?

@gioman gioman added the Feedback Waiting on the submitter for answers label Mar 29, 2020
@sebastic
Copy link
Contributor Author

3.10.3 hardcoded /usr/lib/x86_64-linux-gnu/libpython3.8.so, 3.10.4 contains a change similar to the one in the Debian package mentioned above, except that it uses the distribution to decide whether to use the --embed option instead of checking for Python >= 3.8.

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! Feedback Waiting on the submitter for answers
Projects
None yet
Development

No branches or pull requests

3 participants