Urgent Help Needed to build Linux distribution
-
Hello there,
I m a newbie for linux environment. As per our need i developed one application using QT on linux. Now i want to distribute linux build for other computer but after build its work only in my system. I tried some link available on .net and found one link suggesting to change in .pro file like "QMAKE_LFLAGS += -Wl,--rpath=\$$ORIGIN/lib". I also followed same steps but no luck. I m just stretching my hair and roaming in dark. So it will be a great help if anyone point me out to build QT linux redistrution.
Ram Thakkar.
-
Hello there,
I m a newbie for linux environment. As per our need i developed one application using QT on linux. Now i want to distribute linux build for other computer but after build its work only in my system. I tried some link available on .net and found one link suggesting to change in .pro file like "QMAKE_LFLAGS += -Wl,--rpath=\$$ORIGIN/lib". I also followed same steps but no luck. I m just stretching my hair and roaming in dark. So it will be a great help if anyone point me out to build QT linux redistrution.
Ram Thakkar.
@Ram_Thakkar77 Please read http://doc.qt.io/qt-5/linux-deployment.html
Especially "Creating the Application Package" section. -
@jsulm ,Thank you very much for your reply. I will surely look into that mentioned link and get back to you.
-
@jsulm , i tried above mentioned solution but no luck yet. Below is the code which i used in .sh file and .pro file:
#!/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 $dirname/$appname "$@"
my .pro file code
#------------------------------------------------- # # Project created by QtCreator 2017-02-09T15:01:26 # #------------------------------------------------- QT += core gui QT += webenginewidgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = QTBrowser TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += main.cpp\ mainbrowser.cpp HEADERS += mainbrowser.h FORMS += mainbrowser.ui QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib
is there any other changes in project settings; which i am missing in project setting file?
-
@jsulm , i tried above mentioned solution but no luck yet. Below is the code which i used in .sh file and .pro file:
#!/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 $dirname/$appname "$@"
my .pro file code
#------------------------------------------------- # # Project created by QtCreator 2017-02-09T15:01:26 # #------------------------------------------------- QT += core gui QT += webenginewidgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = QTBrowser TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += main.cpp\ mainbrowser.cpp HEADERS += mainbrowser.h FORMS += mainbrowser.ui QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib
is there any other changes in project settings; which i am missing in project setting file?
@Ram_Thakkar77 You don't need the rpath line at the end of your pro file if you use the script to start your app.
What is the problem now with this script? -
@Ram_Thakkar77 You don't need the rpath line at the end of your pro file if you use the script to start your app.
What is the problem now with this script?Thanks for prompt reply. Let me remove the rpath from .pro file and check. Will get back to you very soon.
-
Thanks for prompt reply. Let me remove the rpath from .pro file and check. Will get back to you very soon.
@jsulm , i remove that last file from .pro file and build new executable, after running .sh file i m getting below error:
'/root/Desktop/QTEXETesting/QTBrowser.sh' /root/Desktop/QTEXETesting/QTBrowser: error while loading shared libraries: libQt5WebEngineWidgets.so.5: cannot open shared object file: No such file or directory
I already pasted all .so files in same folder where my .sh file.
any suggestion.
-
@Ram_Thakkar77 As a simple test, just copy all the Qt libraries onto the deployment machine, keep the executable in the same directory, set the library path and try executing the application directly without any script. If it doesn't work, check the output of
ldd
on the application binary. -
@jsulm , i remove that last file from .pro file and build new executable, after running .sh file i m getting below error:
'/root/Desktop/QTEXETesting/QTBrowser.sh' /root/Desktop/QTEXETesting/QTBrowser: error while loading shared libraries: libQt5WebEngineWidgets.so.5: cannot open shared object file: No such file or directory
I already pasted all .so files in same folder where my .sh file.
any suggestion.
@Ram_Thakkar77 Is libQt5WebEngineWidgets.so.5 in the same directory as the script? Can you start your app manually from command line after entering the directory where it is? Do you get the same error then?
NOTE: after changing pro file you need to rerun qmake and rebuild completely!
-
I already built new one , checked with ldd command and pasted all dependency in same folder where my .sh file but still getting same error.
below is the link of screen shot of same :
Screenshot -
@Ram_Thakkar77 It is clear from the screen-shot that you are not exporting the correct library path. Also
ldd
would have already shown the error and you would have noticed it. -
I already built new one , checked with ldd command and pasted all dependency in same folder where my .sh file but still getting same error.
below is the link of screen shot of same :
Screenshot@Ram_Thakkar77 So, you put all libs in lib subdirectory?
Then you need to change the script: LD_LIBRARY_PATH must contain the directory where the libs are.LD_LIBRARY_PATH=$dirname/lib
Also, why is Makefile there? It is only needed to build the software.
-
@Ram_Thakkar77 So, you put all libs in lib subdirectory?
Then you need to change the script: LD_LIBRARY_PATH must contain the directory where the libs are.LD_LIBRARY_PATH=$dirname/lib
Also, why is Makefile there? It is only needed to build the software.
@jsulm Really very sorry by mistake uploaded wrong image and corrected that link. Please check it once again.
-
@jsulm Really very sorry by mistake uploaded wrong image and corrected that link. Please check it once again.
@Ram_Thakkar77 Copy symbolic links as well, like: libQt5WebEngineWidgets.so.5, which points to libQt5WebEngineWidgets.so.5.7.1. Your app links against libQt5WebEngineWidgets.so.5 not directly against libQt5WebEngineWidgets.so.5.7.1, so you need those links (as alternative you can rename the libs like: libQt5WebEngineWidgets.so.5 --> libQt5WebEngineWidgets.so.5.7.1).
-
@Ram_Thakkar77 Copy symbolic links as well, like: libQt5WebEngineWidgets.so.5, which points to libQt5WebEngineWidgets.so.5.7.1. Your app links against libQt5WebEngineWidgets.so.5 not directly against libQt5WebEngineWidgets.so.5.7.1, so you need those links (as alternative you can rename the libs like: libQt5WebEngineWidgets.so.5 --> libQt5WebEngineWidgets.so.5.7.1).
@jsulm, you are the savior for me. I pasted all .so files in same directory. Now its not giving error which i was getting previously. I m getting some new error like:
/root/Desktop/QTEXETesting/QTBrowser: /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5: no version information available (required by /root/Desktop/QTEXETesting/libQt5WebEngineWidgets.so.5)
and here is the link for screen shot of same : Screen Shot
-
@jsulm, you are the savior for me. I pasted all .so files in same directory. Now its not giving error which i was getting previously. I m getting some new error like:
/root/Desktop/QTEXETesting/QTBrowser: /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5: no version information available (required by /root/Desktop/QTEXETesting/libQt5WebEngineWidgets.so.5)
and here is the link for screen shot of same : Screen Shot
@Ram_Thakkar77 You did not copy all needed libraries! For example libQt5Core.so.5.7.1 is missing: you only have the link libQt5Core.so.5. Please make sure you really have all libs and symbolic links there.
-
I still have doubt if library path is set correctly because the system is referring to libraries in
/usr/lib
where as it should have been the new path. -
I still have doubt if library path is set correctly because the system is referring to libraries in
/usr/lib
where as it should have been the new path.@p3c0 You're right! I didn't notice this.
@Ram_Thakkar77 in the screen-shot you posted you can see that the system tries to load Qt libs from /usr/lib. Check your script, putecho $LD_LIBRARY_PATH
after export LD_LIBRARY_PATH and post its output.
-
@p3c0 You're right! I didn't notice this.
@Ram_Thakkar77 in the screen-shot you posted you can see that the system tries to load Qt libs from /usr/lib. Check your script, putecho $LD_LIBRARY_PATH
after export LD_LIBRARY_PATH and post its output.
@jsulm, here is the screen shot of
echo $LD_LIBRARY_PATH
and its showing correct path.
Screen shot -
@jsulm, here is the screen shot of
echo $LD_LIBRARY_PATH
and its showing correct path.
Screen shot@Ram_Thakkar77 Please put missing libs (not only links!) in the directory as I said before. For example:
libQt5Core.so.5 libQt5Core.so.5.7.1