pyushkevich/itksnap

error while loading shared libraries: libQt6Core.so.6: cannot open shared object file: No such file or directory

Closed this issue · 7 comments

Dear itksnap team,

We have a strange problem (NeuroDesk/neurocommand#259) with itksnap 4.0.2 (and 4.0.1) running in a ubuntu 22.04 singularity/apptainer container and I was hoping you have some ideas about what we are doing wrong.

This problem only seems to occur with older kernel versions: It works perfectly fine when running this Ubuntu 22.04 container in Centos 8 and the problem appears when running the SAME container in Centos 7.

starting the normal itksnap binary results in:

 itksnap
/opt/itksnap-4.0.2/lib/snap-4.0.2/ITK-SNAP: error while loading shared libraries: libQt6Core.so.6: cannot open shared object file: No such file or directory

when checking the libraries, we see something strange: It finds some libraries under /opt/itksnap-4.0.2/lib/snap-4.0.2/ but not others (but they are actually there!):

Singularity> itksnap --ldd
	linux-vdso.so.1 (0x00007fff8f555000)
	libcurl.so.4 => /lib/x86_64-linux-gnu/libcurl.so.4 (0x00007fb87b5a7000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb87b4c0000)
	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fb87b380000)
	libQt6OpenGLWidgets.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6OpenGLWidgets.so.6 (0x00007fb87b373000)
	libQt6Widgets.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6Widgets.so.6 (0x00007fb87ac51000)
	libQt6OpenGL.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6OpenGL.so.6 (0x00007fb87abaf000)
	libQt6Gui.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6Gui.so.6 (0x00007fb87a25e000)
	libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fb87a22a000)
	libOpenGL.so.0 => /lib/x86_64-linux-gnu/libOpenGL.so.0 (0x00007fb87a1fe000)
	libQt6Qml.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6Qml.so.6 (0x00007fb879cc9000)
	libQt6Core.so.6 => not found
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb879a9b000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb879a7b000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb879853000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb881815000)
	libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007fb879829000)
	libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007fb879808000)
	librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007fb8797e9000)
	libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007fb87977a000)
	libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007fb879766000)
	libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007fb8796c2000)
	libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007fb87927f000)
	libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fb87922b000)
	libldap-2.5.so.0 => /lib/x86_64-linux-gnu/libldap-2.5.so.0 (0x00007fb8791cc000)
	liblber-2.5.so.0 => /lib/x86_64-linux-gnu/liblber-2.5.so.0 (0x00007fb8791b9000)
	libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fb8790ea000)
	libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007fb8790dc000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb8790c0000)
	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fb879096000)
	libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fb87900f000)
	libQt6Core.so.6 => not found
	libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fb878fc6000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb878fc1000)
	libQt6Core.so.6 => not found
	libQt6Core.so.6 => not found
	libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007fb878fac000)
	libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fb878f62000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb878f5d000)
	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fb878e23000)
	libQt6DBus.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6DBus.so.6 (0x00007fb878d51000)
	libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fb878c89000)
	libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fb878c82000)
	libQt6Core.so.6 => not found
	libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fb878bca000)
	libQt6Network.so.6 => /opt/itksnap-4.0.2/lib/snap-4.0.2/libQt6Network.so.6 (0x00007fb878a15000)
	libQt6Core.so.6 => not found
	libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007fb878869000)
	libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007fb87867e000)
	libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007fb878636000)
	libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007fb8785f0000)
	libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fb87856e000)
	libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fb8784a1000)
	libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fb878472000)
	libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fb87846c000)
	libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fb87845e000)
	libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007fb878443000)
	libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007fb878420000)
	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fb878418000)
	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fb878410000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fb8783df000)
	libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fb8783d6000)
	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fb878360000)
	libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fb878310000)
	libQt6Core.so.6 => not found
	libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fb8782d5000)
	libQt6Core.so.6 => not found
	libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fb87819a000)
	libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fb878180000)
	libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fb878179000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fb878165000)
	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fb87814d000)
	libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fb878086000)
	libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007fb878077000)
	libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007fb87806a000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fb87803f000)
	liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fb87801f000)
	libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007fb878014000)
	libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fb877ed6000)
	libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fb877eae000)
