Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-25 Thread Julien ÉLIE

Hi Matthias,

looking at m4/python.m4, this comes from getting the configuration out 
of the sysconfig module.


and _sysconfigdata_* has:

  'LOCALMODLIBS': '-lm  -lm   -lz -lm -lm   -lexpat  -lexpat '
  'Modules/_hacl/libHacl_Hash_SHA2.a -lz',


So, I'm not sure, how to better get the required information for 
linking, but this interface doesn't look very reliable.


maybe better use: python3-config --embed --libs


Oh, yes, your proposal to use python3-config is far better.
After testing, "python3-config --libs" is enough; there's no need in 
adding "--embed" as the "-lpython3.12" flag otherwise appears twice in 
PYTHON_LIBS.


Also, if python3-config (which may also be python2-config, python-config 
or any other variant) is not installed, I've kept the current check just 
to be sure we'll still have something.



I've opened a PR upstream:

https://github.com/rra/rra-c-util/pull/18/commits/63e4ddf8683c8c1dc429043ca8af7984eff21140

Thanks again.

--
Julien ÉLIE

« Le cercle est le plus long chemin d'un point au même point. » (Tom
  Stoppard, _Every Good Boy Deserves Favour_)



Processed: Re: Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-25 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 + patch
Bug #1061315 [src:inn2] inn2 ftbfs with Python 3.12 as the default
Added tag(s) patch.

-- 
1061315: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061315
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-25 Thread Matthias Klose

Control: tags -1 + patch

On 22.01.24 21:31, Julien ÉLIE wrote:

Hi Matthias,


Package: src:inn2
Version: 2.7.2~20231223-1
Severity: serious
Tags: sid trixie ftbfs
User: debian-pyt...@lists.debian.org
Usertags: python3.12

with python3-defaults from experimental:

[...]
checking for Python.h... yes
checking for Py_Initialize... no
configure: error: in `/<>/build':
configure: error: unable to link with Python library
See `config.log' for more details


Could you put the end of the config.log file? (the part showing the 
failure to find Py_Initialize)


Maybe a problem of Python not in the path?


FWIW, I do not run trixie, but building INN with a downloaded version of 
Python 3.12 on bookworm works for me:


checking for flags to link with Python... -L/home/news/work/py3.12.1/lib 
-lpython3.12 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic

checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
checking for Py_Initialize... yes


configure:15028: checking for Py_Initialize
configure:15028: gcc -o conftest -g -O2 
-I/home/news/work/py3.12.1/include/python3.12   conftest.c 
-L/home/news/work/py3.12.1/lib -lpython3.12 -lpthread -ldl -lutil -lm 
-Xlinker -export-dynamic   >&5


configure:15777: checking for Py_Initialize
configure:15777: gcc -o conftest -g -O2 -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer -ff
ile-prefix-map=/home/packages/tmp/inn2-2.7.2~20231223=. -flto=auto 
-ffat-lto-objects -fstack-pro
tector-strong -fstack-clash-protection -Wformat -Werror=format-security 
-fcf-protection -fdebug-
prefix-map=/home/packages/tmp/inn2-2.7.2~20231223=/usr/src/inn2-2.7.2~20231223-1build2 
-I/usr/in
clude/python3.12 -Wdate-time -D_FORTIFY_SOURCE=3 
-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-o
bjects -Wl,-z,relro -Wl,-z,now conftest.c -L/usr/lib/x86_64-linux-gnu 
-lpython3.12 -ldl -lm -lm
-lm -lz -lm -lm -lexpat -lexpat Modules/_hacl/libHacl_Hash_SHA2.a -lz 
-Xlinker -export-dynamic -
Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 
 >&5
/usr/bin/ld: cannot find Modules/_hacl/libHacl_Hash_SHA2.a: No such file 
or directory

collect2: error: ld returned 1 exit status
configure:15777: $? = 1


looking at m4/python.m4, this comes from getting the configuration out 
of the sysconfig module.


and _sysconfigdata_* has:

 'LOCALMODLIBS': '-lm  -lm   -lz -lm -lm   -lexpat  -lexpat '
 'Modules/_hacl/libHacl_Hash_SHA2.a -lz',


So, I'm not sure, how to better get the required information for 
linking, but this interface doesn't look very reliable.


maybe better use: python3-config --embed --libs

patch attached.

diff -Nru inn2-2.7.2~20231223/debian/changelog inn2-2.7.2~20231223/debian/changelog
--- inn2-2.7.2~20231223/debian/changelog	2024-01-19 20:41:48.0 +0100
+++ inn2-2.7.2~20231223/debian/changelog	2024-01-25 16:06:27.0 +0100
@@ -1,3 +1,9 @@
+inn2 (2.7.2~20231223-1ubuntu1) noble; urgency=medium
+
+  * Fix configury with Python 3.12.
+
+ -- Matthias Klose   Thu, 25 Jan 2024 16:06:27 +0100
+
 inn2 (2.7.2~20231223-1build2) noble; urgency=medium
 
   * No-change rebuild with Python 3.12 as default
