[Development] Bundling Qt 5 libraries with application package and strange "font" error
Tomasz Olszak
olszak.tomasz at gmail.com
Sat Aug 10 14:54:51 CEST 2013
2013/8/9 Thiago Macieira <thiago.macieira at intel.com>
> On sexta-feira, 9 de agosto de 2013 17:14:11, Tomasz Olszak wrote:
> > Application without changing RPATH in Qt libraries and application
> binary:
> > http://pbrd.co/136t3GI
> >
> > This is application after RPATH modification:
> > http://pbrd.co/136tyR2
>
> Hi Tomasz
>
> RPATH and deprecated and you should not use it in new applications. You may
> use the newer RUNPATH, which has different semantics (see other thread).
>
> I think the best solution is to use RUNPATH with $ORIGIN, pointing to the
> libraries.
>
> Alternatively, the simplest solution is to replace the main application
> binary
> with a shell script that sets LD_LIBRARY_PATH.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
Hi I tried to build Qt with RUNPATH but with no luck. LD_LIBRARY_PATH is
not an option. Binary is position independent executables and has extern
function that is invoked by external process.
So application is in fact shared library. I spent couple of hours trying to
make things work and have following results:
*Application dir layout:*
/opt/usr/app/APPID/bin/App.exe(-pie binary)
/opt/usr/app/APPID/lib - Qt libraries
/opt/usr/app/APPID/data/plugins - Qt plugins
/opt/usr/app/APPID/data/qml - QtQuick2 and Qml plugins
*Application qt.conf file:*
[Paths]
Prefix=/opt/usr/apps/QtControls
Libraries=lib
Binaries=bin
Plugins=data/plugins
Qml2Imports=data/qml
qt.conf file is needed because QCoreApplication::applicationDir() returns
/usr/bin. It is launch_app directory (launch_app loads App.exe and runs
extern function). I will look at
http://codereview.qt-project.org/62455<http://www.google.com/url?q=http%3A%2F%2Fcodereview.qt-project.org%2F62455&sa=D&sntz=1&usg=AFQjCNHpYBYWk45Mypv0RtkT6kEN0wy4IA>
and fix it for tizen too in the future.
*Application QMAKE_LFLAGS:*
QMAKE_LFLAGS+=-pie -rdynamic -Wl,-rpath,/opt/usr/apps/QtControls/lib
*Qt QMAKE_LFLAGS* set ind mkspecs/devices/...:
QMAKE_LFLAGS += -Wl,--enable-new-dtags '-Wl,-rpath,\'\$$ORIGIN/../lib\''
QMAKE_LFLAGS_PLUGIN += '-Wl,-rpath,\'\$$ORIGIN/../../../lib\''
Some notices:
It looks like LD_LIBRARY_PATH doesn't work because even if I set
LD_LIBRARY_PATH=. in /opt/usr/APPID/lib directory and execute ldd on e.g.
libQt5Qml.so I get:
linux-gate.so.1 => (0xb776a000)
/usr/lib/libsys-assert.so (0xb7514000)
libQt5Network.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5Network.so.5 (0xb73f5000)
libQt5Core.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5Core.so.5 (0xb6f8e000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb6f62000)
librt.so.1 => /lib/librt.so.1 (0xb6f59000)
libQt5V8.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5V8.so.5 (0xb6b77000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6a8f000)
libm.so.6 => /lib/libm.so.6 (0xb6a68000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6a4d000)
libc.so.6 => /lib/libc.so.6 (0xb68f1000)
libunwind.so.8 => /lib/libunwind.so.8 (0xb68de000)
libdl.so.2 => /lib/libdl.so.2 (0xb68da000)
libz.so.1 => /lib/libz.so.1 (0xb68b9000)
libicui18n.so.48 => /usr/lib/libicui18n.so.48 (0xb66d3000)
libicuuc.so.48 => /usr/lib/libicuuc.so.48 (0xb656a000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6568000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb643e000)
/lib/ld-linux.so.2 (0xb776b000)
libicudata.so.48 => /usr/lib/libicudata.so.48 (0xb5335000)
So it looks like runpath(rpath) has bigger priority.
ldd shows that dependencies of all executables are resolved (App.exe and Qt
libraries in lib directory). Unfortunately when I try to run App.exe I get:
./App.exe: error while loading shared libraries: libQt5V8.so.5: cannot open
shared object file: No such file or directory
In the same time ldd App.exe gives:
linux-gate.so.1 => (0xb77d8000)
/usr/lib/libsys-assert.so (0xb77b2000)
libQt5Quick.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/libQt5Quick.so.5 (0xb7507000)
libQt5Qml.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/libQt5Qml.so.5 (0xb72b9000)
libQt5Network.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/libQt5Network.so.5 (0xb719a000)
libQt5Gui.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/libQt5Gui.so.5 (0xb6e11000)
libQt5Core.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/libQt5Core.so.5 (0xb69aa000)
libGLESv2.so.1 => /usr/lib/libGLESv2.so.1 (0xb6963000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb6948000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6860000)
libm.so.6 => /lib/libm.so.6 (0xb683a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb681f000)
libc.so.6 => /lib/libc.so.6 (0xb66c3000)
libunwind.so.8 => /lib/libunwind.so.8 (0xb66b0000)
libdl.so.2 => /lib/libdl.so.2 (0xb66ab000)
libQt5V8.so.5 =>
/opt/usr/apps/QtControls/bin/./../lib/../lib/libQt5V8.so.5 (0xb62c9000)
librt.so.1 => /lib/librt.so.1 (0xb62c0000)
libz.so.1 => /lib/libz.so.1 (0xb62a0000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb6277000)
libEGL.so.1 => /usr/lib/libEGL.so.1 (0xb6260000)
libicui18n.so.48 => /usr/lib/libicui18n.so.48 (0xb607a000)
libicuuc.so.48 => /usr/lib/libicuuc.so.48 (0xb5f11000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb5f0f000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb5de4000)
/lib/ld-linux.so.2 (0xb77d9000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb5cab000)
libicudata.so.48 => /usr/lib/libicudata.so.48 (0xb4ba3000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb4b82000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb4b7e000)
And ldd libQt5V8.so:
linux-gate.so.1 => (0xb77b2000)
/usr/lib/libsys-assert.so (0xb73c8000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb739c000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb72b4000)
libm.so.6 => /lib/libm.so.6 (0xb728e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7273000)
libc.so.6 => /lib/libc.so.6 (0xb7117000)
libunwind.so.8 => /lib/libunwind.so.8 (0xb7104000)
libdl.so.2 => /lib/libdl.so.2 (0xb7100000)
/lib/ld-linux.so.2 (0xb77b3000)
Also strange is fact that event if ldd libQt5Qml.so prints:
linux-gate.so.1 => (0xb7794000)
/usr/lib/libsys-assert.so (0xb753d000)
libQt5Network.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5Network.so.5 (0xb741e000)
libQt5Core.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5Core.so.5 (0xb6fb7000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb6f8b000)
librt.so.1 => /lib/librt.so.1 (0xb6f82000)
libQt5V8.so.5 =>
/opt/usr/apps/QtControls/lib/./../lib/libQt5V8.so.5 (0xb6ba0000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6ab8000)
libm.so.6 => /lib/libm.so.6 (0xb6a91000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6a76000)
libc.so.6 => /lib/libc.so.6 (0xb691a000)
libunwind.so.8 => /lib/libunwind.so.8 (0xb6907000)
libdl.so.2 => /lib/libdl.so.2 (0xb6903000)
libz.so.1 => /lib/libz.so.1 (0xb68e2000)
libicui18n.so.48 => /usr/lib/libicui18n.so.48 (0xb66fc000)
libicuuc.so.48 => /usr/lib/libicuuc.so.48 (0xb6593000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6591000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb6467000)
/lib/ld-linux.so.2 (0xb7795000)
libicudata.so.48 => /usr/lib/libicudata.so.48 (0xb535e000)
the /lib/ld-linux.so --list ./libQt5Qml.so returns:
./libQt5Qml.so.5: error while loading shared libraries: libQt5Network.so.5:
cannot open shared object file: No such file or directory
I would like to mention that If you build Qt with /opt/usr/apps/APPID
things work as expected...
Anyway there are rumors that dynamic loader is significantly modified on
Tizen (LD_LIBRARY_PATH and LD_PRELOAD doesn't work) so I will stick to
changing runpath with chrpath. I investigated that this strange font error
reveals by changing displayed text by 4 signs up :) So if I set ABC then
EFG is displayed even though the console.log(text) shows ABC.
Is it possible that *.ttf file can break font engine somehow?
Tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130810/d382e523/attachment.html>
More information about the Development
mailing list