3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs
Maximilian Bosch d9218155d2
ghostscript: use system-wide openjpeg
The following error occurs when using `imagemagickBig`:

    $ ./result/bin/identify sample.jp2
    [1]    699089 IOT instruction (core dumped)  ./result/bin/identify sample.jp2

When looking at the call-trace it seems as if certain symbols, e.g.
`opj_malloc` are mixed up:

    #8  0x00007f78c79ad2f5 in MagickSignalHandler.cold () from /nix/store/bqy80qiw6czqh7vsmmmivwdswp9zzjgl-imagemagick-7.1.0-29/lib/libMagickCore-7.Q16HDRI.so.10
    #9  <signal handler called>
    #10 0x00007f78c5a6095f in opj_malloc () from /nix/store/wg6ly83k1k1fjiygiv1jr7li3p6dwsvq-ghostscript-with-X-9.55.0/lib/libgs.so.9
    #11 0x00007f78c5a60981 in opj_calloc () from /nix/store/wg6ly83k1k1fjiygiv1jr7li3p6dwsvq-ghostscript-with-X-9.55.0/lib/libgs.so.9
    #12 0x00007f78c4f48e24 in opj_create_decompress () from /nix/store/qwalb0kjz1p9c4j48qkk6ql47ds2lnhh-openjpeg-2.4.0/lib/libopenjp2.so.7

The `opj_create_decompress()` is called from the `openjpeg`-integration
of `imagemagick` and thus shouldn't affect `ghostscript` at all.
However, `ghostscript` (`libgs.so` to be precise) also exposes e.g.
`opj_malloc`:

    $ objdump -t /nix/store/wg6ly83k1k1fjiygiv1jr7li3p6dwsvq-ghostscript-with-X-9.55.0/lib/libgs.so.9.55|grep opj_malloc
    0000000000205940 g     F .text	000000000000002b              opj_malloc

Because of that, two incompatible symbols are used in the same process
and thus the `identify`-call breaks because the wrong one is used. To
work around that I decided to use the system-wide openjpeg instead.
I'm not sure why `libgs.so` wants to expose these symbols anyways, but
with that workaround the problem is solved.

Even though it's mentioned that ghostscript's openjpeg is heavily
patched, I think that this is somewhat outdated or at least irrelevant
considering that both ArchLinux[1] and Fedora[2] use the system-wide
`openjpeg` instead.

[1] bafcb5473b/trunk/PKGBUILD (L50)
[2] e4eec13ab6/f/ghostscript.spec (_245)
2022-04-23 00:54:22 +02:00
..
applications Merge pull request #169348 from andresilva/ledger-live-2.40.4 2022-04-22 18:24:22 +01:00
build-support Merge pull request #165111 from toonn/darwin-bundle-outputBin 2022-04-22 12:04:09 +01:00
common-updater
data Merge pull request #169824 from SuperSamus/gnome-breeze 2022-04-22 19:13:31 +02:00
desktops gnome.gnome-initial-setup: 42.1 -> 42.1.1 2022-04-22 09:18:11 +02:00
development python3Packages.blspy: unbreak 2022-04-22 10:53:35 -07:00
games Merge pull request #169267 from AndersonTorres/lgames 2022-04-22 13:18:55 -03:00
misc ghostscript: use system-wide openjpeg 2022-04-23 00:54:22 +02:00
os-specific apple-sdk: update comment about frameworks version 2022-04-21 19:44:28 -04:00
pkgs-lib
servers Merge pull request #169751 from r-ryantm/auto-update/check_ssl_cert 2022-04-22 17:01:56 +02:00
shells Merge pull request #169479 from raboof/nushell-0.60.0-to-0.61.0 2022-04-21 03:43:18 +03:00
stdenv
test
tools pkgsMusl.coreutils: fix build on aarch64 2022-04-22 17:26:43 +00:00
top-level python310Packages.pyhanko: init at 0.12.1 2022-04-22 10:46:33 -07:00