PDA

View Full Version : How to create package for a Qt4 application in linux..?



archanasubodh
29th February 2008, 10:46
Hi guys,

i am trying to create package for my Qt4 application which is developed and to be run on Linux ( Ubuntu or Opensuse 10.2 ). I have a software called "Install Anywhere x.x" for packaging , so please tell me what are all the Qt4 dependent files ( in LINUX ) i have to supply with my executable , so that my client need not to install Qt4 in his machine.

So please list out the Qt4 dependent files (in Opensuse 10.2 ) ,and from which folder i will get these dependent files...

Thanks in advance

wysota
29th February 2008, 10:53
I suggest you compile your application in static mode and forget about dependencies. Otherwise you'll have to deliver half of the system if you want to cover all possibilities. If you want a shared compilation, I suggest you assume Qt4 is already installed on that machine (Qt4 is an optional module of Linux Standard Base, so it should be there) and simply deploy your application files only.

archanasubodh
29th February 2008, 11:53
We do not want to statically link the module because of performance issues.
To consider shared compilation ,the client machine does not have Qt4 installed,so that is the reason we want to set up a package.
Do let us know all the dependent dlls and files that we need to include in our package so that our QT4 application runs on Opensuse 10.2 machine.


Thank You.

wysota
29th February 2008, 12:16
We do not want to statically link the module because of performance issues.
Performance issues? Static applications are faster than shared ones because there is no dynamic linking stage when the application is executed. The only penalty is a bigger memory footprint.


Do let us know all the dependent dlls and files that we need to include in our package so that our QT4 application runs on Opensuse 10.2 machine.

Compile the application and run ldd on the resulting binary and you'll get your dependency list. Then you have to decide which libraries to assume "always present", such as glibc. Others you have to ship yourself in appropriate versions.

joseph
3rd March 2008, 05:49
I suggest you compile your application in static mode and forget about dependencies. Otherwise you'll have to deliver half of the system if you want to cover all possibilities. If you want a shared compilation, I suggest you assume Qt4 is already installed on that machine (Qt4 is an optional module of Linux Standard Base, so it should be there) and simply deploy your application files only.


Could you please tell me how to compile the application in STATIC MODE .I am working in Kdevelop ( IDE in Linux ). Which option i need to select to get it compiled in STATIC MODE..?

thanks in advance

sunil.thaha
3rd March 2008, 06:52
Offtopic: You have posted this in the wrong section !!
And here is what you asked for( already in our wiki ) http://wiki.qtcentre.org/index.php?title=Building_static_applications

joseph
4th March 2008, 11:29
I did build Qt4.3.4 as per the insturctions in the site ...
http://wiki.qtcentre.org/index.php?title=Building_static_applications

what i did ...
=> downloaded the Qt4.3.4 soure code ( for Linux )from Trolltech site
=> created a seperated directory for like this in my home directory
Qt-4.3.4_Static

=> typed the following commands
1) cd Qt-4.3.4_Static [ for switching to Qt-4.3.4_Static ]
2) ./configure -static -release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg
3) make sub-src
4) su
5) make install_qmake
6) make install_mkspecs

Now system created directory - "Trolltech/Qt-4.3.4/" - inside /usr/local .
Now i want to set the PATH variable like this in /etc/profile ..

PATH = "/home/myname/Qt-4.3.4_Static/bin: $PATH" ....is it ok ...??


My doubt is if in future if i want to use shared library of Qt4 ( which was default in Opensuse ) ,which is the path i need to update in the PATH variable ...?? ( because the default path of the default version of Qt4 in Opensuse is /usr/lib/qt4 ,and there is NO bin folder inside this qt4 )

Please tell me how to switch to "Shared Qt4 Library" and "Static Qt4 Library" ...??

Thanks in advance

wysota
4th March 2008, 12:42
Please tell me how to switch to "Shared Qt4 Library" and "Static Qt4 Library" ...??

Just make sure the set of libraries (and tools) of your choice is earlier in the PATH (or library path). By manipulating the path you decide which set of libs will be used for compilation.

joseph
5th March 2008, 06:50
I have build Qt4.3.4 version statically using the instuctions given in wiki

Here is the my Qt static diectory



/home/myname/qt4.3.4_Static



Inside this folder i can see the following sub folders


1) bin ==> contains qmake , rcc , findtr, uic ,uic3...etc
2) lib ==> conatins so many *.so files


At present my PATH varibale contains the the following ( ie; the result of "echo $PATH" )



/usr/local/bin
:/usr/bin
:/usr/X11R6/bin
:/bin
:/usr/games
:/opt/gnome/bin
:/opt/kde3/bin
:/usr/lib/jvm/jre/bin
:/usr/lib/mit/bin
:/usr/lib/mit/sbin
:/usr/lib/qt3/binv




i have 2 options in my mind as follwing ...


1) export PATH = " /home/myname/qt4.3.4_Static/bin :$PATH"
or
2) export PATH = " /home/myname/qt4.3.4_Static/lib :$PATH"


so please tell me tell me which option i have to add in the PATH variable to get a static application liked with the static qt4.3.4 library ...


