Repository navigation
The CommonMark module cannot be built using gcc 15 and perl 5.40.1 #23192
Copy link
Copy link
Closed
Description
This is perl-5.40.1-515.fc42 as packaged in Fedora rawhide (the dev branch of Fedora)
Module: XS
Description
Since upgrading from gcc 14 to 15, the perl-CommonMark package cannot be rebuild. This does not look like an error in the CommonMark module but one in the XS module from core.
gcc -c -D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DVERSION=\"0.310100\" -DXS_VERSION=\"0.310100\" -fPIC "-I/usr/lib64/perl5/CORE" CommonMark.c
CommonMark.c: In function ‘XS_CommonMark__Node_interface_get_node’:
CommonMark.c:675:18: error: too many arguments to function ‘XSFUNCTION’; expected 0, have 1
675 | RETVAL = XSFUNCTION(node);
| ^~~~~~~~~~ ~~~~
CommonMark.c: In function ‘XS_CommonMark__Node_interface_get_int’:
CommonMark.c:701:18: error: too many arguments to function ‘XSFUNCTION’; expected 0, have 1
701 | RETVAL = XSFUNCTION(node);
| ^~~~~~~~~~ ~~~~
[...]
Steps to Reproduce
Build the CommonMark module using gcc 15 and Perl 5.40.1
Expected behavior
The module should build successfully
Perl configuration
+ /usr/bin/perl -V
Summary of my perl5 (revision 5 version 40 subversion 1) configuration:
Platform:
osname=linux
osvers=6.11.0
archname=x86_64-linux-thread-multi
uname='linux localhost 6.11.0 #1 smp preempt_dynamic 6.11.0 x86_64 gnulinux '
config_args='-des -Doptimize=none -Dccflags=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Dldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Dlddlflags=-shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.40.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5/5.40 -Dsitearch=/usr/local/lib64/perl5/5.40 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize -Duse64bitint'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='gcc'
ccflags ='-D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize=' -g'
cppflags='-D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include'
ccversion=''
gccversion='15.0.1 20250114 (Red Hat 15.0.1-0)'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='gcc'
ldflags ='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib64 /lib64 /usr/lib64 /usr/local/lib /usr/lib
libs=-lpthread -lresolv -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lresolv -ldl -lm -lcrypt -lutil -lc
libc=/lib/../lib64/libc.so.6
so=so
useshrplib=true
libperl=libperl.so
gnulibc_version='2.40.9000'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 '
cccdlflags='-fPIC'
lddlflags='-lpthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_LONG_DOUBLE
HAS_STRTOLD
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_SITECUSTOMIZE
USE_THREAD_SAFE_LOCALE
Locally applied patches:
Fedora Patch1: Removes date check, Fedora/RHEL specific
Fedora Patch2: support for libdir64
Fedora Patch3: use libresolv instead of libbind
Fedora Patch4: USE_MM_LD_RUN_PATH
Fedora Patch5: Provide MM::maybe_command independently (bug #1129443)
Fedora Patch6: Dont run one io test due to random builder failures
Fedora Patch8: Define SONAME for libperl.so
Fedora Patch9: Install libperl.so to -Dshrpdir value
Fedora Patch10: Make *DBM_File desctructors thread-safe (RT#61912)
Fedora Patch11: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)
Fedora Patch12: Link XS modules to pthread library to fix linking with -z defs
Fedora Patch13: Pass the correct CFLAGS to dtrace
Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux
Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux
Fedora Patch202: Add definition of OPTIMIZE to .ph files
Built under linux
Compiled at Jan 20 2025 00:00:00
@INC:
/usr/local/lib64/perl5/5.40
/usr/local/share/perl5/5.40
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
Metadata
Metadata
Assignees
Labels
No labels
Activity
mauke commentedon Apr 13, 2025
This looks like it's caused by a combination of gcc-15 and the
INTERFACE:XS feature.jkeenan commentedon Apr 13, 2025
Can someone who has access to
gcc-15or later on Linux build a threaded perl-5.40.1 and attempt to install Common Mark. (I can only getgcc-14.)XSUB.h: fix C23 incompatibility in XSINTERFACE_* macros
xenu commentedon Apr 13, 2025
GCC 15 hasn't been released yet. But anyway, this issue is because GCC 15 bumped the default C standard version to C23, and in C23 the meaning of an empty prototype has changed.
iabyn commentedon Apr 14, 2025
iabyn commentedon Apr 14, 2025
Leont commentedon Apr 14, 2025
That's not a good fix either, becaus vararg argument passing is not guaranteed to be the same as non-vararg argument passing. Most notably it isn't on Apple on ARM.
xenu commentedon Apr 14, 2025
Just MIME::Fast, it's commented out (with
#if 0) in Wx.Leont commentedon Apr 14, 2025
MIME::Fast looks to me like it needs to use PREFIX instead.
But also, it hasn't been updated in 20+ years (and gnome certainly hasn't been standing still in that period), and no passing entries are known on CPAN Testers. I think we can assume it's dead.
Leont commentedon Apr 14, 2025
Yeah I don't think it was possible to write a sensible
INTERFACE_MACRObefore vararg macros, but we can actually make something better now.Though I'm still not quite sure when someone would ever need this feature.
iabyn commentedon Apr 15, 2025
Leont commentedon Apr 15, 2025
That is a good point. Yeah that will be hairy.
C23 actually has a
typeofoperator, but we can't exactly require C23.Absolutely not. In the original version of C all arguments were word sized so none of this mattered, but that has long stopped being the case.
xenu commentedon Apr 15, 2025
Perhaps instead of doing this weird function-pointer-hidden-in-CV voodoo, we could generate a separate XSUB for each function listed in INTERFACE?
So basically, this:
would be equivalent to this:
(and remove INTERFACE_MACRO)
3 remaining items
Leont commentedon Apr 20, 2025
Yeah, that seems wiser than rushing a solution to a problem that's caused by a change outside of our power.
ap commentedon Apr 24, 2025
Speaking with my PSC hat on, we consider this a release blocker… for 5.44. This really needs solved but we don’t foresee the solution to be simple enough to still get into 5.42 at this late stage in the release cycle.
sisyphus commentedon Apr 25, 2025
As a workaround, can this problem be overcome by adding
-std=c17to ccflags when gcc-15 is used ?Leont commentedon Apr 25, 2025
But should we do that, or should CommonMark do that?
sisyphus commentedon Apr 26, 2025
Or .... should the user attend to that ? I don't know.
I was wondering what advice we would offer to someone who wants to install CommonMark-0.310100 on a perl that has been built using gcc-15, and c23.
I've meddled around a bit and found that if ccflags already specifies something less than c23 (as is currently the usual case on Windows), then CommonMark builds fine.
Nothing remarkable about that.
And if, on my gcc-15 build (on Windows), I remove
-std=c99from ccflags, then I hit the issue as reported by the OP.To then overcome that problem, rather than restore ccflags to its original state, I can simply rebuild CommonMark as a manual build, starting with:
Nothing remarkable about that, either. (I presume I could alternatively tweak CCFLAGS at that command line, but IIRC that gets a bit messy in the cmd.exe shell.)
Is that "manual" build the type of approach we would recommend for the time being ?
Should the current blead test suite expose this issue (FAIL or TODO ?) when it is present ?
FAIK, it might already do that. So far, all of my perl builds using gcc-15 have specified
-std=c99in ccflags, so I wouldn't be be experiencing such failures, anyway.I presently have gcc-15 on Windows 11 only.
iabyn commentedon Apr 27, 2025
sisyphus commentedon Apr 28, 2025
I don't think it's helpful in the long term to be hiding such issues under the C99 blanket.
What other issues might we be masking ?
I've pretty much decided that my own builds of perl-5.42 will be built without that "C99" wind-back - just like perl-5.38 and earlier.
I've spent most of today building and testing blead (using gcc-15.1.0) on Windows such that the C level remains at C23, and haven't yet found any additional issues at all.
But I feel that all of that would be more appropriately discussed in a separate issue/PR.
As for the "scope of the problem", it looks to me that if perl's underlying C level is at C23 && you want to call
XSFUNCTIONwith one or more arguments, then you'll come up against this issue.At least, that's about as far as I've got. (FAIRK, there could be caveats.)
XS: fix INTERFACE on strict C compilers
iabyn commentedon Aug 24, 2025
XS: fix INTERFACE on strict C compilers
Leont commentedon Aug 28, 2025
I have absolutely written complex
C_ARGS, butvoid*might just be close enough that it will work because I think they all used pointer types.XS: fix INTERFACE on strict C compilers
[MERGE] fix two XS INTERFACE keyword issues
iabyn commentedon Aug 30, 2025
Fixed by v5.43.2-85-gb81e58c28b