Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.45k stars 12.21k forks source link

imagemagick X11 error #70535

Closed gingerbeardman closed 3 years ago

gingerbeardman commented 3 years ago

brew gist-logs <formula> link OR brew config AND brew doctor output

❯ brew config
HOMEBREW_VERSION: 3.0.0-15-g214e88a
ORIGIN: https://github.com/Homebrew/brew
HEAD: 214e88aff357e9add13860a1a8c3978f710750ad
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 2dccc22c2446b01d5b730bbff46e6fc7ace30597
Core tap last commit: 68 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.r3giHSybZw/org.macosforge.xquartz:0
HOMEBREW_MAKE_JOBS: 6
HOMEBREW_NO_AUTO_UPDATE: set
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: hexa-core 64-bit kabylake
Clang: 11.0 build 1100
Git: 2.21.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
macOS: 10.14.6-x86_64
CLT: 10.3.0.0.1.1562985497
Xcode: 11.3.1
XQuartz: 2.7.11 => /opt/X11
❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  lib3mf
  scantailor

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /opt/local/bin/pkg-config
  /opt/local/bin/GraphicsMagickWand-config
  /opt/local/bin/icu-config
  /opt/local/bin/freetype-config
  /opt/local/bin/xslt-config
  /opt/local/bin/libpng16-config
  /opt/local/bin/libpng-config
  /opt/local/bin/xml2-config
  /opt/local/bin/ncursesw6-config
  /opt/local/bin/GraphicsMagick-config
  /opt/local/bin/uuid-config
  /opt/local/bin/GraphicsMagick++-config
  /opt/local/bin/pcre-config
  /opt/local/bin/ncurses6-config

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libFastCompression.1.0.dylib
  /usr/local/lib/libpng15.15.dylib
  /usr/local/lib/libsfark.dylib
  /usr/local/lib/libwkhtmltox.0.12.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/FastCompression.h
  /usr/local/include/lzvn.h
  /usr/local/include/python3.7m/greenlet/greenlet.h
  /usr/local/include/sfArkLib.h
  /usr/local/include/wkhtmltox/image.h
  /usr/local/include/wkhtmltox/pdf.h

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libFastCompression.a

What were you trying to do (and why)?

display image.png

...to get imagemagick interactive interface for manipulating an image.

What happened (include all command output)?

error

display: delegate library support not built-in '' (X11) @ error/display.c/DisplayImageCommand/1892.

full output:

❯ display in.png
Version: ImageMagick 7.0.10-52 Q16 x86_64 2020-12-20 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1) 
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps tiff webp xml zlib
Usage: display [options ...] file [ [options ...] file ...]

Image Settings:
  -alpha option        on, activate, off, deactivate, set, opaque, copy
                       transparent, extract, background, or shape
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -backdrop            display image centered on a backdrop
  -channel type        apply option to select image channels
  -colormap type       Shared or Private
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compress type       type of pixel compression when writing the image
  -define format:option
                       define one or more image format options
  -delay value         display the next image after pausing
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -display server      display image to this X server
  -dispose method      layer disposal method
  -dither method       apply error diffusion to image
  -endian type         endianness (MSB or LSB) of the image
  -filter type         use this filter when resizing an image
  -format string     output formatted image characteristics
  -geometry geometry   preferred size and location of the Image window
  -gravity type        horizontal and vertical backdrop placement
  -identify            identify the format and characteristics of the image
  -immutable           displayed image cannot be modified
  -interlace type      type of image interlacing scheme
  -interpolate method  pixel color interpolation method
  -label string        assign a label to an image
  -limit type value    pixel cache resource limit
  -loop iterations     loop images then exit
  -map type            display image using this Standard Colormap
  -matte               store matte channel if the image has one
  -monitor             monitor progress
  -nostdin             do not try to open stdin
  -page geometry       size and location of an image canvas
  -profile filename    add, delete, or apply an image profile
  -quality value       JPEG/MIFF/PNG compression level
  -quantize colorspace reduce colors in this colorspace
  -quiet               suppress all warning messages
  -regard-warnings     pay attention to warning messages
  -remote command      execute a command in an remote display process
  -repage geometry     size and location of an image canvas (operator)
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -scenes range        image scene range
  -seed value          seed a new sequence of pseudo-random numbers
  -set property value  set an image property
  -size geometry       width and height of image
  -support factor      resize support: > 1.0 is blurry, < 1.0 is sharp
  -texture filename    name of texture to tile onto the image background
  -transparent-color color
                       transparent color
  -treedepth value     color tree depth
  -update seconds      detect when image file is modified and redisplay
  -verbose             print detailed information about the image
  -visual type         display image using this visual type
  -virtual-pixel method
                       virtual pixel access method
  -window id           display image to background of this window
  -window-group id     exit program when this window id is destroyed
  -write filename      write image to a file