please help me..!!!!

wysota
5th March 2008, 06:54
The one containing bin. BTW. You could have tried both yourself instead of asking this here.

joseph
5th March 2008, 08:27
I set the PATH variable to...


export PATH="/home/myname/Qt4.3.4_Static/bin:$path"


Then compiled the my application after editing the *.pro file like this


CONFIG += static


Then i checked the dependency files of EXE using command


ldd myexecutablefile


I got a list of files as follows ,which is same when i buid my application in dynamic mode ( ie; no CONFIG += static in pro file )



linux-gate.so.1 => (0xffffe000)
libQt3Support.so.4 => /usr/lib/libQt3Support.so.4 (0xb7c28000)
libQtSql.so.4 => /usr/lib/libQtSql.so.4 (0xb7bf1000)
libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0xb7bad000)
libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0xb7b53000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0xb7480000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb745c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb7452000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb7439000)
libXi.so.6 => /usr/lib/libXi.so.6 (0xb7430000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb7427000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7421000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb741b000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7411000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb740d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb73a1000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7375000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb7366000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7249000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0xb70cb000)
libz.so.1 => /lib/libz.so.1 (0xb70b8000)
libdl.so.2 => /lib/libdl.so.2 (0xb70b4000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb709b000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6fb7000)
libm.so.6 => /lib/libm.so.6 (0xb6f91000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6f85000)
libc.so.6 => /lib/libc.so.6 (0xb6e57000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6e50000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb6e4c000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb6e2b000)
/lib/ld-linux.so.2 (0xb7f3d000)


One more thing is, the size of the executable-file is not increased after building it in static mode. It's only 23.9 MB , previously(dynamic mode) it was 29.4 MB

But how can i confirm that my application got generated succussfully in STATIC mode ...?

wysota
5th March 2008, 08:46
29MB executable build in dynamic mode? I think that's with debugging turned on, isn't it?

By the way - the ldd above states Qt is linked in dynamic mode :)

jpn
5th March 2008, 08:53
What's the point of make installing qmake and mkspecs only?

joseph
5th March 2008, 10:02
What's the point of make installing qmake and mkspecs only?



