0

On Fedora 33, I'm trying to compile ImageMagic from git.

libx265 and libheif are installed from the Fedora fusion repos, along with their -devel packages.

When running ./configure --prefix=$HOME --program-prefix=p_ I get these reports:

  HEIC              --with-heic=yes     yes
  ...
  LIBS            =  -ljbig  -ltiff -lfreetype  -lraqm -lfreetype  -ljpeg   -llqr-1 -lglib-2.0  -lpng16 -lz    -lfftw3    -lfontconfig -lfreetype  -lheif  -lwebpmux -lwebpdemux -lwebp  -lwebp    -lXext -lXt   -lSM -lICE -lX11  -llzma  -lbz2 -lIlmImf -lImath -lHalf -lIex -lIexMath -lIlmThread -pthread  -lopenjp2  -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo    -lxml2   -lz  -lz      -lm    -lpthread 
  ...
  DELEGATES       = bzlib fftw fontconfig freetype heic jbig jng jpeg lqr lzma openexr openjp2 pango png ps raqm tiff video webp x xml ziplib zlib zstd

After compiling the binary is linked to the wrong libx265.so, though:

% ./p_magick --version
./p_magick: error while loading shared libraries: libx265.so.169: cannot open shared object file: No such file or directory

ldd on the binary (p_magic in my case) reveals:

    libx265.so.169 => not found

(The compiling process is the standard ./configure, make, make install)

This is confusing to me, because libx265.so is installed:

% ll /usr/lib64/libx265*
lrwxrwxrwx 1 root root   14 08-19 03:29 /usr/lib64/libx265.so -> libx265.so.192*
-rwxr-xr-x 1 root root 4.6M 08-19 03:29 /usr/lib64/libx265.so.192*
-rwxr-xr-x 1 root root 5.6M 08-19 03:29 /usr/lib64/libx265_main10.so.192*
-rwxr-xr-x 1 root root 5.5M 08-19 03:29 /usr/lib64/libx265_main12.so.192*

For some reason, p_magick is linked to libx265.so.169 but on my system, libx265.so.192 is installed, I don't quite see how it could be linked to the wrong library, also, I'm struggling to find a mention of libx265 anywhere in the ImageMagick codebase (I've grep-ed for it, etc.).

That's why I'm pretty sure the error is not with ImageMagick, but with my system configuration, but I'm not sure where to start.


Addendum

I've deleted /etc/ld.so.cache and re-created the cache with ldconfig.

ldconfig -p shows:

# ldconfig -p | grep libx265
    libx265_main12.so.192 (libc6,x86-64) => /lib64/libx265_main12.so.192
    libx265_main10.so.192 (libc6,x86-64) => /lib64/libx265_main10.so.192
    libx265.so.192 (libc6,x86-64) => /lib64/libx265.so.192
    libx265.so (libc6,x86-64) => /lib64/libx265.so

The link inside /lib64 also seems to be correct:

# ll /lib64/libx265.so           
lrwxrwxrwx 1 root root 14 Aug 19 03:29 /lib64/libx265.so -> libx265.so.192

The error still persists, though.

polemon
  • 11,133
  • 11
  • 69
  • 111
  • Why not just `yum install ImageMagick`? – Nasir Riley Jan 02 '21 at 14:06
  • @NasirRiley that'd be `dnf install imagemagick`, but that's beside the point. I'm trying to see if I can get AVIF and FLIF support going, and do a couple experiments. This problem in itself is interesting to solve, though. – polemon Jan 02 '21 at 14:24
  • Fedora 33 has `yum` as well which is included at installation so the command that I gave does work. If you insist on compiling it, then one thing to take note of is that it's looking for `libx265.so.169` whereas you have `libx265.so.192`. Perhaps instead of installing it from from the RPM Fusion repos, it's better to compile it from source. You could also try creating a symlink for it pointing at `libx265.so.192`. – Nasir Riley Jan 02 '21 at 15:48
  • @NasirRiley I'm afraid manually symlinking is the wrong way to go about it. Also the issue is clearly a configuration issue and not an issue of manual linking adjustment. I've also checked back with the developers: https://github.com/ImageMagick/ImageMagick/discussions/2976#discussioncomment-255095 `libx265.so` is installed from repos, which is used by ImageMagick for creating the Fedora RPMs. The problem is a bodged dynamic linking, I just can't figure out where, even though I refreshed ld cache, etc. Also, ImageMagick doesn't link to `libx265.so` directly, it's linked indirectly. – polemon Jan 02 '21 at 16:09
  • Symlinking is a common way to resolve issues like this. It is looking for an earlier version than what you have and until it's there, your compilation isn't going to work. This is no different than software that requires `readline-devel 6.0`, having `7.0`, and then creating a symlink. It doesn't hurt anything on the system. You installed that package from RPM Fusion which is a third-party repo and isn't supported by Fedora. If you are against creating a symlink, then like I said, you could compile version 169 from source and prepend it to your `LD_LIBRARY_PATH`. – Nasir Riley Jan 02 '21 at 16:16
  • @NasirRiley you're entirely misunderstanding the issue. ImageMagic doens't "look for" a specific `libx265.so` version, it is linked *indirectly* through a different package completely unrelated to ImageMagick. It has nothing to do with the ImageMagick build process at all. Symlinking "jumping" versions is incredibly bad practice in the entire 22 years of me using UNIXoidal systems... It works as a bodge job, but nothing more. That the issue isn't to get ImageMagick to work, it's to solve an LD issue. – polemon Jan 02 '21 at 16:24
  • No, it isn't bad practice. It's been given as an answer here by others who have the same amount of (or more) experience than you have. It doesn't change anything on the system and only affects what is looking for it. It's bad practice to install packages from repos like RPM version that aren't supported by the system. In any regard,whether it's ImageMagick or something else, it clearly states in the error message that it's looking for a library that doesn't exist on your system. What you are trying to do isn't going to work until it's there. It's not going to link to library that isn't there. – Nasir Riley Jan 02 '21 at 17:31
  • Once again, if you are against a symlink, that's understandable. Compile the required version of `'libx265` for source and add it to your environment. That would at least rule it out. – Nasir Riley Jan 02 '21 at 17:48

0 Answers0