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

Build failure: perlPackages.ImageMagick - version/test mismatch with main imagemagick package #371857

Open
Rhys-T opened this issue Jan 7, 2025 · 4 comments
Labels
0.kind: build failure A package fails to build

Comments

@Rhys-T
Copy link

Rhys-T commented Jan 7, 2025

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix build nixpkgs\#perlPackages.ImageMagick

Build log

https://github.com/Rhys-T/nur-packages/actions/runs/12644772369/job/35232872439#step:9:1549

Build Log
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/9l45r21h9zcyfpqpal7qs4h4n4c6x9i6-Image-Magick-7.1.1-20.tar.gz
source root is Image-Magick-7.1.1
setting SOURCE_DATE_EPOCH to timestamp 1696849342 of file Image-Magick-7.1.1/META.json
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
patching ./demo/tree.pl...
patching ./demo/piddle.pl...
patching ./demo/steganography.pl...
patching ./demo/pixel-fx.pl...
patching ./demo/shapes.pl...
patching ./demo/shadow-text.pl...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./demo/compose-specials.pl...
patching ./demo/annotate.pl...
patching ./demo/button.pl...
patching ./demo/composite.pl...
patching ./demo/settings.pl...
patching ./demo/demo.pl...
patching ./demo/single-pixels.pl...
patching ./demo/lsys.pl...
patching ./demo/annotate_words.pl...
patching ./check.sh.in...
patching ./t/composite.t...
patching ./t/cgm/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/mpeg/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/setattribute.t...
patching ./t/openjp2/read.t...
patching ./t/wmf/read.t...
patching ./t/xfig/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/blob.t...
patching ./t/hdf/write.t...
patching ./t/hdf/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/getattribute.t...
patching ./t/jbig/write.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/jbig/read.t...
patching ./t/fpx/write.t...
patching ./t/fpx/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/write.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/zlib/write.t...
patching ./t/zlib/read.t...
patching ./t/hpgl/read.t...
patching ./t/png/write-16.t...
patching ./t/png/write.t...
patching ./t/png/read-16.t...
patching ./t/png/read.t...
patching ./t/montage.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/ps/write.t...
patching ./t/ps/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/ttf/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/x11/write.t...
patching ./t/x11/read.t...
/nix/store/x4255s9h2x6wzj0p4vp8p9d7z62i51y5-builder.sh: line 18: warning: command substitution: ignored null byte in input
patching ./t/jpeg/write.t...
patching ./t/jpeg/read.t...
patching ./t/jng/write.t...
patching ./t/jng/read.t...
patching ./t/bzlib/write.t...
patching ./t/bzlib/read.t...
patching ./t/filter.t...
patching ./t/read.t...
patching ./t/rad/write.t...
patching ./t/rad/read.t...
patching ./t/tiff/write.t...
patching ./t/tiff/read.t...
patching ./t/ping.t...
patching ./check.sh...
patching ./check...
Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
Warning (mostly harmless): No library found for -lm
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
no configure script, doing nothing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
build flags: SHELL=/nix/store/45a4hms3bsmk23bzn0g0qfn663izq3f8-bash-5.2p37/bin/bash
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Magick ()
chmod 644 "Magick.bs"
"/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
"/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/bin/perl" "/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/lib/perl5/5.40.0/ExtUtils/xsubpp"  -typemap '/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/lib/perl5/5.40.0/ExtUtils/typemap' -typemap '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-20.drv-0/Image-Magick-7.1.1/typemap'  Magick.xs > Magick.xsc
mv Magick.xsc Magick.c
cc -c  -I/nix/store/9wbim3jp1hip0cgs0hk41v0fbqy28n81-imagemagick-7.1.1-43-dev/include/ImageMagick -fno-common -DPERL_DARWIN -mmacosx-version-min=11.3 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I/no-such-path/include -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Wno-error=implicit-function-declaration -O3   -DVERSION=\"7.1.1\" -DXS_VERSION=\"7.1.1\"  "-I/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/lib/perl5/5.40.0/darwin-thread-multi-2level/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
rm -f blib/arch/auto/Image/Magick/Magick.bundle
cc  -L/usr/local/lib -lMagickCore-7.Q16HDRI  -mmacosx-version-min=11.3 -bundle -undefined dynamic_lookup -L/no-such-path/lib -fstack-protector-strong   Magick.o  -o blib/arch/auto/Image/Magick/Magick.bundle  \
      \
  
