Qt 5.1.1 + 64bit ubuntu 13.10 standalone app



  • Hi,

    after 2 days of googling and su*king with compile, i decided to ask here.

    I have made simple music player as Qt Gui Application, that runs on my PC perfektly. But when i copy it into other PC where Qt libs is not installed, it gives segmentation fault error. So i searched for solution. Static linking..

    So i downloaded the qt-everywhere-opensource-src-5.1.0-rc2.zip, extracted it and configured with:
    @./configure -static -release
    make -j 4
    @

    After compile done, i added the libs using: Right click on project -> add library -> external library
    I reated this step for: libQt5Multimedia.a, libQt5Core.a, libQt5Gui.a

    my executable now had 14.8MB instead of 808kB.

    problem is, when i run the app, it says
    @Starting /home/erik/QtProjs/build-QtPlayer-Desktop_Qt_5_1_1_GCC_64bit-Release/ePlayer...
    Failed to load platform plugin "xcb". Available platforms are:

    The program has unexpectedly finished.
    /home/erik/QtProjs/build-QtPlayer-Desktop_Qt_5_1_1_GCC_64bit-Release/ePlayer exited with code 0@

    So i tried:
    @#include <QtPlugin>

    int main(int argc, char *argv[]) {
    Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
    ......
    @

    and i am getting undefined reference error, i saw this in bugreport, but theoretically this is fixed in RC2 and i am using rc2.

    So i have tried to build Qt with "-qt-xcb -nomake examples" but i got the same error (Failed to load....)

    Please help, i will be happy :-\

    Also i am interested in license how it works, Can i release this player for free to ubuntu software center? As opensource.

    Thank you.

    --- Edit ---

    My project file:

    @
    #-------------------------------------------------

    Project created by QtCreator 2013-10-25T12:26:07

    #-------------------------------------------------

    QT += core gui
    QT += multimedia

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = ePlayer
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    RESOURCES +=
    resources.qrc

    RC_FILE = myapp.rc

    CONFIG += static

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/release/ -lQt5Multimedia
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/debug/ -lQt5Multimedia
    else:unix: LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/ -lQt5Multimedia

    INCLUDEPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/include
    DEPENDPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/include

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/release/Qt5Multimedia.lib
    else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/debug/Qt5Multimedia.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtmultimedia/lib/libQt5Multimedia.a

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/release/ -lQt5Core
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/debug/ -lQt5Core
    else:unix: LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/ -lQt5Core

    INCLUDEPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/include
    DEPENDPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/include

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/release/Qt5Core.lib
    else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/debug/Qt5Core.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/libQt5Core.a

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/release/ -lQt5Gui
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/debug/ -lQt5Gui
    else:unix: LIBS += -L$$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/ -lQt5Gui

    INCLUDEPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/include
    DEPENDPATH += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/include

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/release/Qt5Gui.lib
    else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/debug/Qt5Gui.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../Downloads/qt-everywhere-opensource-src-5.1.0-rc2/qtbase/lib/libQt5Gui.a
    @


  • Moderators

    Qt is not standalone, it has multiple dependencies. Either install Qt5 prepared for your distro (it's likely to be outdated), or bundle Qt libs with your app (your current approach, but please mind the LGPL licensing issues with static linking), but then you still need to install the dependencies on the user's machine, too.

    For an overbloated (because it includes the dev packages, which are not needed by users) list of dependencies, see "link":http://qt-project.org/wiki/Building-Qt-5-from-Git.



  • I have installed all dependencies from the url you provided, before asking here.

    I am trying to bundle it, but i am extremly noob to license types. I builded the opensource editon not comercial.
    There is a player in software center named: qmmp, its qt4 based, when installed it have 6MB, not requires qt installed on system. and it does not install qt to system.

    i want to make my app like this. I am looking here for some guide how to do it. If its not possible i will throw Qt away and i will trying with c++ / python + gtk

    I am more java & php developer, everything what i know about linking libs and compiling c++ code is in my first post.

    Thanks for you answer


  • Moderators

    OK well this is such a broad topic that it's hard for me to give you a good, elaborate answer - I would have to write, and write, and write... ;)

    First: licensing. If your app is OpenSource/ Free software, you can safely use static compilation, so no worries there.

    In general, on Linux, shared libraries are preferred way of doing things, among with using package managers: so that all the user needs to do is to double click a .deb or .rpm package. Seems nice and easy, but is not so seamless on the development side: distros vary a lot.

    You can bundle everything together (it's MUCH easier with Qt4 than 5, though), there are several thread about it on this forum. I'll try to find some links and get back to you soon.


  • Moderators



  • Thank you for yout time and all answers, all of them was very usefull. i used maybe wrong keywords when searching for static compilation under linux.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.