Libffi linking when installing glib

Hi,

I am new to meson and ninja. Is this the right place for this message?

I set PKG_CONFIG_PATH before running meson to $HOME/gtk/lib64/pkgconfig

When linking glib-2.61.1 libgobject in the build directory:
$ ldd find . -name libgobject-2.0.so
it links correctly it seems to me:
linux-vdso.so.1 => (0x00007ffd38bd7000)
libglib-2.0.so.0 => /home/emsley/Projects/gtk/glib-2.61.1/./_build/gobject/…/glib/libglib-2.0.so.0 (0x00007fc899014000)
libffi.so.7 => /home/emsley/gtk3/lib64/libffi.so.7 (0x00007fc898e0b000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc898bef000)
libc.so.6 => /lib64/libc.so.6 (0x00007fc898822000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fc8985c0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc89958d000)

However, upon installation it is not:
$ ldd find $HOME/gtk3 -name libgobject-2.0.so
libffi.so.7 => not found

This causes problems, it seems, when installing gobject-introspection-1.60.1

What to do? Thanks.

In the build directory, meson sets RUNPATH in the binaries so they can be used from the build directory, but removes RUNPATH when installing, because that allows the OS to use its standard rules to find libraries.

You probably want to set the LD_LIBRARY_PATH environment variable to tell the dynamic linker to search for libraries in your install directory.

jcrain, I am grateful for your rapid reply.

It seems to me then that the gtk-based binaries that I will build (in due course) will need to be run in an environment where LD_LIBRARY_PATH has been set (do I understand you correctly?). This doesn’t seem like a step forward. With autotools I use xxx_LIBADD so that the installed library is correctly linked. This can, of course, be overridden using LD_LIBRARY_PATH, but I don’t need to.

Thanks,

P.

You are combining two different concepts: linking, and the library search path

All of your examples are linked correctly. What they are linked to is shown on the left-hand side of the ldd output. If they didn’t link correctly, you should get an error message during compilation.

For the library search path - for installed software, you’ll usually want the libraries to be installed somewhere like /usr/lib or /usr/local/lib, and the OS’s dynamic linker knows to search in those locations. LD_LIBRARY_PATH can be used to override that temporarily or for testing purposes, which sounds like what you would want if you are running software out of your home $HOME/gtk.

Setting RUNPATH, embedding the search path into the binary, is another option if neither the default OS paths or LD_LIBRARY_PATH will work. I think to set that with meson, you’d have to modify the build file.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.