Singularity> ll /opt/itksnap-4.0.2/lib/snap-4.0.2/
total 183531
drwxrwxr-x. 5 root root       723 Sep 29 06:37 .
drwxrwxr-x. 3 root root       124 Sep 29 06:37 ..
-rwxr-xr-x. 1 root root 124204152 Sep 29 06:31 ITK-SNAP
drwxrwxr-x. 2 root root        33 Sep 29 06:37 imageformats
lrwxrwxrwx. 1 root root        19 Sep 29 06:37 libQt6Core.so.6 -> libQt6Core.so.6.2.4
-rwxr-xr-x. 1 root root   6571696 Sep 29 06:37 libQt6Core.so.6.2.4
lrwxrwxrwx. 1 root root        19 Sep 29 06:37 libQt6DBus.so.6 -> libQt6DBus.so.6.2.4
-rwxr-xr-x. 1 root root    855848 Sep 29 06:37 libQt6DBus.so.6.2.4
lrwxrwxrwx. 1 root root        18 Sep 29 06:37 libQt6Gui.so.6 -> libQt6Gui.so.6.2.4
-rwxr-xr-x. 1 root root   9703008 Sep 29 06:37 libQt6Gui.so.6.2.4
lrwxrwxrwx. 1 root root        22 Sep 29 06:37 libQt6Network.so.6 -> libQt6Network.so.6.2.4
-rwxr-xr-x. 1 root root   1785000 Sep 29 06:37 libQt6Network.so.6.2.4
lrwxrwxrwx. 1 root root        21 Sep 29 06:37 libQt6OpenGL.so.6 -> libQt6OpenGL.so.6.2.4
-rwxr-xr-x. 1 root root    650408 Sep 29 06:37 libQt6OpenGL.so.6.2.4
lrwxrwxrwx. 1 root root        28 Sep 29 06:37 libQt6OpenGLWidgets.so.6 -> libQt6OpenGLWidgets.so.6.2.4
-rwxr-xr-x. 1 root root     48368 Sep 29 06:37 libQt6OpenGLWidgets.so.6.2.4
lrwxrwxrwx. 1 root root        18 Sep 29 06:37 libQt6Qml.so.6 -> libQt6Qml.so.6.2.4
-rwxr-xr-x. 1 root root   5452808 Sep 29 06:37 libQt6Qml.so.6.2.4
lrwxrwxrwx. 1 root root        22 Sep 29 06:37 libQt6Widgets.so.6 -> libQt6Widgets.so.6.2.4
-rwxr-xr-x. 1 root root   7472584 Sep 29 06:37 libQt6Widgets.so.6.2.4
lrwxrwxrwx. 1 root root        21 Sep 29 06:37 libQt6XcbQpa.so.6 -> libQt6XcbQpa.so.6.2.4
-rwxr-xr-x. 1 root root    692280 Sep 29 06:37 libQt6XcbQpa.so.6.2.4
lrwxrwxrwx. 1 root root        18 Sep 29 06:37 libicudata.so.56 -> libicudata.so.56.1
-rwxr-xr-x. 1 root root  25048256 Sep 29 06:37 libicudata.so.56.1
lrwxrwxrwx. 1 root root        18 Sep 29 06:37 libicui18n.so.56 -> libicui18n.so.56.1
-rwxr-xr-x. 1 root root   3368288 Sep 29 06:37 libicui18n.so.56.1
lrwxrwxrwx. 1 root root        16 Sep 29 06:37 libicuuc.so.56 -> libicuuc.so.56.1
-rwxr-xr-x. 1 root root   2069136 Sep 29 06:37 libicuuc.so.56.1
drwxrwxr-x. 2 root root        33 Sep 29 06:37 platforms
drwxrwxr-x. 2 root root        83 Sep 29 06:37 xcbglintegrations

Setting the ld library Path explicitly also doesn't solve the problem:

echo $LD_LIBRARY_PATH
/opt/itksnap-4.0.2/lib/snap-4.0.2/

I am sure we are doing something wrong, but I just can't figure out what it is. Do you have any thoughts on this and pointers for us in the right direction?

Thank you so much
Steffen

The apptainer maintainers have seen a similar issue before: apptainer/apptainer#1698 could this be the problem and the solution to compile qt differently?

This seems to be the fix that could be applied when compiling the QT library:

EESSI/software-layer#99

		-no-feature-statx	# bug 672856
		-no-feature-getentropy # needs kernel 3.17
		-no-feature-renameat2 # needs kernel 3.16

Dear @pyushkevich,

No, do I have to rebuild itksnap for that? Where would I make this change?

I tried this quick fix proposed by some:

find /opt/itksnap-4.0.2/ -name '*.so.*' | xargs strip --remove-section=.note.ABI-tag

This seemed to work, but I am unsure if this breaks anything else?

@pyushkevich,

Not sure if there is anything you want to change on the ITK-SNAP side, but for now the fix above worked and solved our problem.

Thank you for your thoughts on this
Steffen

Dear @pyushkevich

Yes, as far as I understand the problem it's basically a QT compatibility problem with older kernels.

However, it seems this problem could be avoided on ITK-SNAPs side by compiling QT differently using these compiler flags:

		-no-feature-statx	# bug 672856
		-no-feature-getentropy # needs kernel 3.17
		-no-feature-renameat2 # needs kernel 3.16

My workaround in this container here (https://github.com/NeuroDesk/neurocontainers/blob/master/recipes/itksnap/build.sh) is to strip a section from the libraries and then the QT libraries run on older kernels:

find /opt/itksnap-4.0.2/ -name '*.so.*' | xargs strip --remove-section=.note.ABI-tag

So far this hasn't caused any adverse effects, but the question is if it would be a cleaner solution if you distribute a differently compiled version of QT that doesn't assume these new kernel features with ITK-SNAP?

Thank you
Steffen