Qt 5.4.1 loading libGLESv2.so directly and ignoring soname
I'm seeing Qt 5.4.1 apps which use the eglfs platform plug-in exit soon after startup with the following error:
Failed to load libGLESv2
The issue seems to be that Qt 5.4.1 tries to dlopen "libGLESv2.so" at runtime, but due to OE's packaging rules the libGLESv2.so symlink isn't available.
As a temporary workaround I'm using the mesa patch below to force the libGLESv2.so symlink out of libgles2-mesa-dev and into libgles2-mesa.
Strace shows:
| ...
| open("/usr/lib/libGLESv2.so.2", O_RDONLY|O_CLOEXEC) = 3
| read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0`\36D4\0\0\0"..., 512) = 512
| fstat64(3, {st_mode=S_IFREG|0755, st_size=50368, ...}) = 0
| mmap2(0x441e6000, 51276, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x441e6000
| mmap2(0x441f2000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x441f2000
| close(3) = 0
| ...ie the dynamic linker initially succeeds by using the soname, but then later:
| ...
| open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
| fstat64(20, {st_mode=S_IFREG|0644, st_size=10354, ...}) = 0
| mmap2(NULL, 10354, PROT_READ, MAP_PRIVATE, 20, 0) = 0xb76fb000
| close(20) = 0
| open("/lib/libGLESv2.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| open("/usr/lib/libGLESv2.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| munmap(0xb76fb000, 10354) = 0
| open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
| fstat64(20, {st_mode=S_IFREG|0644, st_size=10354, ...}) = 0
| mmap2(NULL, 10354, PROT_READ, MAP_PRIVATE, 20, 0) = 0xb76fb000
| close(20) = 0
| open("/lib/libGLESv2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| open("/usr/lib/libGLESv2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| munmap(0xb76fb000, 10354) = 0
| open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
| fstat64(20, {st_mode=S_IFREG|0644, st_size=10354, ...}) = 0
| mmap2(NULL, 10354, PROT_READ, MAP_PRIVATE, 20, 0) = 0xb76fb000
| close(20) = 0
| open("/lib/GLESv2.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| open("/usr/lib/GLESv2.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| munmap(0xb76fb000, 10354) = 0
| open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
| fstat64(20, {st_mode=S_IFREG|0644, st_size=10354, ...}) = 0
| mmap2(NULL, 10354, PROT_READ, MAP_PRIVATE, 20, 0) = 0xb76fb000
| close(20) = 0
| open("/lib/GLESv2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| open("/usr/lib/GLESv2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
| munmap(0xb76fb000, 10354) = 0
| write(2, "Failed to load libGLESv2\n", 25Failed to load libGLESv2
| ) = 25
| rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
| tgkill(438, 438, SIGABRT) = 0
| --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=438, si_uid=0} ---
| +++ killed by SIGABRT +++
| Abortedmeta/recipes-graphics/mesa/mesa.inc +11 -1
@@ -162,7 +162,17 @@ FILES_mesa-megadriver = "${libdir}/dri/*" FILES_libegl-mesa = "${libdir}/libEGL.so.*" FILES_libgbm = "${libdir}/libgbm.so.*" FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*" -FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*" + +# ------------------------------------------------------------------------------ +# Move the /usr/lib/libGLESv2.so symlink into the runtime package as workaround +# for issues seem with Qt 5.4.1, which seems to try to dlopen libGLESv2.so using +# a hardcoded filename (instead of relying on the dynamic linker and therefore +# loading libGLESv2.so via it's soname). +# ------------------------------------------------------------------------------ +FILES_libgles2-mesa = "${libdir}/libGLESv2.so.* ${libdir}/libGLESv2.so" +FILES_SOLIBSDEV_libgles2-mesa = "" +INSANE_SKIP_libgles2-mesa += "dev-so" + FILES_libgl-mesa = "${libdir}/libGL.so.*" FILES_libglapi = "${libdir}/libglapi.so.*" FILES_libosmesa = "${libdir}/libOSMesa.so.*"
meta/recipes-graphics/mesa/mesa.inc FILES_mesa-megadriver = "${libdir}/dri/*" · line 175
Quoted 11 lines · Andre McCurdy
meta/recipes-graphics/mesa/mesa.inc +11
-0+ +# ------------------------------------------------------------------------------ +# Move the /usr/lib/libGLESv2.so symlink into the runtime package as workaround +# for issues seem with Qt 5.4.1, which seems to try to dlopen libGLESv2.so using +# a hardcoded filename (instead of relying on the dynamic linker and therefore +# loading libGLESv2.so via it's soname). +# ------------------------------------------------------------------------------ +FILES_libgles2-mesa = "${libdir}/libGLESv2.so.* ${libdir}/libGLESv2.so" +FILES_SOLIBSDEV_libgles2-mesa = "" +INSANE_SKIP_libgles2-mesa += "dev-so" +
Yes they now load it as plugin for ES3 compiled libraries to be able to run on ES2 only systems
you could just empty out
SOLIBSDEV = ""
and set
SOLIBS = ".so*"
I see that dev-so QA check hardcodes .so check it would be nicer if it checked for SOLIBDEV extentions instead
may be you should file a bug for that or even better send a fix