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 GCC 15 #7

Closed
sebastic opened this issue Feb 18, 2025 · 10 comments
Closed

Fails to build with GCC 15 #7

sebastic opened this issue Feb 18, 2025 · 10 comments

Comments

@sebastic
Copy link

As reported in Debian Bug #1097248:

The full build log can be found at:
http://qa-logs.debian.net/2025/02/16/amd64exp/libpdl-io-hdf5-perl_0.761-1_unstable_gccexp.log.gz
The last lines of the build log are at the end of this report.

To build with GCC 15, either set CC=gcc-15 CXX=g++-15 explicitly,
or install the gcc, g++, gfortran, ... packages from experimental.

apt-get -t=experimental install g++  

GCC 15 now defaults to the C23/C++23 standards, exposing many FTBFS.
Other common build failures are new warnings resulting in build failures
with -Werror turned on, or new/dropped symbols in Debian symbols files.
For other C/C++ related build failures see the porting guide at
http://gcc.gnu.org/gcc-15/porting_to.html

[...]
make[1]: Entering directory '/build/reproducible-path/libpdl-io-hdf5-perl-0.761'
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- HDF5.bs blib/arch/auto/PDL/IO/HDF5/HDF5.bs 644
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/attribPDL.t ...
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/file.t ........
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/group.t .......
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/reference.t ...
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/total.t .......
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/unlink.t ......
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/vlenString.t ..
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)
t/xData.t .......
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run

Test Summary Report
-------------------
t/attribPDL.t (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/file.t      (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/group.t     (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/reference.t (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/total.t     (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/unlink.t    (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/vlenString.t (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/xData.t     (Wstat: 256 (exited 1) Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
Files=8, Tests=0,  1 wallclock secs ( 0.06 usr  0.02 sys +  0.95 cusr  0.18 csys =  1.21 CPU)
Result: FAIL
Failed 8/8 test programs. 0/0 subtests failed.
make[1]: *** [Makefile:1065: test_dynamic] Error 1
make[1]: Leaving directory '/build/reproducible-path/libpdl-io-hdf5-perl-0.761'
dh_auto_test: error: make -j8 test TEST_VERBOSE=1 returned exit code 2
make: *** [debian/rules:15: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
@mohawk2
Copy link
Member

mohawk2 commented Feb 18, 2025

Thanks for the report. The message says "lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)" - what is PDL and/or PDL::IO::HDF5 supposed to do about this? It looks like the build environment is broken.

@sebastic
Copy link
Author

The GCC change likely affects PDL::PP, because the build succeeds with GCC 14. After upgrading GCC to 15 the build fails with no changes in Perl or PDL.

@mohawk2
Copy link
Member

mohawk2 commented Feb 19, 2025

I will copy-paste the same part of the log again: "lib/PDL/PP.pm: loadable library and perl binaries are mismatched (got first handshake key 0xf200080, needed 0xeb80080)".

Can you confirm the perl -V of the Perl that is being run there, and that it was compiled with the same GCC that PDL was? This build/test (of a PDL-depending module) relies (to state the obvious) on both Perl, and PDL, and those two have to match.

@sebastic
Copy link
Author

Perl and PDL were not built with GCC 15 obviously:

# perl -V | grep gccversion
    gccversion='14.2.0'
# pdl -V | grep gccversion
    gccversion='14.2.0'

Is the conclusion then that perl, pdl, and libpdl-io-hdf5-perl all need to be built with the same GCC version?

@mohawk2
Copy link
Member

mohawk2 commented Feb 19, 2025

Is the conclusion then that perl, pdl, and libpdl-io-hdf5-perl all need to be built with the same GCC version?

It's my surmise that's the case, yes. If so, that will mean GCC 14 -> 15 will have ABI break implications for transitioning.

@sebastic
Copy link
Author

Niko Tyni in the Debian bugreport:

This is specific to libpdl-io-hdf5-perl and libpdl-netcdf-perl, not a
wider issue. It is caused by them adding -Dbool=int to the build flags.
I doubt it would work even if perl, pdl, and libpdl-io-hdf5-perl were
all built with GCC 15 (but I didn't bother to try.)

The Perl headers #include <stdbool.h> if available, which is the case
on Debian. This system header #defines bool only on C17 and lower, as
it has become a keyword of its own on C23. GCC 15 changes the default
C language version from C17 to C23.

The combined effect is that for C17 (gcc -std=gnu17, default on GCC 14)
the stdbool.h definition overrides the -Dbool=int command line definition,
rendering it harmless (if nonsensical). But for C23 (gcc -std=gnu23,
default on GCC 15) -Dbool=int actually changes the bool size, breaking
the XS module interface.

My suggestion is to remove the -Dbool=int fiddling from the respective
Makefile.PL files, at least on Debian. The PDL-NetCDF git history suggests
that it was added to fix a build problem on Red Hat Linux 5.2 with perl
5.00404, so presumably 1998 or so.

@mohawk2
Copy link
Member

mohawk2 commented Feb 21, 2025

That makes sense. Are you content to make a patch just removing that bit of the Makefile.PL?

@sebastic
Copy link
Author

Confirmed fixed with this patch:

Description: Don't set -Dbool=int to fix FTFBS with GCC 15.
Author: Bas Couwenberg <[email protected]>
Bug: https://github.com/PDLPorters/pdl-io-hdf5/issues/7
Bug-Debian: https://bugs.debian.org/1097248

--- a/Makefile.PL
+++ b/Makefile.PL
@@ -94,15 +94,6 @@ if( -e "$hdf5_include_path/H5config.h"){
        }
 }
 
-# The following code was originally in the PDL::netCDF Makefile.PL
-#  (Not sure if it is really needed here)
-# Check if compiled under gcc/Linux.  In which case, define bool for the compiler
-my $define_bool = '';
-if ($Config{'osname'} =~ /linux/) {
-  $define_bool = '-Dbool=int';
-  print "Defining bool=int (linux seems to need this)\n";
-}
-
 #If in win32, add the required defined for the HDF5 libs to work:
 my $define_win32HDF = '';
 if ($Config{'osname'} =~ /win32/i) {
@@ -176,7 +167,7 @@ my $preop = '$(PERL) -I$(INST_ARCHLIB) -
 
 WriteMakefile(
   'NAME'            => 'PDL::IO::HDF5',
-  'CCFLAGS'      => "$Config{ccflags} $define_bool $define_win32HDF -DH5_USE_16_API -g",
+  'CCFLAGS'      => "$Config{ccflags} $define_win32HDF -DH5_USE_16_API -g",
   'CONFIGURE_REQUIRES' => { PDL => '2.004' },
   'BUILD_REQUIRES'     => { PDL => '2.004' },
    # 'TEST_REQUIRES'      => { PDL => '2.004' },

@mohawk2
Copy link
Member

mohawk2 commented Feb 22, 2025

Done similar here. Could you try it as a patch and if it works, close this?

@sebastic
Copy link
Author

The changes from #8 are already included in the Debian package, those are the same as in edbfe8d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants