Search code examples
qtshared-librariesld

ld skips shared library


I am trying to deploy a Qt application by providing the Qt libraries as shared libraries in a directory and pointing ld to them using LD_LIBRARY_PATH. This works for all Qt libraries such as libQt5Network or libQt5Gui, but not for libQt5Core which is somehow not found and the system version is used instead.

Using LD_DEBUG=all I can see that ld tries the file which exists, but skips it

  3705: file=libQt5Core.so.5 [0];  needed by ./app.bin [0]
  3705: find library=libQt5Core.so.5 [0]; searching
  3705:  search path=/home/user/app/lib:/usr/lib64/tls/x86_64/x86_64:/usr/lib64/tls/x86_64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64/x86_64:/usr/lib64/x86_64:/usr/lib64/x86_64:/usr/lib64     (LD_LIBRARY_PATH)
  3705:   trying file=/home/user/app/lib/libQt5Core.so.5 <- this file exists
  3705:   trying file=/usr/lib64/tls/x86_64/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/tls/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/tls/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/tls/libQt5Core.so.5
  3705:   trying file=/usr/lib64/x86_64/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/x86_64/libQt5Core.so.5
  3705:   trying file=/usr/lib64/libQt5Core.so.5

Both libQt5Core.so.5 and app.bin are 64 bit elf.

Is there any way to find out why ld rejects the file?


Solution

  • Solution is here: https://github.com/Microsoft/WSL/issues/3023

    The library contains an ABI note which can be removed using strip to make ld accept the library.