Bug 194949

Summary: Many ports expect libMagickCore-6.Q16.so, yet graphics/ImageMagick may provide libMagickCore-6.Q16HDRI.so
Product: Ports & Packages Reporter: Trond Endrestøl <Trond.Endrestol>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Some People CC: ashish, beastie, freebsd-2024, kwm, martin.dieringer, mi, nox, portmgr
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Trond Endrestøl 2014-11-11 21:10:08 UTC
I'm not sure whether this bug belongs to editors/emacs or to graphics/ImageMagick.

editors/emacs expects libMagickCore-6.Q16.so, yet graphics/ImageMagick provides libMagickCore-6.Q16HDRI.so.

editors/emacs should alter its expectations, or,
graphics/ImageMagick should provide libMagickCore-6.Q16.so as a symlink to libMagickCore-6.Q16HDRI.so, or,
graphics/ImageMagick should in addition provide the correct libMagickCore-6.Q16.* libraries.

A possible workaround:

ln -s libMagickCore-6.Q16HDRI.so /usr/local/lib/libMagickCore-6.Q16.so
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-11-11 21:10:08 UTC
Maintainers CC'd
Comment 2 Koop Mast freebsd_committer freebsd_triage 2014-11-11 21:23:35 UTC
You have the HDRI option enabled. This option is only half supported. Do you need this option?
Comment 3 Trond Endrestøl 2014-11-12 05:59:20 UTC
(In reply to Koop Mast from comment #2)
> You have the HDRI option enabled. This option is only half supported. Do you
> need this option?

Probably not. I'll turn the option off and then we'll see what happens. Thanks for the tip.
Comment 4 martin.dieringer 2014-11-20 10:39:21 UTC
"This option is only half supported" (HDRI) What does that mean? By ImageMagick or emacs?
Comment 5 Trond Endrestøl 2014-11-20 12:57:26 UTC
(In reply to martin.dieringer from comment #4)
> "This option is only half supported" (HDRI) What does that mean? By
> ImageMagick or emacs?

Read the extended help message shown by dialog4ports when configuring graphics/ImageMagick, by enabling HDRI you also cause the ImageMagick libraries to change names, or actually change their suffix.

editors/emacs OTOH always looks out for libMagickCore-6.Q16.so to establish whether graphics/ImageMagick is installed or not. That test fails miserably if the user, like me in this case, have chosen to enable HDRI, thus resulting in libraries named libMagickCore-6.Q16HDRI.so, etc.

Currently editors/emacs is dying with segmentation fault while trying to bytecompile image.el using temacs.

It's probably due to my configuration. Maybe I should create another PR for this specific problem.
Comment 6 martin.dieringer 2014-11-20 13:13:19 UTC
I used your workaround and emacs24 seems to run fine. It compiled image.el when installing I guess
Comment 7 Trond Endrestøl 2014-11-22 15:41:58 UTC
(In reply to martin.dieringer from comment #6)
> I used your workaround and emacs24 seems to run fine. It compiled image.el
> when installing I guess

I narrowed it down to the LTO option. The bug with image.el is either caused by the LTO option alone or when used in combination with:

GIF
GNUTLS
JPEG
M17N
MAGICK
OTF
PNG
SCROLLBARS
SOURCES
SVG
TIFF
X11
XFT
XIM
XML
XPM

and

GTK2
Comment 8 Trond Endrestøl 2014-11-22 16:17:26 UTC
(In reply to Trond.Endrestol from comment #7)
> (In reply to martin.dieringer from comment #6)
> > I used your workaround and emacs24 seems to run fine. It compiled image.el
> > when installing I guess
> 
> I narrowed it down to the LTO option. The bug with image.el is either caused
> by the LTO option alone or when used in combination with:
> 
> GIF
> GNUTLS
> JPEG
> M17N
> MAGICK
> OTF
> PNG
> SCROLLBARS
> SOURCES
> SVG
> TIFF
> X11
> XFT
> XIM
> XML
> XPM
> 
> and
> 
> GTK2

The LTO option is fine on its own.

It looks like the options LTO and MAGICK are somehow mutually exclusive, at least on my systems.
Comment 9 martin.dieringer 2014-11-22 16:42:53 UTC
Maybe, I have MAGICK but not LTO enabled
Comment 10 Mark Linimon freebsd_committer freebsd_triage 2014-11-23 07:41:29 UTC
Over to maintainer.
Comment 11 martin.dieringer 2014-11-26 02:01:41 UTC
deskutils/calibre has the same problem, but also with libMagickWand-6.Q16.so
Comment 12 Mikhail T. 2014-12-10 02:02:21 UTC
The same problem exists with multimedia/xine (maintainer CC-ed). It too is too specific in its LIB_DEPENDS line. The simple patch is thus:

Index: Makefile
===================================================================
--- Makefile    (revision 374305)
+++ Makefile    (working copy)
@@ -157,7 +157,7 @@
 .endif
 
 .if ${PORT_OPTIONS:MIMAGEMAGICK}
-LIB_DEPENDS+=  libMagickWand-6.Q16.so:${PORTSDIR}/graphics/ImageMagick
+LIB_DEPENDS+=  libMagickWand-*.so:${PORTSDIR}/graphics/ImageMagick
 PLIST_SUB+=    WITH_IMAGEMAGICK=""
 .else
 PLIST_SUB+=    WITH_IMAGEMAGICK="@comment "

There may be a need for a tree-wide replacement in the above spirit...
Comment 13 Lawrence Chen 2015-01-17 04:59:53 UTC
I just ran into this problem as well with deskutils/calibre.

The question is ...both 16BIT_PIXEL and HDRI are listed as Half supported options.  But, 16BIT_PIXEL is in OPTIONS_DEFAULT while HDRI is not.

So the name changes depending on which of these two options are set or not.

16BIT_PIXEL     HDRI
-----------     ----
X               -               libMagicWand-6.Q16.so
X               X               libMagicWand-6.Q16HDRI.so
-               -               libMagicWand-6.Q8.so
-               X               libMagicWand-6.Q8HDRI.so

So, before the Makefile was patched to be 'libMagicWand-6.Q16.so:...' it was 'libMagicWand-6.Q*.so' which seems it should handle all 4 cases.

So, is there a way to handle all 4, or would we go to removing the options and making Q16 (16BIT_PIXEL) the only combination of 'Half supported options' (sic) imposed on us.
Comment 14 Mikhail Teterin freebsd_committer freebsd_triage 2015-01-17 05:29:10 UTC
Portmgr! This problem should, really be solved tree-wide, rather than piecemeal for each port. ImageMagick installs libraries under different names depending on how it is configured at build-time. Various ports LIB_DEPEND-ing on it should be corrected as follows:

-LIB_DEPENDS=   libMagickWand-6.Q16.so:${PORTSDIR}/graphics/ImageMagick \
+LIB_DEPENDS=   libMagickWand-*.Q*.so:${PORTSDIR}/graphics/ImageMagick \

A more ambitious effort would involve creating a Mk/Uses/magick.mk -- which would also handle the ImageMagick vs. GraphicsMagick situations automatically. But that may be too much work for the immediate problem at hand.
Comment 15 commit-hook freebsd_committer freebsd_triage 2015-01-18 21:13:28 UTC
A commit references this bug:

Author: kwm
Date: Sun Jan 18 21:12:55 UTC 2015
New revision: 377347
URL: https://svnweb.freebsd.org/changeset/ports/377347

Log:
  Update ImageMagick to 6.9.0.4.

  - Normalize the ImageMagick library name so it stays the same regardless of
    what the 16-bit and HDRI option are set to [1]. Teach cmake to look for
    the new name. Bump ports that link to the libraries due to this.
  - As a result do away with the "HALFSUPPORTED" option block, and list
    16-bit and HDRI with the other options.
  - ImageMagick ships a basic SVG plugin when not using librsvg2 for SVG
    support. This basic SVG plugin needs libxml2 to work [2]. Make libxml2
    a mandatory dependency (instead of only when the SVG option was selected).
  - Don't touch .keep files in the modules directory, there files there so
    it useless.

  PR:		194949 [1]
  PR:		195227 [2]
  Requested by:	many [1]
  Submitted by:	software-freebsd@interfasys.ch [2]

Changes:
  head/audio/mp3plot/Makefile
  head/databases/virtuoso/Makefile
  head/deskutils/calibre/Makefile
  head/devel/cmake/files/patch-Modules_FindImageMagick.cmake
  head/devel/cmake-modules/Makefile
  head/devel/synfig/Makefile
  head/editors/emacs/Makefile
  head/editors/emacs-devel/Makefile
  head/graphics/ImageMagick/Makefile
  head/graphics/ImageMagick/distinfo
  head/graphics/ImageMagick/files/patch-coders_palm.c
  head/graphics/ImageMagick/files/patch-coders_rle.c
  head/graphics/ImageMagick/files/patch-configure
  head/graphics/ImageMagick/files/patch-magick_distribute-cache.c
  head/graphics/ImageMagick/pkg-plist
  head/graphics/autotrace/Makefile
  head/graphics/converseen/Makefile
  head/graphics/cuneiform/Makefile
  head/graphics/dcraw-m/Makefile
  head/graphics/fpc-imagemagick/Makefile
  head/graphics/gimp-gmic-plugin/Makefile
  head/graphics/gscan2pdf/Makefile
  head/graphics/inkscape/Makefile
  head/graphics/kipi-plugin-videoslideshow/Makefile
  head/graphics/libdmtx/Makefile
  head/graphics/npretty/Makefile
  head/graphics/opendx/Makefile
  head/graphics/p5-Image-Magick-Iterator/Makefile
  head/graphics/pecl-imagick/Makefile
  head/graphics/pfstools/Makefile
  head/graphics/php-magickwand/Makefile
  head/graphics/pstoedit/Makefile
  head/graphics/py-wand/Makefile
  head/graphics/reallyslick/Makefile
  head/graphics/rubygem-rmagick/Makefile
  head/graphics/zbar/Makefile
  head/multimedia/dvdauthor/Makefile
  head/multimedia/libxine/Makefile
  head/multimedia/transcode/Makefile
  head/security/libfprint/Makefile
  head/www/WebMagick/Makefile
  head/www/tengine/Makefile
  head/x11/xlockmore/Makefile
  head/x11-wm/libwraster/Makefile
  head/x11-wm/windowmaker/Makefile