chmod 755 blib/arch/auto/Image/Magick/Magick.bundle
Manifying 1 pod document
Running phase: checkPhase
@nix { "action": "setPhase", "phase": "checkPhase" }
check flags: SHELL=/nix/store/45a4hms3bsmk23bzn0g0qfn663izq3f8-bash-5.2p37/bin/bash VERBOSE=y test
"/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
PERL_DL_NONLAZY=1 "/nix/store/slbc1c007g4mvdljsf32bgf6qw5aq6ks-perl-5.40.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/blob.t .......... ok   
t/composite.t ..... ok     
t/filter.t ........ ok     
t/getattribute.t .. ok     
t/montage.t ....... Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
t/montage.t ....... ok     
t/ping.t .......... ok   
t/read.t .......... 10/47 Readimage (input.pict): Exception 425: unable to uncompress image `input.pict' @ error/pict.c/ReadPICTImage/1267 at t/subroutines.pl line 317.
t/read.t .......... Failed 1/47 subtests 
t/setattribute.t .. ok     
t/write.t ......... Failed 1/32 subtests 

Test Summary Report
-------------------
t/read.t        (Wstat: 0 Tests: 47 Failed: 1)
  Failed test:  26
t/write.t       (Wstat: 0 Tests: 32 Failed: 1)
  Failed test:  15
Files=9, Tests=273,  2 wallclock secs ( 0.06 usr  0.01 sys +  1.17 cusr  0.36 csys =  1.60 CPU)
Result: FAIL
Failed 2/9 test programs. 2/273 subtests failed.
make: *** [Makefile:1043: test_dynamic] Error 255

Additional context

Happens on both macOS and Linux.

The main imagemagick package was recently updated to 7.1.1-43, which fixed a bug related to classic Macintosh PICT files, and updated the PerlMagick test file PerlMagick/t/input.pict to match. Since Nixpkgs currently still tries to build PerlMagick 7.1.1-20, it tries to use the old test file with the new ImageMagick and gets an unable to uncompress image `input.pict' error during checkPhase. Unfortunately, it looks like PerlMagick in JCRISTY's CPAN directory is still only up to 7.1.1-28, so it's not as simple as just bumping the version.

Metadata

Local system:

  • system: "x86_64-darwin"
  • host os: Darwin 19.6.0, macOS 10.15.7
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.24.10
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixpkgs

Note that I was using the current Nixpkgs flake rather than the channel. I originally ran into the issue on GitHub Actions, on both Ubuntu and macOS runners. Let me know if you need me to get nix-info -m from them.

Notify maintainers

perlPackages.ImageMagick: None listed. Most recently edited by @dotlambda in 00d3481.
imagemagick: @dotlambda @rhendric @bloxx12


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

@Rhys-T Rhys-T added the 0.kind: build failure A package fails to build label Jan 7, 2025
@dotlambda
Copy link
Member

We should probably build perlPackages.ImageMagick from the same source as imagemagick. Does anyone want to look into that?

@Rhys-T
Copy link
Author

Rhys-T commented Jan 7, 2025

I just attempted this. The Makefile.PL script doesn't exist in the main ImageMagick archive, but is instead generated from Makefile.PL.in by ./configure in the top level directory. Here's what I have so far:

  ImageMagick = buildPerlPackage rec {
    pname = "Image-Magick";
    inherit (pkgs.imagemagick) version src;
    sourceRoot = "source/PerlMagick";
    buildInputs = [ pkgs.imagemagick ];
    preConfigure =
      ''
        pushd ..
        chmod -R +rwX .
        ./configure
        popd
        sed -i -e 's|my \$INC_magick = .*|my $INC_magick = "-I${pkgs.imagemagick.dev}/include/ImageMagick";|' Makefile.PL
      '';
    meta = {
      description = "Objected-oriented Perl interface to ImageMagick. Use it to read, manipulate, or write an image or image sequence from within a Perl script";
      license = with lib.licenses; [ imagemagick ];
    };
  };

But it just gets:

