[Help] Configure static compile with Qt 5.0.2
I build an GUI application based on Qt 5.0.2 in Ubuntu platfrom, then I copied the build folder into another Ubuntu machine and run it, but I got the error in terminal
bq. error while loading shared libraries: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory.
bq. error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
After take a look at Google, I figured out that the problem is about static compile (share library and static library). I try to do some instruction with older Qt version, but not successful.
Could everyone tell me how can I fix that problem or give me some ideas for configuring Qt 5.0.2 to be static compile? please.
thannk you so much
Please mind the license when attempting to compile statically. LGPL is restrictive in that regard. There are other ways to deploy an application without compiling it statically (LD_LIBRARY_PATH is one of them, or waiting for distros to include Qt5 in their repos). Also, Qt 5.0.2 can cause problems when compiled statically and if your app is using QML2.
You need to tell us how "not successful" you have been. What have you tried, what were the errors you've got?
I'm new in Qt, I've just used to Qt for 2 weeks and I don't know it clearly. Could you please tell me how to deploy it without compile statically? How can I use LD_LIBRARY_PATH? :(
When I'm at another computer without installing Qt and try to run my simple application. I used this command to see all shared library which my program need:
I realize that some missing library files. I copied manually the library files (pasted them into /usr/lib/i386-linux-gnu/) from computer which has intalled Qt to the target computer and try to run the program again. Finally, all of necessary library files are available, but I got the following error:
@Failed to load platform plugin "xcb". Available platforms are: @
@Aborted (core dumped)@
I need advices from you so much...
You need to copy the platform plugin, too (it was libqxcb.so, IIRC). And of course, install all dependencies. I'm not sure, for me it just works.
As for LD_LIBRARY_PATH - it's an env variable that tells the OS where to look for libraries. So you need to point it to where you have placed Qt libs (could be Qt installation dir, or your application's root folder - as you wish).
I appreciate your reply, Sierdzio
I tried and try so much, I coppied libqxcb.so into /usr/lib/i386-linux-gnu/ and trying load it in my project as well
@LIBS += "./libqxcb.so"@
But I got the same error
@Failed to load platform plugin "xcb". Available platforms are: Aborted (core dumped)@
I don't know what dependencies are...
Look forward to your reply
I copied platforms directory which contains libqxcb.so into my app folder and run my app again. It seems to realize some available platforms but cannot load it..
@Failed to load platform plugin "xcb". Available platforms are:
I've solved this problem.
I build my own library and uses LD_LIBRARY_PATH point to it.
@Failed to load platform plugin "xcb"@
I copy platforms directory from Qt and paste it into my project folder. It works.