johnhcc / homebrew-gs-x11

Ghostscript and GV with X11 for MacOS and Linux
BSD 2-Clause "Simplified" License
5 stars 1 forks source link

no x11 device available #5

Closed schplurtz closed 10 months ago

schplurtz commented 11 months ago

Hi, on macos ventura 13.6.1 intel (that mac does not support macos 14) there is no x11 device at all.

I installed with

brew install johnhcc/gs-x11/ghostscript-x11

It took a few minutes to install. Then, when I launch $(brew --prefix)/opt/ghostscript-x11/bin/gs -h gs does not list any x11 device. Here is the relevant part of the output (full result at the end)

   stcolor t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc
   tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw
   tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4 tiffscaled8
   tiffsep tiffsep1 txtwrite uniprint xcf xes xpswrite
Search path:

So no X11. I expected to see some x11 devices such as x11, x11alpha and the like. These are present on a Linux box:

   tiffg32d tiffg4 tiffgray tifflzw tiffpack tiffscaled tiffscaled24
   tiffscaled32 tiffscaled4 tiffscaled8 tiffsep tiffsep1 txtwrite uniprint
   x11 x11alpha x11cmyk x11cmyk2 x11cmyk4 x11cmyk8 x11gray2 x11gray4 x11mono
   xcf xcfcmyk xes xpswrite

Also, running $(brew --prefix)/opt/ghostscript-x11/bin/gs does not open any X11 window.


full result of $(brew --prefix)/opt/ghostscript-x11/bin/gs -h:

