libgio-2.0.so embedding full path to libz.so
I'm updating our code base to use the latest Glib (2.60.4) and I've run into a weird issue where the libgio is embedding the full path to libz. The code base in question is for an embedded Linux system cross compiling for various architectures.
Here's a snippet that illustrates the problem
$ strings output/armv4t/glib2/new/staging/usr/lib/libgio-2.0.so.0.6000.4 | grep '.*\.so'
libglib-2.0.so.0
libgobject-2.0.so.0
libgmodule-2.0.so.0
/home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/libz.so
libmount.so.1
libresolv.so.2
libpthread.so.0
libc.so.6
libgio-2.0.so.0
We have an optimisation in our build system where the build objects are fetched from the CI system if the source is unchanged since the last build so /home/chrisp/redacted/
can be /home/maker/jenkins/some/workspace/
which then causes a problem for dependent packages when they are built
/usr/bin/arm-unknown-linux-gnu/bin/ld: warning: /home/maker/jenkins/some/workspace/output/armv4t/glib2/staging/usr/lib/libz.so, needed by /home/chrisp/redacted/output/target/package/staging/usr/lib/libgio-2.0.so, not found (try using -rpath or -rpath-link)
I don't know why libz is special. Other external libraries like libmount and libresolv don't have hardcoded paths.
In case it's relevant I'm using meson-build 0.51.0.
Here's some relevant parts from meson-log.txt
Determining dependency 'zlib' with pkg-config executable '/usr/bin/pkg-config'
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config --modversion zlib` -> 0
1.2.11
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config --cflags zlib` -> 0
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config zlib --libs` -> 0
-L/home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib -lz
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Run-time dependency zlib found: YES 1.2.11
Determining dependency 'mount' with pkg-config executable '/usr/bin/pkg-config'
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config --modversion mount` -> 0
2.30.2
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config --cflags mount` -> 0
-I/home/chrisp/redacted/output/armv4t/glib2/staging/usr/include/libmount -I/home/chrisp/redacted/output/armv4t/glib2/staging/usr/include/blkid -I/home/chrisp/redacted/output/armv4t/glib2/staging/usr/include/uuid
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Called `/usr/bin/pkg-config mount --libs` -> 0
-L/home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib -lmount
PKG_CONFIG_PATH: /home/chrisp/redacted/output/armv4t/glib2/staging/usr/lib/pkgconfig/
Run-time dependency mount found: YES 2.30.2