On Thursday, 17 November 2022 12:15:20 PST Dennis Luehring wrote:
> but why is that LD_PRELOAD/LD_LIBRARY_PATH-stuff not needed for a self
> build Glib?

Depends on whether the QtCore library ended up with a DT_RUNPATH pointing to 
that glib or not.

You can use readelf / eu-readelf's -d (--dynamic) option or objdump -p 
(--private) option to print the dynamic table and see if they have a RUNPATH 
set. My standard build doesn't have anything special:

$ objdump -p $QTLIBDIR/libQt6Core.so | grep PATH   
  RUNPATH              $ORIGIN:

If it's not obvious how it's finding the lib, you can ask the dynamic linker 
for help.

$ export LD_LIBRARY_PATH=$HOME/dev/tmp
$ LD_DEBUG=libs $QTLIBDIR/libQt6Core.t.so |& grep libglib
    276794:     find library=libglib-2.0.so.0 [0]; searching
    276794:       trying file=/home/tjmaciei/dev/tmp/libglib-2.0.so.0
    276794:       trying file=/home/tjmaciei/obj/qt/qt6/qtbase/lib/
    276794:       trying file=glibc-hwcaps/x86-64-v4/libglib-2.0.so.0
    276794:       trying file=glibc-hwcaps/x86-64-v3/libglib-2.0.so.0
    276794:       trying file=glibc-hwcaps/x86-64-v2/libglib-2.0.so.0
    276794:       trying file=tls/haswell/avx512_1/x86_64/libglib-2.0.so.0
    276794:       trying file=tls/haswell/avx512_1/libglib-2.0.so.0
    276794:       trying file=tls/haswell/x86_64/libglib-2.0.so.0
    276794:       trying file=tls/haswell/libglib-2.0.so.0
    276794:       trying file=tls/avx512_1/x86_64/libglib-2.0.so.0
    276794:       trying file=tls/avx512_1/libglib-2.0.so.0
    276794:       trying file=tls/x86_64/libglib-2.0.so.0
    276794:       trying file=tls/libglib-2.0.so.0
    276794:       trying file=haswell/avx512_1/x86_64/libglib-2.0.so.0
    276794:       trying file=haswell/avx512_1/libglib-2.0.so.0
    276794:       trying file=haswell/x86_64/libglib-2.0.so.0
    276794:       trying file=haswell/libglib-2.0.so.0
    276794:       trying file=avx512_1/x86_64/libglib-2.0.so.0
    276794:       trying file=avx512_1/libglib-2.0.so.0
    276794:       trying file=x86_64/libglib-2.0.so.0
    276794:       trying file=libglib-2.0.so.0
    276794:       trying file=/lib64/libglib-2.0.so.0
    276794:     calling init: /lib64/libglib-2.0.so.0

As you can see, it first tried $LD_LIBRARY_PATH (I set to a tmp dir just to 
show). The second is $ORIGIN in the header. The last is the system search in 
/lib64, which found the lib.

All the ones in the middle are caused by the fact that the DT_RUNPATH entry in 
the header ends in a colon. That's... a security risk?

Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering

Interest mailing list

Reply via email to