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

Error: magicksave: libMagick error: NoEncodeDelegateForThisImageFormat `gif' #2402

Closed
cthorner opened this issue Oct 6, 2020 · 5 comments
Closed

Comments

@cthorner
Copy link

cthorner commented Oct 6, 2020

Did you see the documentation relating to installation?

Yes

Have you ensured the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime?

Yes

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

Custom build

If you are installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?

build/lin.sh

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

N/A

What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

N/A

What is the output of running npx envinfo --binaries --system?

npx envinfo --binaries --system
npx: installed 1 in 1.352s

System:
OS: Linux 4.19 Amazon Linux 2
CPU: (4) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 1.08 GB / 1.94 GB
Container: Yes
Shell: 4.2.46 - /bin/bash
Binaries:
Node: 10.21.0 - /var/lang/bin/node
npm: 6.14.4 - /var/lang/bin/npm

ISSUE

I'm trying to use the new gif animation functionality and it is failing for GIFs. It is working great for WEBP.

The error (looks like a libmagick error) is:

Error: magicksave: libMagick error: NoEncodeDelegateForThisImageFormat `gif'

Here is what I'm using to install libmagcik

mkdir ${DEPS}/imagemagick
cd ${DEPS}/imagemagick
curl -O https://imagemagick.org/download/ImageMagick.tar.gz
tar xzf ImageMagick.tar.gz
rm ImageMagick.tar.gz

./configure \
  LDFLAGS=${LDFLAGS/\$/} \
  --host=${CHOST} \
  --prefix=${TARGET} \
  --disable-static --enable-shared \
  --with-modules \
  --without-bzlib \
  --without-dps \
  --without-freetype \
  --without-jbig \
  --without-jpeg \
  --without-jp2 \
  --without-lcms \
  --without-lzma \
  --without-png \
  --without-tiff \
  --without-wmf \
  --without-xml \
  --without-zlib \
  --without-perl \
  --with-webp \
  --without-x \
  --without-magick-plus-plus \
  --enable-delegate-build \
  --disable-dependency-tracking \
  --disable-docs \
  --disable-openmp \
  --disable-installed

make install-strip

I have libMagickCore-7.Q16HDRI.so.7 and libgif.so.7 in my vendors/8.10.1/lib directory, but I noticed at the end of the libmagick build I get:

Libraries have been installed in:
   /target/lib/ImageMagick-7.0.10/modules-Q16HDRI/coders

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

I'm getting that libmagick is compiled with GIF:
GIF* GIF rw+ CompuServe graphics interchange format
GIF87* GIF rw- CompuServe graphics interchange format (version 87a)

but those "coders" (are these the plugins libmagick refers to?) are nowhere to be seen in the final bundle unless they are par of libMagickCore-7.Q16HDRI.so.7.

For VIPS I'm getting:

checking for giflib... libraries -lgif, headers in default path
...
file import/export with giflib:		yes (found by search)

My question is:

Do I need to manually copy those "coders" in my build script? Or use copydeps in the build/lin.sh script?

@cthorner
Copy link
Author

cthorner commented Oct 7, 2020

I tried using copydeps for the libMagickCore-7.Q16HDRI.so.7 and copied over the ImageMagick folder in lib to lib-filtered like we do with glib2, but it did not help. Not sure what to try next.

@lovell
Copy link
Owner

lovell commented Oct 7, 2020

If you've made additions to https://github.com/lovell/sharp-libvips/blob/master/build/lin.sh then please provide the complete modification, perhaps as a forked repo/branch.

My best guess would be that you need to make the following changes:

- --disable-static --enable-shared --with-modules
+ --enable-static --disable-shared --without-modules

@cthorner
Copy link
Author

cthorner commented Oct 7, 2020

Thanks! Hopefully that's it!

I was following this: #2012 (comment) but having issues with the LDFLAGS, so I think in my journey down the rabbit hole I must have changed those settings. I posted a question about it in #2012 as well a while back, but didn't get very specific so I figured I'd create a new question for it.

I need to get better at my copy/pasta. Btw, love this project! I'll post back if it works.

@cthorner
Copy link
Author

cthorner commented Oct 7, 2020

It worked! It's slow, but it works. I think this is back to where I started, so now I don't know what I did wrong the first time. 🤷 GIFs are so much fun. Thanks for the help!

@cthorner cthorner closed this as completed Oct 7, 2020
@daniele-pelagatti
Copy link

daniele-pelagatti commented Oct 18, 2020

@cthorner mind if I ask you the complete lin.sh you used? or at least the portion of the file you modified? I'm trying to compile a version with gif support and I'm getting the same error you got in the title

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

No branches or pull requests

3 participants