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.
Re: Release my simple program to other users ?
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 !!!
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.
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.
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?
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..
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?
Re: Release my simple program to other users ?
pleas explain..
thanks in advance..
regards, aman..
Re: Release my simple program to other users ?
Quote:
Originally Posted by aMan
pleas explain..
As the docs say:
Quote:
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.