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

AVIF not installed (ImageMagick 7.1.1-35 / Ubuntu 22.04.1 LTS) #115

Open
jakobhaerter opened this issue Jul 15, 2024 · 19 comments
Open

AVIF not installed (ImageMagick 7.1.1-35 / Ubuntu 22.04.1 LTS) #115

jakobhaerter opened this issue Jul 15, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@jakobhaerter
Copy link

I installed IMEI on a Hetzner VPS to enable full AVIF support for a website. However, ImageMagick 6.9 had a bug where PNGs with transparency were converted to AVIF files with a black background.

After successfully installing ImageMagick 7.1.1, AVIF support is completely missing. Running identify -list format does not list AVIF at all. ImageMagick 6.9 still generated AVIFs.

Any help or guidance on resolving this issue is appreciated. Thanks!

@SoftCreatR SoftCreatR added the bug Something isn't working label Jul 16, 2024
@SoftCreatR
Copy link
Owner

Install libavif-dev and execute IMEI with --force to perform a forced re-install.

@MoritzLost
Copy link

@SoftCreatR Thanks for the reply! Just tested this, unfortunately it didn't work.

First I installed libavif-dev: sudo apt install libavif-dev
Then ran IMEI again with --force, which again finished successfully. But AVIF is still missing from the list of supported formats.

Weird issue, this was definitely working two weeks ago. Same server versions, same setup. We also didn't install libavif-dev. Shouldn't IMEI install the dependencies it needs, since it already does this with other required dependencies? In any case, since this still didn't work, maybe something else is going on?

@SoftCreatR
Copy link
Owner

libavif-dev is an exception because it doesn't exist in Ubuntu 20.04. However, until now, there was no need to install it, because it worked out of the box. I don't know, what has changed tbh. However, I am already evaluating a manual compilation/installation of libavif, even though I don't like the idea.

However, I've tested it on a fresh Hetzner VPS without any problems :S

@MoritzLost
Copy link

@SoftCreatR Curious – our servers are on Ubuntu 22.04.1 and it still didn't work, even after the manual installation of libavif.

Anything else we can try, or any debugging info we can provide? I don't understand the toolchain well enough to understand what's missing unfortunately.

@SoftCreatR
Copy link
Owner

You should check the log file.

@MoritzLost
Copy link

@SoftCreatR Here are the two log files from the two runs of IMEI:

imei-1721119863.log
imei-1721133125.log

The first one is from the first run before I installed libavif-dev, the second one after that.
Nothing sticks out to me that would explain the problem, but I'm also not sure what to look for.

@SoftCreatR
Copy link
Owner

From the first log:

-- Checking for module 'libavif'
--   No package 'libavif' found

From the 2nd attempt:

-- Checking for module 'libavif'
--   Found libavif, version 0.9.3

If we ignore the fact, that 0.9.3 is pretty outdated, I don't see a problem here.

@MoritzLost
Copy link

@SoftCreatR That's the version that's available through the PPA on Ubuntu 22.04 … 

Any idea why AVIF is still missing even though it found the lib?

@SoftCreatR
Copy link
Owner

Any idea why AVIF is still missing even though it found the lib?

No, because I can't reproduce that.

@MoritzLost
Copy link

@SoftCreatR Hm, I'm at a loss :/ Not sure what else to try, since everything seems to be working fine and we're not getting any errors. Any idea what else we can try to get to the bottom of this?

@s0ar
Copy link

s0ar commented Jul 18, 2024

as a workaround, using the parameter --heif-version 1.17.6 enables imagemagick with heif/heic support

from the logs:
checking for libheif >= 1.4.0... yes

(the log statement "No package 'libavif' found" was always the case for me, but having heic in the delegate library configuration lets me convert avif files)

@SoftCreatR
Copy link
Owner

Good catch. I'll try to find out, what's changed in libheif and/or AOM.

@MoritzLost
Copy link

MoritzLost commented Jul 22, 2024

@SoftCreatR @s0ar So if I'm reading this correctly, the issue might be related to the 1.18.0 release of libheif? That would definitely fit the timeline, as our problem only started after the time of this release.

@SoftCreatR
Copy link
Owner

@MoritzLost Could be, yes. So you could try

./imei.sh --force --libheif-version=1.17.6

/cc @jakobhaerter

@MoritzLost
Copy link

@SoftCreatR Thanks, we tried this and it does fix the issue!

Good to have a workaround, but of course not a permanent solution. I'm looking at the changelog of libheif, but I don't see anything that looks related to this. Not sure why the version jump would cause this issue. Any ideas?

@SoftCreatR
Copy link
Owner

Not yet.

@coleplx
Copy link

coleplx commented Sep 27, 2024

tl;dr: Remove any pre-existing libheif.so* from your system.

That's interesting. I can reproduce the issue... sometimes.

