Results 1 to 10 of 10

Thread: Release my simple program to other users ?

  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Release my simple program to other users ?

    I am using Mandriva Linux and Qt-4.1.1

    I just created this very simple program:
    ---------------------------------------------------------
    # include <QApplication>
    # include <QPushButton>

    int main(int argc, char* argv[])
    {
    QApplication application(argc, argv);
    QPushButton btn_hello("Hello World");
    btn_hello.resize(150, 100);
    btn_hello.show();
    return application.exec();
    }
    --------------------------------------------------------

    The program works fine. I would like to give this program to my friends, but they don't have the Qt libraries in their Linux computers, or perhaps they have it, but only with Qt-3.x support.

    How do I compile this program as static, so I can just pass it to other persons and know that it will work ?

    Please post some compilation code if possible.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Release my simple program to other users ?


  3. #3
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    You mean that I should recompile everything again from source ?

    It took me over 3 hours to compile it and install it !!!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Release my simple program to other users ?

    I'm sorry. If you want to statically link your application, you have to have static libraries. An alternative to static linking is to distribute your application with all the required shared libs.

  5. #5
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    Quote Originally Posted by probine
    You mean that I should recompile everything again from source ?

    It took me over 3 hours to compile it and install it !!!
    Well then, save yourself some hassle and just bundle it with the shared libs. If you're on UNIX, be sure to provide a small script that sets the LD_LIBRARY_PATH, so that your prog can find them.
    Save yourself some pain. Learn C++ before learning Qt.

  6. #6
    Join Date
    Jul 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Release my simple program to other users ?

    So how about the dimensions?
    While I don't know about LD_LIBRARY_PATH and distributing the libraries on Unix, on Windows I only pasted the 3 libraries in the executable directory, that means more than 5 MB .dll and a 70 kB .exe . So what would be the method to make the executable a little bigger (to include the parts from the libraries) and to be stand-alone?

  7. #7
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    when you compile qt from source statically, then be sure not to compile the examples and the demos. these take very much disk space (maybe 700 MiB). i've commented them out in some files (don't remeber which ones) and then it went much faster..

    a very small program, statically linked, was about 5 mb..

    regards, aman..

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    Quote Originally Posted by aMan
    when you compile qt from source statically, then be sure not to compile the examples and the demos. [...] i've commented them out in some files (don't remeber which ones) and then it went much faster..
    Maybe "make sub-src" would be enough?

  9. #9
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    pleas explain..
    thanks in advance..

    regards, aman..

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release my simple program to other users ?

    Quote Originally Posted by aMan
    pleas explain..
    As the docs say:
    Building Qt Statically
    To use this approach, you must start by installing a static version of the Qt library:
    cd /path/to/Qt
    ./configure -static -prefix /path/to/Qt <other parameters>
    make sub-src
    We specify the prefix so that we do not overwrite the existing Qt installation. The example above only builds the Qt libraries, i.e. the examples and Qt Designer will not be built.

  11. The following 3 users say thank you to jacek for this useful post:

    aMan (10th July 2006), arnaiz (10th July 2006), ntp (11th July 2007)

Similar Threads

  1. realtime_plot example problem--help needed.
    By swamyonline in forum Qwt
    Replies: 8
    Last Post: 17th July 2008, 19:12
  2. QHttp simple program doesn't work
    By johncharlesb in forum Qt Programming
    Replies: 0
    Last Post: 4th April 2008, 04:18
  3. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19
  4. Writing a simple Draw program
    By neomax in forum General Discussion
    Replies: 1
    Last Post: 23rd November 2006, 06:53
  5. preparing program for release
    By impeteperry in forum Installation and Deployment
    Replies: 5
    Last Post: 22nd April 2006, 19:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.