diff -Nru inn2-2.7.2~20231223/debian/patches/python3.12.diff inn2-2.7.2~20231223/debian/patches/python3.12.diff
--- inn2-2.7.2~20231223/debian/patches/python3.12.diff	1970-01-01 01:00:00.0 +0100
+++ inn2-2.7.2~20231223/debian/patches/python3.12.diff	2024-01-25 16:06:27.0 +0100
@@ -0,0 +1,23 @@
+--- a/m4/python.m4
 b/m4/python.m4
+@@ -130,10 +130,7 @@ AC_DEFUN([INN_LIB_PYTHON],
+ print(" -L".join(sysconfig.get_config_vars("LIBDIR")))'`
+  py_ldlibrary=`$PYTHON -c 'import sysconfig; \
+ print(sysconfig.get_config_vars("LDLIBRARY")@<:@0@:>@)'`
+- py_linkage=`$PYTHON -c 'import sysconfig; \
+-print(" ".join(sysconfig.get_config_vars(  \
+-"LIBS", "LIBC", "LIBM", "LOCALMODLIBS", "BASEMODLIBS", \
+-"LINKFORSHARED", "LDFLAGS")))'`],
++ py_linkage=`${PYTHON}-config --embed --libs`],
+ [py_include=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_inc())'`
+  py_libdir=`$PYTHON -c 'import distutils.sysconfig; \
+@@ -142,7 +139,7 @@ AC_DEFUN([INN_LIB_PYTHON],
+ print(distutils.sysconfig.get_config_vars("LDLIBRARY")@<:@0@:>@)'`
+  py_linkage=`$PYTHON -c 'import distutils.sysconfig;   \
+ print(" ".join(distutils.sysconfig.get_config_vars(\
+-"LIBS", "LIBC", "LIBM", "LOCALMODLIBS", "BASEMODLIBS", \
++"LIBS", "LIBC", "LIBM", "MODLIBS", "BASEMODLIBS", \
+ "LINKFORSHARED", "LDFLAGS")))'`])
+  PYTHON_CPPFLAGS="-I$py_include"
+  py_libpython=`AS_ECHO(["$py_ldlibrary"]) \
diff -Nru inn2-2.7.2~20231223/debian/patches/series inn2-2.7.2~20231223/debian/patches/series
--- inn2-2.7.2~20231223/debian/patches/series	2023-09-06 21:47:32.0 +0200
+++ inn2-2.7.2~20231223/debian/patches/se

Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-22 Thread Matthias Klose

On 22.01.24 21:31, Julien ÉLIE wrote:

Hi Matthias,


Package: src:inn2
Version: 2.7.2~20231223-1
Severity: serious
Tags: sid trixie ftbfs
User: debian-pyt...@lists.debian.org
Usertags: python3.12

with python3-defaults from experimental:

[...]
checking for Python.h... yes
checking for Py_Initialize... no
configure: error: in `/<>/build':
configure: error: unable to link with Python library
See `config.log' for more details


Could you put the end of the config.log file? (the part showing the 
failure to find Py_Initialize)


sorry, just reporting the issue as found on the Ubuntu buildds:

https://launchpad.net/ubuntu/+source/inn2/2.7.2~20231223-1build2



Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-22 Thread Julien ÉLIE

Hi Matthias,


Package: src:inn2
Version: 2.7.2~20231223-1
Severity: serious
Tags: sid trixie ftbfs
User: debian-pyt...@lists.debian.org
Usertags: python3.12

with python3-defaults from experimental:

[...]
checking for Python.h... yes
checking for Py_Initialize... no
configure: error: in `/<>/build':
configure: error: unable to link with Python library
See `config.log' for more details


Could you put the end of the config.log file? (the part showing the 
failure to find Py_Initialize)


Maybe a problem of Python not in the path?


FWIW, I do not run trixie, but building INN with a downloaded version of 
Python 3.12 on bookworm works for me:


checking for flags to link with Python... -L/home/news/work/py3.12.1/lib 
-lpython3.12 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic

checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
checking for Py_Initialize... yes


configure:15028: checking for Py_Initialize
configure:15028: gcc -o conftest -g -O2 
-I/home/news/work/py3.12.1/include/python3.12   conftest.c 
-L/home/news/work/py3.12.1/lib -lpython3.12 -lpthread -ldl -lutil -lm 
-Xlinker -export-dynamic   >&5



--
Julien ÉLIE

« L'éternité, c'est long, surtout vers la fin. » (Woody Allen)



Bug#1061315: inn2 ftbfs with Python 3.12 as the default

2024-01-22 Thread Matthias Klose

Package: src:inn2
Version: 2.7.2~20231223-1
Severity: serious
Tags: sid trixie ftbfs
User: debian-pyt...@lists.debian.org
Usertags: python3.12

with python3-defaults from experimental:

[...]
checking for Python.h... yes
checking for Py_Initialize... no
configure: error: in `/<>/build':
configure: error: unable to link with Python library
See `config.log' for more details