Bug 232059 - graphics/mupdf: Fix linking in libmupdf.so for third-party ports
Summary: graphics/mupdf: Fix linking in libmupdf.so for third-party ports
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias Kortkamp
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2018-10-08 00:29 UTC by Albert Ou
Modified: 2018-10-09 09:23 UTC (History)
3 users (show)

See Also:
koobs: merge-quarterly+


Attachments
patch-Makefile (790 bytes, patch)
2018-10-08 00:29 UTC, Albert Ou
koobs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Ou 2018-10-08 00:29:31 UTC
Created attachment 197896 [details]
patch-Makefile

libmupdf.so references symbols from libmupdfthird.so but does not link directly against it.

This is problematic for ports using the --as-needed linker option, such as graphics/zathura-pdf-mupdf (>= 0.3.3) due to Meson's defaults.  zathura-pdf-mupdf itself does not reference symbols from libmupdfthird.so, and so despite being included in the linker arguments, libmupdfthird.so is not actually linked in.

(Note that this interaction would not arise if mupdf provided static libraries only, as was the case before ports r433550.  Therefore, upstream rejected the suggestion of changing the Meson option b_asneeded to false.)

    $ zathura --version
    error: Could not load plugin '/usr/local/lib/zathura/libpdf-mupdf.so' (/usr/local/lib/libmupdf.so.1.13.0: Undefined symbol "js_tointeger").
    zathura 0.4.0
    girara 0.3.1 (runtime: 0.3.1)

Attached is a proposed fix to ensure that libmupdf.so contains a DT_NEEDED tag for libmupdfthird.so.

poudriere testport: OK
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-08 10:54:42 UTC
Thank you for your report and analysis Albert.

CC'ing committer and submitter of ports r433550
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-08 10:56:13 UTC
Comment on attachment 197896 [details]
patch-Makefile

This change is:

Approved by: portmgr (blanket: build/run fixes)

Pending QA
Comment 3 commit-hook freebsd_committer 2018-10-09 07:02:39 UTC
A commit references this bug:

Author: tobik
Date: Tue Oct  9 07:01:54 UTC 2018
New revision: 481606
URL: https://svnweb.freebsd.org/changeset/ports/481606

Log:
  graphics/mupdf: Fix linking with libmupdf.so for third-party ports

  libmupdf.so references symbols from libmupdfthird.so but does not
  link directly against it.

  This is problematic for ports using the --as-needed linker option,
  such as graphics/zathura-pdf-mupdf (>= 0.3.3) due to Meson's defaults.
  zathura-pdf-mupdf itself does not reference symbols from libmupdfthird.so,
  and so despite being included in the linker arguments, libmupdfthird.so
  is not actually linked in.

  $ zathura --version
  error: Could not load plugin '/usr/local/lib/zathura/libpdf-mupdf.so' (/usr/local/lib/libmupdf.so.1.13.0: Undefined symbol "js_tointeger").

  This is a consequence of us providing shared libraries in spite of
  upstream since r433550 to keep package sizes down, but not properly
  understanding the dependency between libmupdfthird and libmupdf.

  PR:		232059
  Submitted by:	Albert Ou <aou@eecs.berkeley.edu>

Changes:
  head/graphics/mupdf/Makefile
  head/graphics/mupdf/files/patch-Makefile
Comment 4 commit-hook freebsd_committer 2018-10-09 07:04:43 UTC
A commit references this bug:

Author: tobik
Date: Tue Oct  9 07:04:11 UTC 2018
New revision: 481607
URL: https://svnweb.freebsd.org/changeset/ports/481607

Log:
  MFH: r481606

  graphics/mupdf: Fix linking with libmupdf.so for third-party ports

  libmupdf.so references symbols from libmupdfthird.so but does not
  link directly against it.

  This is problematic for ports using the --as-needed linker option,
  such as graphics/zathura-pdf-mupdf (>= 0.3.3) due to Meson's defaults.
  zathura-pdf-mupdf itself does not reference symbols from libmupdfthird.so,
  and so despite being included in the linker arguments, libmupdfthird.so
  is not actually linked in.

  $ zathura --version
  error: Could not load plugin '/usr/local/lib/zathura/libpdf-mupdf.so' (/usr/local/lib/libmupdf.so.1.13.0: Undefined symbol "js_tointeger").

  This is a consequence of us providing shared libraries in spite of
  upstream since r433550 to keep package sizes down, but not properly
  understanding the dependency between libmupdfthird and libmupdf.

  PR:		232059
  Submitted by:	Albert Ou <aou@eecs.berkeley.edu>

  Approved by:	ports-secteam build/runtime fix blanket

Changes:
_U  branches/2018Q4/
  branches/2018Q4/graphics/mupdf/Makefile
  branches/2018Q4/graphics/mupdf/files/patch-Makefile
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-09 08:24:05 UTC
Track merge
Comment 6 Zsolt Udvari 2018-10-09 08:39:55 UTC
Thanks for your working!
Comment 7 Albert Ou 2018-10-09 09:23:22 UTC
Thanks everyone for the quick responses!