[…]
configurePhase completed in 1 minutes 54 seconds
Running phase: buildPhase
build flags: SHELL=/nix/store/45a4hms3bsmk23bzn0g0qfn663izq3f8-bash-5.2p37/bin/bash
cp Magick.pm blib/lib/Image/Magick.pm
make[1]: Entering directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/default'
cp Magick.pm ../blib/lib/Image/Magick.pm
Manifying 1 pod document
make[1]: Leaving directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/default'
make[1]: Entering directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/quantum'
make[1]: *** No rule to make target 'Q16HDRI.pm', needed by 'pm_to_blib'.  Stop.
make[1]: Leaving directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/quantum'
make: *** [Makefile:540: subdirs] Error 2
error: builder for '/nix/store/sgdmy4j8r7d8mc9dmyq3ayvy36mcqzks-perl5.40.0-Image-Magick-7.1.1-43.drv' failed with exit code 2;
       last 25 log lines:
       > Please inform the author.
       > Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
       > Warning (mostly harmless): No library found for -lm
       > Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
       > Warning (mostly harmless): No library found for -lm
       > Writing MYMETA.yml and MYMETA.json
       > Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
       > Warning (mostly harmless): No library found for -lm
       > Writing MYMETA.yml and MYMETA.json
       > Generating a Unix-style Makefile
       > Writing Makefile for Image::Magick
       > Writing MYMETA.yml and MYMETA.json
       > no configure script, doing nothing
       > configurePhase completed in 1 minutes 54 seconds
       > Running phase: buildPhase
       > build flags: SHELL=/nix/store/45a4hms3bsmk23bzn0g0qfn663izq3f8-bash-5.2p37/bin/bash
       > cp Magick.pm blib/lib/Image/Magick.pm
       > make[1]: Entering directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/default'
       > cp Magick.pm ../blib/lib/Image/Magick.pm
       > Manifying 1 pod document
       > make[1]: Leaving directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/default'
       > make[1]: Entering directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/quantum'
       > make[1]: *** No rule to make target 'Q16HDRI.pm', needed by 'pm_to_blib'.  Stop.
       > make[1]: Leaving directory '/private/tmp/nix-build-perl5.40.0-Image-Magick-7.1.1-43.drv-1/source/PerlMagick/quantum'
       > make: *** [Makefile:540: subdirs] Error 2
       For full logs, run 'nix-store -l /nix/store/sgdmy4j8r7d8mc9dmyq3ayvy36mcqzks-perl5.40.0-Image-Magick-7.1.1-43.drv'.

The Q16HDRI.pm module it's referring to doesn't even seem to exist in the official PerlMagick tarballs (which apparently are here, but even that only goes up to 7.1.1-38). Unfortunately, I'm not familiar enough with either Perl packaging or ImageMagick to know what to try next. (Does anyone know how the official tarballs are generated? I couldn't find a script for it in the ImageMagick repo.)

@wentasah
Copy link
Contributor

wentasah commented Jan 8, 2025

It turns out, that Q16HDRI.pm is generated from quantum.pm by make. I was able to compile the module with the following expression:

  ImageMagick = buildPerlPackage rec {
    pname = "Image-Magick";
    inherit (pkgs.imagemagick) version src;
    sourceRoot = "${src.name}/PerlMagick";
    buildInputs = [ pkgs.imagemagick ];
    preConfigure =
      ''
        pushd ..
        chmod -R +rwX .
        ./configure --with-perl
        make perl-quantum-sources
        popd
      '';
    meta = {
      description = "Objected-oriented Perl interface to ImageMagick. Use it to read, manipulate, or write an image or image sequence from within a Perl script";
      license = with lib.licenses; [ imagemagick ];
    };
  };

@Rhys-T Do you want to prepare a PR with it?

@Rhys-T
Copy link
Author

Rhys-T commented Jan 8, 2025

One thing I'm still working on figuring out is whether we need to pass any of the configureFlags from imagemagick and/or the generic configurePhase. Would any of them have any effect on the PerlMagick part? Or does it get all the info it needs from the ImageMagick libraries at runtime?

On a possibly related note:

sed -i -e 's|my \$INC_magick = .*|my $INC_magick = "-I${pkgs.imagemagick.dev}/include/ImageMagick";|' Makefile.PL

was from the current derivation. I guess it probably isn't strictly needed, since the headers in src will always be the same version as in imagemagick now. I had left it just to be on the safe side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

3 participants