Image Operators:
  -auto-orient         automagically orient image
  -border geometry     surround image with a border of color
  -clip                clip along the first path from the 8BIM profile
  -clip-path id        clip along a named path from the 8BIM profile
  -colors value        preferred number of colors in the image
  -contrast            enhance or reduce the image contrast
  -crop geometry       preferred size and location of the cropped image
  -decipher filename   convert cipher pixels to plain pixels
  -deskew threshold    straighten an image
  -despeckle           reduce the speckles within an image
  -edge factor         apply a filter to detect edges in the image
  -enhance             apply a digital filter to enhance a noisy image
  -equalize            perform histogram equalization to an image
  -extent geometry     set the image size
  -extract geometry    extract area from image
  -flip                flip image in the vertical direction
  -flop                flop image in the horizontal direction
  -frame geometry      surround image with an ornamental border
  -fuzz distance       colors within this distance are considered equal
  -gamma value         level of gamma correction
  -monochrome          transform image to black and white
  -negate              replace every pixel with its complementary color
  -normalize           transform image to span the full range of colors
  -raise value         lighten/darken image edges to create a 3-D effect
  -resample geometry   change the resolution of an image
  -resize geometry     resize the image
  -roll geometry       roll an image vertically or horizontally
  -rotate degrees      apply Paeth rotation to the image
  -sample geometry     scale image with pixel sampling
  -segment value       segment an image
  -sharpen geometry    sharpen the image
  -strip               strip image of all profiles and comments
  -threshold value     threshold the image
  -thumbnail geometry  create a thumbnail of the image
  -trim                trim image edges

Image Sequence Operators:
  -coalesce            merge a sequence of images
  -flatten             flatten a sequence of images

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

In addition to those listed above, you can specify these standard X
resources as command line options:  -background, -bordercolor,
 -mattecolor, -borderwidth, -font, -foreground, -iconGeometry,
-iconic, -name, -shared-memory, -usePixmap, or -title.

By default, the image format of 'file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.

Buttons: 
  1    press to map or unmap the Command widget
  2    press and drag to magnify a region of an image
  3    press to load an image from a visual image directory
display: delegate library support not built-in '' (X11) @ error/display.c/DisplayImageCommand/1892.

What did you expect to happen?

display should open using X11 and show something like this:

display_menu

Step-by-step reproduction instructions (by running brew commands)

  1. brew install --cask xquartz
  2. brew imagemagick
  3. display image.png (specifying path to a valid and existing image)

It seems imagemagick is building in a way that makes it not run correctly with X11/xquartz on Mojave.

carlocab commented 3 years ago

This is probably because imagemagick is built using the --without-x flag:

https://github.com/Homebrew/homebrew-core/blob/ffd759cd7129cc18f657edad03e32648c9f2510f/Formula/imagemagick.rb#L79-L81

We build without X11 since [1]

Don’t build X11/XQuartz GUIs as they are a bad user experience on macOS.

[1] https://docs.brew.sh/Acceptable-Formulae#stuff-that-builds-a-gui-by-default-but-doesnt-have-to

gingerbeardman commented 3 years ago

Thanks, that would be it.

Your policy has

if the GUI is useful and would be widely used, also build the GUI.

Pros

&

Don’t build X11/XQuartz GUIs as they are a bad user experience on macOS.

Cons

As imagemagick display has no alternative, and is very useful, my thoughts are that having a "bad user experience" is preferable to the user experience being unavailable.

carlocab commented 3 years ago

It's not clear it would be widely used, though, and adding X11 support would pull in a large dependency tree.

It may be better for you to host a version of this formula with X11 support in your own tap. Here are some docs to help you get started:

https://docs.brew.sh/Taps https://docs.brew.sh/Interesting-Taps-and-Forks https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap https://brew.sh/2020/11/18/homebrew-tap-with-bottles-uploaded-to-github-releases/

gingerbeardman commented 3 years ago

But is it clear that it wouldn't be widely used?

Anyway, thanks, I'll take a look at making a tap.

carlocab commented 3 years ago

But is it clear that it wouldn't be widely used?

I actually think it's reasonably clear that it wouldn't be, given that the lack of X11 support doesn't come up too often. It does come up occasionally, though, but this is a drop in the bucket compared to its ~100,000 monthly installs.

It seems, however, that you don't need to maintain your own tap. Someone else is already doing that: https://github.com/tlk/homebrew-imagemagick-x11

You can install it with

brew install tlk/imagemagick-x11/imagemagick

That said, they really should be naming their formula something else (like, say, imagemagick-x11) to avoid the name clash with the core formula.

gingerbeardman commented 3 years ago

Thanks again.

I also just saw see this: https://github.com/Homebrew/homebrew-core/pull/66421 ...so close!