i did the following to build Qt4.3.4 in staic mode ( as per the instructions in site




./configure -static -release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg

su
make install_qmake
make install_mkspecs
make sub-src-install_subtargets ====> here i was getting some error message


Now what happening is . i was trying to compile my application from consile i did the following commands in terminal



=> which uic
home/myname/qt4.3.4_Staic/bin/uic
=> which make
/usr/bin/make
=> which qmake
home/myname/qt4.3.4_Staic/bin/qmake


Then i changed directory to my application ( say "My_App_Dir" ) and typed the comamnds



> qmake myFile.pro
> make clean
> make ==============> here am gettin errors like

/usr/local/Trolltech/Qt-4.3.4/bin/uic dlg/SynsupMailDlg.ui -o ../source/dlg/ui_SynsupMailDlg.h
make: /usr/local/Trolltech/Qt-4.3.4/bin/uic: Command not found
make: *** [../source/dlg/ui_SynsupMailDlg.h] Error 127




why it is taking the uic from "/usr/local/Trolltech/Qt-4.3.4/bin/uic" ...?


Please help to solve this ...

wysota
5th March 2008, 10:06
What kind of errors were you getting?

joseph
5th March 2008, 10:20
What kind of errors were you getting?

if you are aking the errors i got in


make sub-src-install_subtargets


sorry i don't remember . Please tell me how to uninstall this qt_4.3.4_Static verion from my machine atleast.

I will rebuild Qt4 static version one more time ,and i will let you know what was the error.


Thanks in advance

wysota
5th March 2008, 11:48
Please tell me how to uninstall this qt_4.3.4_Static verion from my machine atleast.
Delete the directory containing the installation.

joseph
6th March 2008, 06:23
I am rebuilding Qt4.3.4 in STATIC mode , and type the command in my static directory called qt4.3.4_Static.



./configure -static -release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg


Now i am getting the following message


Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.3.4

To reconfigure, run 'gmake confclean' and 'configure'.



I don't know what i have to do next, either "gmake" or "make sub-src" ( as per the wiki.qtcentre.org ).

So can you people guid me to the right path ...?

jpn
6th March 2008, 06:35
gmake = GNU make, just invoke the command which is proposed.

Compiling sub-src target is advised because (as it says on wiki):

If you only type make (without the sub-src) then all examples and all demos will be build. With static libs this takes very much space (A test got about 3.8GiB big and it wasn't finished yet.), so I really don't recommend that way.

joseph
6th March 2008, 07:34
gmake = GNU make, just invoke the command which is proposed.

Compiling sub-src target is advised because (as it says on wiki):

After the following command ....


/configure -static -release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg

I can see a new folder "Trolltech" got created in the following way...


/usr/local/Trolltech ===========> Here also one "bin" folder is there .So should i update this bin folder in PATH variable ....?

The next step i did was..............


make sub-src
su
make install_qmake

**********message after this is ***********
install -m 755 -p /home/myname/qt4.3.4_Static/bin/qmake /usr/local/Trolltech/Qt-4.3.4/bin/
strip /usr/local/Trolltech/Qt-4.3.4/bin/qmake

Next step ....


make install_mkspecs
**********message after this is ***********

rm -f /usr/local/Trolltech/Qt-4.3.4/mkspecs/default; ln -sf linux-g++ /usr/local/Trolltech/Qt-4.3.4/mkspecs/default
install -m 644 -p /home/myname/qt4.3.4_Static/mkspecs/qconfig.pri /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/aix-g++ /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/aix-g++-64 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/aix-xlc /usr/local/Trolltech/Qt-4.3.4/mkspecs/

cp -f -r /home/myname/qt4.3.4_Static/mkspecs/freebsd-g++ /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/freebsd-g++34 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hpux-acc /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hpux-acc-64 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hpux-g++-64 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hpuxi-acc-32 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hpuxi-acc-64 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/hurd-g++ /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/linux-cxx /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/linux-ecc-64 /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/linux-icc /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/linux-icc-32 usr/local/Trolltech/Qt-4.3.4/mkspecs/

cp -f -r /home/myname/qt4.3.4_Static/mkspecs/win32-msvc.net /usr/local/Trolltech/Qt-4.3.4/mkspecs/
cp -f -r /home/myname/qt4.3.4_Static/mkspecs/win32-msvc2005 /usr/local/Trolltech/Qt-4.3.4/mkspecs/



Next step is ....


make sub-src-install_subtargets

**********message after this is ***********
make: *** No rule to make target `sub-src-install_subtargets'. Stop. =====>> How can i solve this error ....?




Please help me ..!!!!

Thanks for all your support

wysota
6th March 2008, 08:30
Did you call "make sub-src"?

joseph
6th March 2008, 11:41
Let me thank you all people ,especially to sunil thaha ,wysota , JPN ,who has given me the right link .

Here is what i did to build Qt4.3.4 in STATIC mode .
1) Downloaded qt4.3.4 from trolltech site
2) Copied to new folder Qt4.3.4_Static ( to differentiate dynamic version of Qt4.x which is already installed in my machine )
3) Changed folder to qt4.3.4_Static ie; ( cd /home/myname/qt4.3.4_Static )
4) typed the following command ...


./configure -static -release -nomake demos -nomake examples -nomake tools
make
su //for switching to root user
make install


N:B=> After the command 1-st command ./configure -static -release -nomake demos -nomake examples -nomake tools ,the system will create a directory called Trolltech in the path /usr/local.

N:B=> After the command make install , if you are going to the directory /usr/local/Trolltech/Qt-4.3.4/bin, you can see the following executable files....
=> qmake,uic3 ,uic ,moc , rcc

5) Edit the PATH variable in /etc/profile ,to call the qmake from the new directory ( /home/myname/qt4.3.4_Static/bin )


export PATH="/home/myname/qt4.3.4_Static/bin:$PATH"

6) Then finally i compiled the my application successfully using the following ..


/home/myname/qt4.3.4_Static/bin/qmake myfile.pro
make clean
make

7) Now checking the dependency ( of qt libraries ) in my executable file.

ldd myExecutableFile

i could see the following in console after ldd command ...


linux-gate.so.1 => (0xffffe000)
libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0xb7f81000)
libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0xb7e4e000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7e2a000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb7e20000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb7e06000)
libXi.so.6 => /usr/lib/libXi.so.6 (0xb7dfd000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb7df4000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7def000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb7de9000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7ddf000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb7dda000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7d6e000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7d43000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb7d34000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7c17000)
libz.so.1 => /lib/libz.so.1 (0xb7c03000)
libgthread-2.0.so.0 => /opt/gnome/lib/libgthread-2.0.so.0 (0xb7bfe000)
libglib-2.0.so.0 => /opt/gnome/lib/libglib-2.0.so.0 (0xb7b69000)
librt.so.1 => /lib/librt.so.1 (0xb7b60000)
libdl.so.2 => /lib/libdl.so.2 (0xb7b5c000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7b44000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7a5f000)
libm.so.6 => /lib/libm.so.6 (0xb7a39000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7a2d000)
libc.so.6 => /lib/libc.so.6 (0xb78ff000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb78f9000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb78f4000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb78d3000)
/lib/ld-linux.so.2 (0xb7fe3000)



I think there is no dependent qt files for myExecutableFile

joseph
6th March 2008, 11:57
Can anybody explain what's the difference between the following statements...


1) ./configure -static -release -nomake demos -nomake examples -nomake tools

2) ./configure -static -release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg


Why i am asking because i got application build using the 1-st command , so just wanted to know will there be any problem for the 1-st command

Thanks for all help

jpn
6th March 2008, 11:58
See

./configure -help
and make sure to read it carefully.

wysota
6th March 2008, 12:20
You should have issued configure with -prefix where/to/install/Qt, you know... Currently you have qmake in your home directory and the rest in /usr/local/Trolltech/...