I'm not entirely sure what causes it. Maybe previous installation's leftovers. I thought it was a bug in checkinstall, but it seems Moritz is not using it.

I created two packages, one for v1.17.6 and another one for v1.18.2, and then I extracted their files using ar -x.
libheif 1.18.2

📦[coleplx@imei imei]$ ls -la /usr/local/src/
control.tar.xz                            data.tar.xz                               debian-binary                             imei-libheif_1.18.2-imei6.11.4_amd64.deb  usr/
📦[coleplx@imei imei]$ ls -la /usr/local/src/usr/local/
bin/     include/ lib/     share/   
📦[coleplx@imei imei]$ ls -la /usr/local/src/usr/local/lib/
total 4140
drwxr-xr-x. 1 root root      94 Sep 27 15:18 .
drwxr-xr-x. 1 root root      36 Sep 27 10:23 ..
drwxr-xr-x. 1 root root      14 Sep 27 11:03 cmake
-rw-r--r--. 1 root root 4237072 Sep 27 15:18 libheif.so.1.18.2
drwxr-xr-x. 1 root root      20 Sep 27 15:18 pkgconfig
drwxr-xr-x. 1 root root      28 Sep 27 15:18 x86_64-linux-gnu

libheif 1.17.6

root@ybs-customexpires-live-prod:/tmp/im7# ls -la /usr/local/src/usr/local/lib/
total 2180
drwxr-xr-x 5 root root       7 Sep 27 18:39 .
drwxr-xr-x 6 root root       6 Jul 15 15:24 ..
drwxr-xr-x 3 root root       3 Sep 25 17:19 cmake
lrwxrwxrwx 1 root root      17 Sep 25 17:26 libheif.so.1 -> libheif.so.1.17.6
-rw-r--r-- 1 root root 3924968 Sep 25 17:26 libheif.so.1.17.6
drwxr-xr-x 2 root root       3 Sep 25 17:26 pkgconfig
drwxr-xr-x 3 root root       3 Sep 25 17:26 x86_64-linux-gnu

The 1.18.2 package is missing the libheif.so.1 symlink to libheif.so.18.2. Why? I'm not entirely sure. But I reproduced this behavior a few times with v1.17.6, too. And I think it might be related to these in the logs:

/var/log/imei-1727461050.log:-- Installing: /usr/local/lib/libheif.so.1.18.2
/var/log/imei-1727461050.log:-- Up-to-date: /usr/local/lib/libheif.so.1
/var/log/imei-1727461050.log:-- Set runtime path of "/usr/local/lib/libheif.so.1.18.2" to ""
/var/log/imei-1727461050.log:-- Up-to-date: /usr/local/lib/libheif.so

The package misses libheif.so.1 everytime the log has the Up-to-date instead of Installing.
I kept the original build files around and I can confirm the issue is not on cmake or libheif itself.

Check your /usr/lib, /usr/local/lib or other relevant places for already existing libheif.so and libheif.so.1.

Removing any pre-existing libheif.so file fixed the issue here.

PS: I reinstalled all the imei packages after the last test, and heif-enc complained about a missing libheif library, and magick -list formats didn't list AVIF. Running ldconfig /usr/local/lib fixed the issue. Relogging also works.

Anyway... check your heif-enc. It might give you some clues about what's wrong:

root@ybs-customexpires-live-prod:/tmp/im7# heif-enc -v
1.18.2
libheif: 1.18.2
plugin path: /usr/local/lib/libheif

Previously:

root@ybs-customexpires-live-prod:/usr/local/lib# heif-enc 
heif-enc: error while loading shared libraries: libheif.so.1: cannot open shared object file: No such file or directory

@coleplx
Copy link

coleplx commented Oct 16, 2024

Hey @jakobhaerter

I ran into a similar issue again today. This time, it was caused by the missing libx265 and libde265 libraries.

After I installed both libraries using apt, ImageMagick started to report HEIC, HEIF, and AVIF support again.

I know at least libjxl auto-installs missing dependencies, like libhwy. Maybe libheif used to do it, too? 🤷

@SoftCreatR
Copy link
Owner

The issue is that IMEI attempts to install the packages, but it does nothing if they are already installed:

imei/imei.sh

Line 571 in 4d1c41f

PKG_LIST=(libde265-dev libx265-dev libltdl-dev libopenjp2-7-dev liblcms2-dev libbrotli-dev libzip-dev libbz2-dev liblqr-1-0-dev libzstd-dev libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev librsvg2-dev libwmf-dev libxml2-dev libxml2 libtiff-dev libraw-dev ghostscript gsfonts ffmpeg libpango1.0-dev libdjvulibre-dev libfftw3-dev libgs-dev libgraphviz-dev)

Of course, I could force a reinstall, but that doesn’t seem like the right solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants