[Poppler-bugs] [Bug 106417] New: Poppler-0.18.typelib on macOS (Homebrew) can't work because of incorrect dylib path

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 6 02:25:40 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=106417

            Bug ID: 106417
           Summary: Poppler-0.18.typelib on macOS (Homebrew) can't work
                    because of incorrect dylib path
           Product: poppler
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Mac OS X (All)
            Status: NEW
          Severity: major
          Priority: medium
         Component: glib frontend
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: waruzilla at gmail.com

Created attachment 139385
  --> https://bugs.freedesktop.org/attachment.cgi?id=139385&action=edit
Patch that adds --library-path of g-ir-scanner to fix wrong path setting of
typelib on macOS

Poppler-0.18.typelib install by homebrew can't work correctly because of the
wrong library path setting. Here is the sample code and the error message:

---- poppler-test.rb ----
#!/usr/bin/env ruby

require 'poppler'
--------------------------
$ ./poppler-test.rb
(null)-WARNING **: Failed to load shared library
'@rpath/libpoppler-glib.8.dylib' referenced by the typelib:
dlopen(@rpath/libpoppler-glib.8.dylib, 9): image not found
--------------------------

It tries to load the path (@rpath/libppoppler-glib.8.dylib), but dlopen can't
handle "@rpath". It should be an abosulte path (e.g.
/usr/local/Cellar/poppler/0.64.0/libpoppler-glib.8.dylib).

I investigated the reason. When g-ir-scanner generates Poppler-0.18.gir from
libpoppler-glib.8.dylib, it embeds the "install name" of the dylib into it.
Then g-ir-compiler compiles Poppler-0.18.typelib from Poppler-0.18.gir. It
means that if the install name of the dylib is @rpath style, typelib refers
dylib with @rpath style path, so the typelib cannot be used. AFAIK, to generate
gir and typelib correctly, the install name of dylib must be an absolute path,
but the current poppler.rb (build setting of homebrew) generates dylib with
@rpath style install name.
poppler.rb:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/poppler.rb

More precisely, it generates and installs libpoppler-glib.8.dylib with @rpath
style (line 80-81), then modifies the installed binary to absolute path style
(line 92-98). But the binary in the building process must be absolute path
style.

It can be changed by cmake option "-DCMAKE_INSTALL_NAME_DIR=/path/to/lib
-DCMKAE_BUILD_WITH_INSTALL_RPATH=ON" (I will propose homebrew-core to use these
options instead of line 92-98). However, this modification causes another
problem. If the dylib has abosulte path style install name and --no-libtool
option is set to g-ir-scanner, it fails to generate gir. To fix this problem,
it needs to specify --library-path option to refer the directory where
libpoppler-glib.8.dylib exists. (See
https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/11 for more
detail).

During the building process, libpoppler-glib.8.dylib is placed at
${CMAKE_CURRENT_BINARY_DIR}, so I propose to set it. See the attachment patch
file for the detail.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20180506/f50fd101/attachment.html>


More information about the Poppler-bugs mailing list