2.81: test suite fails
+ cd GD-2.81
+ /usr/bin/make -O -j48 V=1 VERBOSE=1 test TEST_VERBOSE=1
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- GD.bs blib/arch/auto/GD/GD.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
t/autodetect.t ............
1..12
ok 1 - use GD;
ok 2 - gif detected
ok 3 # skip No PNG support
ok 4 # skip No JPEG support
ok 5 # skip No TIFF support
ok 6 # skip No AVIF support
ok 7 # skip No HEIF support
ok 8 # skip No WEBP support
ok 9 - wbmp detected
ok 10 - bmp detected
ok 11 # skip No XPM support
ok 12 - xbm detected
ok
t/caller.t ................
ok 1 # skip No PNG support
ok 2 - no warnings
1..2
ok
t/fork.t .................. skipped: Test::Fork required
# Testing gd 2.3.3 using png support.
# Failed test 'unable to generate comparison image for test 1 with png: Can't locate object method "newFromPng" via package "GD::Image" at (eval 17) line 1.
# '
# at t/GD.t line 271.
Can't locate object method "newFromPng" via package "GD::Image" at t/GD.t line 82.
# Looks like your test exited with 255 just after 3.
t/GD.t ....................
1..15
ok 1 - use GD;
ok 2 - use GD::Simple;
not ok 3 - unable to generate comparison image for test 1 with png: Can't locate object method "newFromPng" via package "GD::Image" at (eval 17) line 1.
#
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 13/15 subtests
t/HSV.t ...................
1..1
ok 1
ok
t/Polyline.t ..............
1..1
# Running under perl version 5.038002 for linux
# Current time local: Sat May 4 22:25:26 2024
# Current time GMT: Sat May 4 22:25:26 2024
# Using Test.pm version 1.31
ok 1
ok
t/transp.t ................
1..12
ok 1 - use GD;
ok 2 - image is not transparent
ok 3 - transparency preserves RGB before 0
ok 4 - transparency preserves RGB after
ok 5 # skip No JPEG support
ok 6 # skip No JPEG support
ok 7 # skip No JPEG support
ok 8 # skip No JPEG support
ok 9 # skip No JPEG support
ok 10 # skip No JPEG support
ok 11 # skip No JPEG support
ok 12 # skip No JPEG support
ok
t/windows_bmp.t ...........
1..4
ok 1 - use GD;
ok 2 - windows bmp does not return undef
ok 3 - windows bmp has width 2
ok 4 - windows bmp has height 2
ok
t/z_kwalitee.t ............ skipped: No RELEASE_TESTING
t/z_manifest.t ............ skipped: requires a git checkout and a unix for git and diff
t/z_pod-spell-mistakes.t .. skipped: No RELEASE_TESTING
t/z_pod.t ................. skipped: No RELEASE_TESTING
Test Summary Report
-------------------
t/GD.t (Wstat: 65280 Tests: 3 Failed: 1)
Failed test: 3
Non-zero exit status: 255
Parse errors: Bad plan. You planned 15 tests but ran 3.
Files=12, Tests=35, 1 wallclock secs ( 0.07 usr 0.04 sys + 0.76 cusr 0.18 csys = 1.05 CPU)
Result: FAIL
Failed 1/12 test programs. 1/35 subtests failed.
make: *** [Makefile:1034: test_dynamic] Error 255
Using GD without png support doesn't really sound realistic, because that's the baseline. I would rather reject installing such a crippled lib.
If you really want it without png, you need to force install it
Issue only is that libgd has PNG and JPEG support.
[tkloczko@pers-jacek SPECS]$ objdump -x /usr/lib64/libgd.so |grep NEED
NEEDED libm.so.6
NEEDED libz.so.1
NEEDED libpng16.so.16
NEEDED libfontconfig.so.1
NEEDED libfreetype.so.6
NEEDED libjpeg.so.62
NEEDED libimagequant.so.0
NEEDED libXpm.so.4
NEEDED libtiff.so.6
NEEDED libwebp.so.7
NEEDED libc.so.6
VERNEED 0x0000000000005498
VERNEEDNUM 0x0000000000000005
So your .config.cache is missing -DHAVE_PNG.
- You might have answered no to "Build PNG support?"
- Or your gdlib.pc pkg-config Requires.private has not libpng but some other string, like libpng16.
- Or your gdlib.pc was not found at all.
the 2nd problem would be fixed with this patch:
diff --git Makefile.PL Makefile.PL
index 1a49438..1fe5e2e 100644
--- Makefile.PL
+++ Makefile.PL
@@ -592,7 +592,7 @@ sub try_to_autoconfigure {
print STDERR "$pc: $private\n";
$features = 'GD_GIF GD_OPENPOLYGON';
$features .= ' GD_ZLIB' if $private =~ / zlib /;
- $features .= ' GD_PNG' if $private =~ / libpng /;
+ $features .= ' GD_PNG' if $private =~ /png/;
$features .= ' GD_FREETYPE' if $private =~ / f
Requires.private is only for STATIC LINKING.
From https://people.freedesktop.org/~dbn/pkg-config-guide.html
Since pkg-config always exposes the link flags of the Requires libraries, these modules will become direct dependencies of the program. On the other hand, libraries from Requires.private will only be included when static linking. For this reason, it is usually only appropriate to add modules from the same package in Requires.
Requires.privateis only for STATIC LINKING.
I know, but there is no other way than nm or objdump or probing to check the used deps. And not many platforms do have the binutils.
Why not just call exact ABI routine to make PNG/JPEG operation instead? 🤔
Because will fail then at runtime, with the documentation saying it is supported.
The best way is to probe on install, if libgd can use this feature. And use https://rt.cpan.org/Ticket/Display.html?id=107210 Devel::CheckLib to fail early