Source: fungw
Version: 1.2.1-3.1
Severity: important
Tags: ftbfs forky sid upstream
User: [email protected]
Usertags: perl-5.42-transition

This package fails to build with Perl 5.42 (currently in experimental.)

  cd perl && make all
  make[3]: Entering directory 
'/build/fungw-BK8n9O/fungw-1.2.1/libfungwbind/perl'
  cc -c -Wall -g -I../../ -I../../src_3rd -g -O2 
-Werror=implicit-function-declaration 
-ffile-prefix-map=/build/fungw-BK8n9O/fungw-1.2.1=. -fstack-protector-strong 
-fstack-clash-protection -Wformat -Werror=format-security -fcf-protection 
-Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_REENTRANT -D_GNU_SOURCE -DDEBIAN 
-fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64  -I/usr/lib/x86_64-linux-gnu/perl/5.42/CORE -o 
fungw_perl.o fungw_perl.c
  fungw_perl.c: In function ‘fgws_perl_call_fgw’:
  fungw_perl.c:96:48: error: ‘PerlInterpreter’ {aka ‘struct interpreter’} has 
no member named ‘IXpv’
     96 |         perl_ctx_t *ctx = (perl_ctx_t *)my_perl->perl_user_data;
        |                                                ^~
  fungw_perl.c: In function ‘fgws_perl_func_reg’:
  fungw_perl.c:240:48: error: ‘PerlInterpreter’ {aka ‘struct interpreter’} has 
no member named ‘IXpv’
    240 |         perl_ctx_t *ctx = (perl_ctx_t *)my_perl->perl_user_data;
        |                                                ^~
  fungw_perl.c: In function ‘fgws_perl_init’:
  fungw_perl.c:286:20: error: ‘PerlInterpreter’ {aka ‘struct interpreter’} has 
no member named ‘IXpv’
    286 |         ctx->interp->perl_user_data = (void *)ctx;
        |                    ^~
  make[3]: *** [Makefile:36: fungw_perl.o] Error 1

This seems to be fallout from

  https://github.com/Perl/perl5/commit/079a9d4ad36ef1a5b3d792b63137d406168df0e9

which indicates that the Xpv member was long obsolete and has now been removed.

I see that fungw upstream SVN has recently added a configuration probe
for the Xpv member and is now disabling the Perl parts altogether if
that probe fails.

While that would be a rather sad outcome, it's certainly one solution. I'm
attaching those upstream changes as adapted to the current fungw Debian
source package. They make the build work again for me, but further
packaging changes (presumably removing the libfungw-perl1 package)
would also be needed for this approach.

The fungw code doesn't really seem to care much about which interpreter
struct member it uses, it just needs a slot for user data. I wonder if
modglobal hash would do:

  PL_modglobal is a general purpose, interpreter global HV for use by
  extensions that need to keep information on a per-interpreter basis.
  In a pinch, it can also be used as a symbol table for extensions to
  share data among each other.  It is a good idea to use keys prefixed
  by the package name of the extension that owns the data.

I'm not an expert in this area though, and I don't plan to drive such a
change myself. I assume the Perl upstream developers would be happy to
give further advice, perhaps on the perl5-porters list.

If you want to test changes against Perl 5.42 in experimental and run
into uninstallability problems, there is a test repository of rebuilt
Debian sid packages for amd64 available at <https://perl.debian.net/>.

Thanks for your work on Debian,
-- 
Niko Tyni   [email protected]
>From e6b6dbd3e37fd16aa06ea7dcf5833b0412960ed6 Mon Sep 17 00:00:00 2001
From: igor2 <igor2@997a6158-8d80-4c00-925a-7ca3944c4d11>
Date: Sat, 7 Dec 2024 12:31:02 +0000
Subject: [PATCH 1/2] -Add: optional detector for perl: perl_with_IXpv -
 accepts perl only if IXpv is available

git-svn-id: svn://repo.hu/scconfig/trunk/src@1857 997a6158-8d80-4c00-925a-7ca3944c4d11
---
 scconfig/src/scripts/find_perl.c   | 21 +++++++++++++++++++--
 scconfig/src/scripts/find_python.c |  6 +++---
 scconfig/src/scripts/scripts.c     |  1 +
 scconfig/src/scripts/scripts.h     |  1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/scconfig/src/scripts/find_perl.c b/scconfig/src/scripts/find_perl.c
index 87d4a32..6fcf1fb 100644
--- a/scconfig/src/scripts/find_perl.c
+++ b/scconfig/src/scripts/find_perl.c
@@ -22,11 +22,12 @@
 
 #include "scripts.h"
 
-int find_script_perl(const char *name, int logdepth, int fatal)
+static int find_script_perl_(const char *name, int logdepth, int fatal, char *extra)
 {
 	char *cflags, *ldflags, *s;
 	int res;
-	char *test_c =
+	char test_c[256];
+	char *test_c_in =
 		NL "#include <stdio.h>"
 		NL "#include <EXTERN.h>"
 		NL "#include <perl.h>"
@@ -34,11 +35,14 @@ int find_script_perl(const char *name, int logdepth, int fatal)
 		NL "	PerlInterpreter *interp;"
 		NL
 		NL "	interp = perl_alloc();"
+		NL "%s"
 		NL "	puts(\"OK\");"
 		NL "	return 0;"
 		NL "}"
 		NL;
 
+	sprintf(test_c, test_c_in, extra);
+
 	require("sys/class", logdepth, fatal);
 	require("cc/cc", logdepth, fatal);
 	require("/internal/filelist/method", logdepth, fatal);
@@ -83,3 +87,16 @@ int find_script_perl(const char *name, int logdepth, int fatal)
 
 	return try_fail(logdepth, "libs/script/perl");
 }
