pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

devel/gobject-introspection macOS rpath pkgsrc wrapper



Hi,

I try to make object-introspection works again on macosx but I meet some "problems" and I need some help about some pkgsrc internals that I don't understand correctly.

Gobject introspection uses a compiler (g-ir-compiler) in order to make some typelib files based on gir files.

I hit a linker error:

FAILED: gir/cairo-1.0.typelib 
/Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/output/tools/g-ir-compiler -o gir/cairo-1.0.typelib gir/cairo-1.0.gir --includedir /Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/output/gir --includedir /Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/gir
dyld: Library not loaded: @rpath/libgirepository-1.0.1.dylib
  Referenced from: /Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/output/tools/g-ir-compiler
  Reason: image not found

Ok so g-ir-compiler does not find the libgirepository…(the library is built inside the "girepository" directory and the executable g-ir-compiler is in "tools" directory sibling of "girepository" directory.)
@rpath means that the library uses a run-path-relative pathname (macosx specific).

The executable g-ir-compiler can use different run-paths search path (rpath) to use the library, however there is only one here:

$  otool -l work/gobject-introspection-1.60.1/output/tools/g-ir-compiler | grep 'LC_RPATH' -A 2
         cmd LC_RPATH
      cmdsize 40
         path /Users/cbouvier/pkg/lib (offset 12)

It is where the library should be installed after the build….but it is not there yet…

Now object-introspection uses meson… If we look the build.ninja file and the target to link g-ir-compiler, we obtain (I've put only the paths flags):

LINK_ARGS = -Wl,-rpath,@loader_path/../girepository -Wl,-rpath,@loader_path/../girepository/cmph -Wl,-rpath,/Users/cbouvier/pkg/lib -Wl,-rpath,/Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/output/tools/../girepository

So ok…normally the binary should work inside the build directory because of @loader_path to girepository and one full path (these one is because I have patched the executable target of g-ir-compiler with a build_rpath options).

If I look at the .work_log, I have lines about g-ir-compiler:

[*] cc -o tools/g-ir-compiler 'tools/f9d35d4@@g-ir-compiler@exe/compiler.c.o' [...] '-Wl,-rpath,@loader_path/../girepository' '-Wl,-rpath,@loader_path/../girepository/cmph' -Wl,-rpath,/Users/cbouvier/pkg/lib -Wl,-rpath,/Users/cbouvier/prj/pkgsrc/devel/gobject-introspection/work/gobject-introspection-1.60.1/output/tools/../girepository
<.> /usr/bin/clang -m64 -o tools/g-ir-compiler 'tools/f9d35d4@@g-ir-compiler@exe/compiler.c.o' [...] -Wl,-rpath,/Users/cbouvier/pkg/lib -Qunused-arguments 

So If I understand:
- [*] are the command proposed by the build
- <.> what it is really executed (I don't find any ressource about that so if someone has references I would be happy).
 So there is a wrapper which filters the rpaths.
Someone has any idea about that? How Can I work around about that? 

Clement.


Home | Main Index | Thread Index | Old Index