PDA

View Full Version : Deploy on Ubuntu without root



Lumbricus
13th September 2016, 13:51
hey guys,

i want to deploy my program onto a university server where i don't have root. I am using the Opensource Version of Qt so i cant statically link.

The manual says there are 3 ways to accomplish deployment (http://doc.qt.io/qt-5/linux-deployment.html)

- putting all needed libs int user/lib/
->cant write to there because no root access, so not an option

- passing a prefered path where to look for libs -rpath command
->doing this i manage to get the application to find the qt libraries i shipped with the app. e.g:

libs reside in the sub folder "qtlibs_5.6._64bit"

adding this line to the .pro file


QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN/qtlibs_5.6_64bit'"


running ldd on my app showes:



asdfasdf@asdfasdf:~/Gordon_backup/imex$ ldd imex
linux-vdso.so.1 => (0x00007ffe24df6000)
libQt5PrintSupport.so.5 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libQt5PrintSupport.so.5 (0x00007ff4c608b000)
libQt5Widgets.so.5 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libQt5Widgets.so.5 (0x00007ff4c5818000)
libQt5Gui.so.5 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libQt5Gui.so.5 (0x00007ff4c5021000)
libQt5Core.so.5 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libQt5Core.so.5 (0x00007ff4c4906000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff4c46d0000)
libstdc++.so.6 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libstdc++.so.6 (0x00007ff4c434e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff4c4045000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007ff4c3e22000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff4c3c0c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff4c3843000)
libGL.so.1 => /usr/lib/nvidia-340/libGL.so.1 (0x00007ff4c34f6000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff4c32a3000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007ff4c30a1000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff4c2e98000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff4c2b87000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff4c2975000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff4c263a000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff4c2420000)
libicui18n.so.56 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libicui18n.so.56 (0x00007ff4c1f85000)
libicuuc.so.56 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libicuuc.so.56 (0x00007ff4c1bcd000)
libicudata.so.56 => /home/gordon/Gordon_backup/imex/./qtlibs_5.6_64bit/libicudata.so.56 (0x00007ff4c01ea000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff4bffe5000)
/lib64/ld-linux-x86-64.so.2 (0x000055f39e6f9000)
libnvidia-tls.so.340.96 => /usr/lib/nvidia-340/tls/libnvidia-tls.so.340.96 (0x00007ff4bfde2000)
libnvidia-glcore.so.340.96 => /usr/lib/nvidia-340/libnvidia-glcore.so.340.96 (0x00007ff4bd1cd000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff4bcfc5000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff4bcd55000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff4bcb32000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff4bc92e000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff4bc727000)


so i think passing the libs worked, i think ?!

but if i run the program i get this:



asdfasdf@hasdfasdfas:~/Gordon_backup/imex$ ./imex
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.
Aborted (core dumped)


as i understand i need to copy the folder plugins/platforms and its content to my application folder for this to work (http://doc.qt.io/qt-5/linux-deployment.html)

this does not seem to work for even if i run this on the development platform where withought passing the -rpath everything works.

i also tried prerunning a bash script like also suggested in the documentation:
./imex.sh


#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`

dirname=`dirname $0`
tmp="${dirname#?}"

if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$PWD/plugins/platforms
$dirname/$appname "$@"


i also specifically added the QT_QPA_PLATFORM_PLUGIN_PATH since to me it looked like it was not found. this gives me a slightly different output.



asdfsdf@asdfsfd:~/Gordon_backup/imex$ ./imex.sh
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "/home/gordon/Gordon_backup/imex/plugins/platforms".

Available platform plugins are: eglfs (from /home/gordon/Gordon_backup/imex/plugins/platforms), linuxfb (from /home/gordon/Gordon_backup/imex/plugins/platforms), minimal (from /home/gordon/Gordon_backup/imex/plugins/platforms), minimalegl (from /home/gordon/Gordon_backup/imex/plugins/platforms), offscreen (from /home/gordon/Gordon_backup/imex/plugins/platforms), xcb (from /home/gordon/Gordon_backup/imex/plugins/platforms), eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.
Aborted (core dumped)


to me this looks like if found the platforms folder and its content but still was not happy with that...

if i run ldd on imex/plugins/platforms/



asdfasdf@asdfasdfas:~/Gordon_backup/imex/plugins/platforms$ ldd libqxcb.so
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./libqxcb.so)
linux-vdso.so.1 => (0x00007ffca21a3000)
libQt5XcbQpa.so.5 => /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 (0x00007fc6b8faf000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fc6b8dad000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fc6b8b9c000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007fc6b8994000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007fc6b877a000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fc6b852d000)
//..cropped for readablity


to me it looks like the platform libs are trying to access the Qt libraries again? is there a way to resolve this? Did i not read the Documentation properly? What did i miss? Help would be very appriciated! Thx in advance. Sorry for so much writing :)

Lumbricus
15th September 2016, 11:13
Update:

this error comes from copying symbolic links. Replacing the specific version library with the general library linking to the specific lib solves this problem

libQt5XcbQpa.so.5.4 -> libQt5XcbQpa.so.5



./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./libqxcb.so)


Also after checking how the qt libs were referenced in "libqxcb.so" i saw it was looking for the qt libraries in the /libs folder 2 folders upwards:

qt_5.6_64bit/libs/qtlibraries....so.5
qt_5.6_64bid/plugins/platforms/libqxcb.so

this resolved all ldd issues for that lib....but sadly it will still not run.

So now I am getting the admin to run the qt installer. Thx for the ppl who read this anyway. Cheers!

anda_skoa
15th September 2016, 14:04
i want to deploy my program onto a university server where i don't have root. I am using the Opensource Version of Qt so i cant statically link.

Not sure what you mean, Qt can be statically or dynamically linked independent of the which "version" you downloaded.
It is always the same code and has the same capabilities.



but if i run the program i get this:



asdfasdf@hasdfasdfas:~/Gordon_backup/imex$ ./imex
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.
Aborted (core dumped)


As you can see in the available platforms list, Qt is aware of the XCB plugin, so its file is found.
But since it can't be loaded it is likely that one of its dependencies is not in place.
Try running ldd on the xcb plugin's .so


if i run ldd on imex/plugins/platforms/



asdfasdf@asdfasdfas:~/Gordon_backup/imex/plugins/platforms$ ldd libqxcb.so
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./libqxcb.so)
linux-vdso.so.1 => (0x00007ffca21a3000)
libQt5XcbQpa.so.5 => /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 (0x00007fc6b8faf000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fc6b8dad000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fc6b8b9c000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007fc6b8994000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007fc6b877a000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fc6b852d000)
//..cropped for readablity


So dependencies of th XCB plugin are not satisfied.
It finds the Qt libraries installed by the system instead of the ones it is looking for.

Cheers,
_