how to statically compile a program with qt libs?linux platform
I learned that I could statically compile qt libs and then statically compile my program.
I have statically compiled qt libs and I want to statically compile my program.
for example,if I need
QtXml,QtCore,QtGui,phonon,
and I have these libs of *.a files under /opt/qtstatic/lib,
how do I write my .pro file to statically compile my program?
also I wrote my program in a dynamic qt environment,do I need to make any change to my source code?
thx
Re: how to statically compile a program with qt libs?linux platform
you don't have to do changes in your source code, you only have to to add in your pro file.
Re: how to statically compile a program with qt libs?linux platform
Quote:
Originally Posted by
Lykurg
you don't have to do changes in your source code, you only have to to add
in your pro file.
I'm sorry but:
I tried it but it seems nothing changed,the program still can't be used on a computer without qt.
Do i need to specify the location of those static libs in .pro file?
Re: how to statically compile a program with qt libs?linux platform
no that's all. Of course you must use the qmake of your static build, that the right libraries get bound. For Linux also have a loot at: [WIKI]Building static applications[/WIKI].
Re: how to statically compile a program with qt libs?linux platform
Quote:
Originally Posted by
Lykurg
no that's all. Of course you must use the qmake of your static build, that the right libraries get bound. For Linux also have a loot at: [WIKI]Building static applications[/WIKI].
well,following your help,it is OK now,
I didn't make install_qmake before,I think that is the reason why I failed.
May I ask you another question?
After statically build my program,the phonon backend module doesn't work,
it works when I use dynamic build,
What should I do to make it work?
thx again.
Re: how to statically compile a program with qt libs?linux platform
You need to static link all the phonon plugins too of course.
And all the other plugins you use too (image formats, etc...)
Re: how to statically compile a program with qt libs?linux platform
Quote:
Originally Posted by
tbscope
You need to static link all the phonon plugins too of course.
And all the other plugins you use too (image formats, etc...)
May I ask How to static link those plugins?
Do I need to reconfigure qt adding argument
-phonon-backend?
or are there any other way?
thx
Re: how to statically compile a program with qt libs?linux platform
I found that most of those plugins in my static qt directory has .a files
but /plugins/phonon_backend is an exception
there is only a libphonon_gstreamer.so in it,no .a file!
and then I configured and made again with argument -static -phonon-backend
but it didn't change anything
then I look into the shared qt dirctory installed by the .bin file I downloaded from qt's website.
Look in /qt/plugins/phonon_backend ,there is also no .a file while all the other folders in that directory has both .a and .so files of the same name
So I am totally confused now
I have found that static compile can solve my original problem
!!!but the problem now I think is that
I statically compile qt,but I can't get a static phonon_backend lib
what's wrong with my Qt?will a totally reinstall and remake for static solve this problem?
plz help me.
best wishes to everyone.
I hate confusion really.
Re: how to statically compile a program with qt libs?linux platform
I found the answer in qt's document.
http://doc.qt.nokia.com/4.7-snapshot/plugins-howto.html
it say that static program can only link static plugins.
and qt doesn't provide static phonon_backend plugin,
so I can't build a static program with phonon backend.
thank you everyone for your answer.
best wishes.