+
+int find_script_perl(const char *name, int logdepth, int fatal)
+{
+	return find_script_perl_(name, logdepth, fatal, "");
+}
+
+int find_script_perl_with_IXpv(const char *name, int logdepth, int fatal)
+{
+	int res = find_script_perl_(name, logdepth, fatal, "(void)interp->IXpv;");
+	put("libs/script/perl_with_IXpv", "tried");
+	return res;
+}
+
diff --git a/scconfig/src/scripts/find_python.c b/scconfig/src/scripts/find_python.c
index efde6a8..a3d8862 100644
--- a/scconfig/src/scripts/find_python.c
+++ b/scconfig/src/scripts/find_python.c
@@ -43,13 +43,13 @@ static int find_script_python_(const char *name, int logdepth, int fatal, int ve
 
 	char *inc_py =
 		NL "import distutils.sysconfig;"
-		NL "print '-I' + distutils.sysconfig.get_python_inc().replace('\\\\','/')"
+		NL "print ('-I' + distutils.sysconfig.get_python_inc().replace('\\\\','/'))"
 		NL;
 	char *lib_py =
 		NL "import distutils.sysconfig;"
-		NL "print '-L' + distutils.sysconfig.PREFIX.replace('\\\\','/') + '/libs',;"
+		NL "print ('-L' + distutils.sysconfig.PREFIX.replace('\\\\','/') + '/libs')"
 		NL "import sys;"
-		NL "print '-lpython' + str(sys.version_info[0]) + str(sys.version_info[1])"
+		NL "print ('-lpython' + str(sys.version_info[0]) + str(sys.version_info[1]))"
 		NL;
 
 
diff --git a/scconfig/src/scripts/scripts.c b/scconfig/src/scripts/scripts.c
index 8f5035e..2d7123f 100644
--- a/scconfig/src/scripts/scripts.c
+++ b/scconfig/src/scripts/scripts.c
@@ -34,6 +34,7 @@ void deps_scripts_init()
 	dep_add("libs/script/python/*",         find_script_python);
 	dep_add("libs/script/python3/*",        find_script_python3);
 	dep_add("libs/script/perl/*",           find_script_perl);
+	dep_add("libs/script/perl_with_IXpv",   find_script_perl_with_IXpv);
 	dep_add("libs/script/mawk/*",           find_script_mawk);
 	dep_add("libs/script/lua/*",            find_script_lua);
 	dep_add("libs/script/guile/*",          find_script_guile);
diff --git a/scconfig/src/scripts/scripts.h b/scconfig/src/scripts/scripts.h
index 95a3799..e18f80c 100644
--- a/scconfig/src/scripts/scripts.h
+++ b/scconfig/src/scripts/scripts.h
@@ -18,6 +18,7 @@ int find_script_mruby(const char *name, int logdepth, int fatal);
 int find_script_python(const char *name, int logdepth, int fatal);
 int find_script_python3(const char *name, int logdepth, int fatal);
 int find_script_perl(const char *name, int logdepth, int fatal);
+int find_script_perl_with_IXpv(const char *name, int logdepth, int fatal);
 int find_script_mawk(const char *name, int logdepth, int fatal);
 int find_script_lua(const char *name, int logdepth, int fatal);
 int find_script_guile(const char *name, int logdepth, int fatal);
-- 
2.49.0

>From 0baa0f809a074f913c8f5537eb4e0852f2c59b5b Mon Sep 17 00:00:00 2001
From: igor2 <igor2@9df29d54-5764-4f4b-9cf6-31b2c6738818>
Date: Sat, 7 Dec 2024 12:32:43 +0000
Subject: [PATCH 2/2] -Fix: scconfig accepts perl only if IXpv is available in
 the interpreter struct

git-svn-id: svn://svn.repo.hu/fungw/trunk@823 9df29d54-5764-4f4b-9cf6-31b2c6738818
---
 libfungwbind/scconfig_hooks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfungwbind/scconfig_hooks.h b/libfungwbind/scconfig_hooks.h
index 5aa18db..61ffeb5 100644
--- a/libfungwbind/scconfig_hooks.h
+++ b/libfungwbind/scconfig_hooks.h
@@ -55,7 +55,7 @@ static int fungwbind_hook_detect_target(void)
 	if (require("libs/script/python3/*", 0, 0) == 0)
 		static_disable_python = 2;
 	require("libs/script/mruby/*", 0, 0);
-	require("libs/script/perl/*", 0, 0);
+	require("libs/script/perl_with_IXpv", 0, 0);
 	require("libs/script/duktape/*", 0, 0);
 	require("libs/script/estutter/*", 0, 0);
 	require("libs/script/funlisp/*", 0, 0);
-- 
2.49.0

Reply via email to