GPL Ghostscript 9.56.1 (2022-04-04)
Copyright (C) 2022 Artifex Software, Inc.  All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
 -dNOPAUSE           no pause after page   | -q       `quiet', fewer messages
 -g<width>x<height>  page size in pixels   | -r<res>  pixels/inch resolution
 -sDEVICE=<devname>  select device         | -dBATCH  exit after last file
 -sOutputFile=<file> select output file: - for stdout, |command for pipe,
                                         embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: bbox
Available devices:
   alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
   atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
   bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
   bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500
   cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cdnj500 cfax
   chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl declj250 deskjet
   devicen dfaxhigh dfaxlow display dj505j djet500 djet500c dl2100 dnj650c
   docxwrite epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900
   epl6100 epl6200 eplcolor eplmono eps2write eps9high eps9mid epson epsonc
   escp escpage faxg3 faxg32d faxg4 fmlbp fmpr fpng fs600 gdi hl1240 hl1250
   hl7x0 hocr hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c
   hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c
   hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus
   hpdjportable ibmpro ijs imagen inferno ink_cov inkcov itk24i itk38 iwhi
   iwlo iwlq jetp3852 jj100 jpeg jpegcmyk jpeggray la50 la70 la75 la75plus
   laserjet lbp310 lbp320 lbp8 lex2050 lex3200 lex5700 lex7000 lips2p lips3
   lips4 lips4v lj250 lj3100sw lj4dith lj4dithp lj5gray lj5mono ljet2p ljet3
   ljet3d ljet4 ljet4d ljet4pjl ljetplus ln03 lp1800 lp1900 lp2000 lp2200
   lp2400 lp2500 lp2563 lp3000c lp7500 lp7700 lp7900 lp8000 lp8000c lp8100
   lp8200c lp8300c lp8300f lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c
   lp8900 lp9000b lp9000c lp9100 lp9200b lp9200c lp9300 lp9400 lp9500c
   lp9600 lp9600s lp9800c lps4500 lps6500 lq850 lxm3200 lxm5700m m8510
   md1xMono md2k md50Eco md50Mono md5k mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8
   mgrmono miff24 mj500c mj6000c mj700v2c mj8000c ml600 necp6 npdl nullpage
   oce9050 ocr oki182 oki4w okiibm oprp opvp paintjet pam pamcmyk32 pamcmyk4
   pbm pbmraw pcl3 pclm pclm8 pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono
   pdfimage24 pdfimage32 pdfimage8 pdfocr24 pdfocr32 pdfocr8 pdfwrite
   pdfwrite pdfwrite pgm pgmraw pgnm pgnmraw photoex picty180 pj pjetxl pjxl
   pjxl300 pkm pkmraw pksm pksmraw plan plan9bm planc plang plank planm plib
   plibc plibg plibk plibm png16 png16m png256 png48 pngalpha pnggray
   pngmono pngmonod pnm pnmraw ppm ppmraw pr1000 pr1000_4 pr150 pr201
   ps2write psdcmyk psdcmyk16 psdcmykog psdcmyktags psdcmyktags16 psdrgb
   psdrgb16 pxlcolor pxlmono r4081 rinkj rpdl samsunggdi sj48 spotcmyk st800
   stcolor t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc
   tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw
   tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4 tiffscaled8
   tiffsep tiffsep1 txtwrite uniprint xcf xes xpswrite
Search path:
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/ghostscript/9.56.1/Resource/Init :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/ghostscript/9.56.1/lib :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/ghostscript/9.56.1/Resource/Font :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/ghostscript/fonts :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/fonts/default/ghostscript :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/fonts/default/Type1 :
   /usr/local/Cellar/ghostscript-x11/9.56.1/share/fonts/default/TrueType :
   /usr/lib/DPS/outline/base : /usr/openwin/lib/X11/fonts/Type1 :
   /usr/openwin/lib/X11/fonts/TrueType
Ghostscript is also using fontconfig to search for font files
For more information, see /usr/local/Cellar/ghostscript-x11/9.56.1/share/doc/ghostscript/9.56.1/Use.htm.
Please report bugs to bugs.ghostscript.com.
johnhcc commented 11 months ago

Thanks for the report. That's a new one for me. Yes, you should definitely be seeing x11 with $(brew --prefix)/opt/ghostscript-x11/bin/gs -h. Do you have any other homebrew-installed apps that use X11, and does X11 work with them?

schplurtz commented 11 months ago

No. I have no x11 formula or cask installed. Only latest xquartz.

Here is the current list of my installed formulae, if that matters.

$ brew list --formula
MesCommandes        libarchive      node@16
aom         libass          oniguruma
apr         libavif         opencore-amr
apr-util        libb2           openexr
argon2          libbluray       openjpeg
aribb24         libde265        openldap
aspell          libevent        openssl@1.1
autoconf        libheif         openssl@3
bash            libidn          opus
brotli          libidn2         opusfile
c-ares          liblqr          p11-kit
ca-certificates     libmicrohttpd       pango
cairo           libnghttp2      pcre
cjson           libogg          pcre2
coreutils       libomp          php@8.0
curl            libpng          pixman
dav1d           libpq           pkg-config
dialog          libraw          popt
docker          librist         postgresql@14
docker-completion   librsvg         pstree
docker-compose      libsamplerate       pwgen
exiftool        libsh-schplurtz     pygments
fakeroot        libsndfile      python-certifi
ffmpeg          libsodium       python-distlib
findutils       libsoxr         python-filelock
flac            libssh2         python-platformdirs
fontconfig      libtasn1        python@3.10
freetds         libtiff         python@3.11
freetype        libtool         python@3.12
frei0r          libunibreak     python@3.8
fribidi         libunistring        qrencode
gd          libuv           rav1e
gdbm            libvidstab      readline
gdk-pixbuf      libvmaf         rtmpdump
gettext         libvorbis       rubberband
ghostscript     libvpx          sdl2
giflib          libx11          shared-mime-info
glib            libxau          six
gmp         libxcb          snappy
gnu-tar         libxdmcp        sox
gnutls          libxext         speex
graphite2       libxrender      sqlite
graphviz        libzip          srt
groonga         little-cms2     sshuttle
gts         lorem           svt-av1
harfbuzz        lz4         tcl-tk
highway         lzo         tesseract
htop            m4          theora
httpie          mad         tidy-html5
icu4c           mariadb         tree
imagemagick     mbedtls         unbound
imath           mecab           unixodbc
jasper          mecab-ipadic        virtualenv
jbig2dec        mongosh         virtualenvwrapper
jpeg-turbo      mpdecimal       webp
jpeg-xl         mpg123          x264
jq          msgpack         x265
krb5            multimarkdown       xorgproto
lame            ncdu            xvid
ldapvi          ncurses         xz
leptonica       netpbm          zeromq
lesspipe        nettle          zimg
lftp            node            zstd
schplurtz commented 11 months ago

I installed grace and feh they both use x11. Grace does contact the X11 server but crashes almost instantly for some weird reason. Sometime I can see that it opens a window, but it stays just a few ms, then it crashes. feh (image viewer) works. It can display a png of a screenshot I just made.

Here is the grace error message

$ xmgrace
Warning: locale not supported by Xlib, locale set to C
Warning: X locale modifiers not supported, using default
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Value in failed request:  0x0
  Serial number of failed request:  2135
  Current serial number in output stream:  2136

I'm going to reinstall ghostscript, and I'll let you know the result.

schplurtz commented 11 months ago

Recompiling while grace and feh are installed solved my issue. I removed ghostscript, grace and feh and their dependencies, then reinstalled grace alone and reinstalled ghostscript. And it worked !

It seems you missed a few dependencies. but it seems these are only build dependencies, not needed at runtime.

  1. install grace
    ==> Fetching dependencies for grace: isl, mpfr, libmpc, gcc, hwloc, pmix, open-mpi, fftw, libice, libsm, libxt, libxmu, libxp, libxpm, libxft, xbitmaps and openmotif
  2. install ghostscript-x11
  3. remove grace and deps. I use rmtree for that

    $ brew rmtree grace
    ==> Cleaning up packages safe to remove
    
    Uninstalling /usr/local/Cellar/grace/5.1.25_5... (266 files, 9.5MB)
    
    Uninstalling /usr/local/Cellar/fftw/3.3.10_1... (73 files, 19.2MB)
    
    Uninstalling /usr/local/Cellar/libxpm/3.5.17... (56 files, 383.6KB)
    
    Uninstalling /usr/local/Cellar/openmotif/2.3.8_2... (1,245 files, 17MB)
    
    Uninstalling /usr/local/Cellar/open-mpi/5.0.0... (2,751 files, 75.6MB)
    
    Uninstalling /usr/local/Cellar/libxmu/1.1.4... (36 files, 423.8KB)
    
    Uninstalling /usr/local/Cellar/libxft/2.3.8... (92 files, 340.2KB)
    
    Uninstalling /usr/local/Cellar/gcc/13.2.0... (1,590 files, 421.8MB)
    
    Warning: The following may be pmix configuration files and have not been removed!
    If desired, remove them manually with `rm -rf`:
     /usr/local/etc/pmix-mca-params.conf
    Uninstalling /usr/local/Cellar/pmix/4.2.7... (351 files, 8.4MB)
    
    Error: Refusing to uninstall /usr/local/Cellar/libxt/1.3.0
    because it is required by ghostscript-x11, which is currently installed.
    You can override this and force removal with:
     brew uninstall --ignore-dependencies libxt
    
    Uninstalling /usr/local/Cellar/xbitmaps/1.1.3... (77 files, 197.7KB)
    
    Uninstalling /usr/local/Cellar/isl/0.26... (73 files, 7.6MB)
    
    Uninstalling /usr/local/Cellar/libmpc/1.3.1... (12 files, 464.1KB)
    
    Error: Refusing to uninstall /usr/local/Cellar/libsm/1.2.4
    because it is required by ghostscript-x11 and libxt, which are currently installed.
    You can override this and force removal with:
     brew uninstall --ignore-dependencies libsm
    
    Uninstalling /usr/local/Cellar/mpfr/4.2.1... (30 files, 3.1MB)
    
    Error: Refusing to uninstall /usr/local/Cellar/libice/1.1.1
    because it is required by ghostscript-x11, libsm and libxt, which are currently installed.
    You can override this and force removal with:
     brew uninstall --ignore-dependencies libice
    
    Uninstalling /usr/local/Cellar/hwloc/2.9.3... (969 files, 10.5MB)
    
    Uninstalling /usr/local/Cellar/libxp/1.0.4... (46 files, 309.4KB)
  4. $(brew --prefix)/opt/ghostscript-x11/bin/gs still works like a charm.

Hope this helps.

johnhcc commented 10 months ago

Thanks @schplurtz! I was able to reproduce this on an M2.

I think the critical missing library that your install/uninstall procedure revealed was libxt (or one of its dependencies). I plan to update the ghostscript-x11 formula accordingly. If this breaks anything for you, please let me know.