PDA

View Full Version : How can install Qwt & integrate with QtCreator on Ubuntu Linux ?



Kerubu
31st August 2009, 17:51
Hello,

I'm using QtCreator IDE installed from a binary downloaded from Qt. However I would like to use some Qwt widgets in my projects and would like to have them displayed in the Widget bar in Creator so I can drop-and-drag them into my forms.

I've downloaded the source for Qwt and it 'appears' that the necessary plugins to integrate with Creator are built when building the Qwt libraries, but I'm not sure. The instructions are a little vague and I'm no expert at this.

Could anyone help me please ? How can I integrate Qwt widgets so that they appear in Creator for me to drag-and-drop ?

Many thanks

Kerubu

Uwe
31st August 2009, 18:25
a) See http://doc.qtsoftware.com/4.5/plugins-howto.html
Check the section starting with "But where is the plugins directory ?".

b) Try ldd on the Qwt designer plugin in the same shell, where you start the creator and check if the Qwt library can be found

c) Enable QT_DEBUG_PLUGINS and you should see debug messages from
the creator on your console.


HTH,
Uwe

Kerubu
31st August 2009, 21:34
Thanks Uwe,

However I'm still as confused as I was before. I think the link you gave was to application plugins whereas I need to create a 'custom widget' (my terminology incorrect in my post ? ) I did find a link on the page you referred to though, although I still haven't managed to get qwt to integrate with creator. I've looked at the .pro files for qwt and there does appear to be commands to build plugins/custom widgets... al the correct macros and class interfaces are included. But as to how I get Creator to find them I don't know

Creator is great once it works,but getting it to work on linux is the problem. The instructions are a bit vague for linux and you almost have to have an in depth knowledge of Qt to install it.. which sadly I do not have

Ah well maybe I'll jsut have to try hard-coding the stuff

Uwe
1st September 2009, 06:32
However I'm still as confused as I was before. I think the link you gave was to application plugins whereas I need to create a 'custom widget' Qt creator is a Qt application itsself and the Qwt designer plugin is the application plugin the creator has to load. The link shows how any Qt application finds plugins, what is the same what the creator does to find the Qwt designer plugin.

Uwe

Kerubu
1st September 2009, 13:15
I'm sorry to be a pain Uwe but I'm no further forward. This is what I have done :

1) Built qwt as described in the INSTALL file. This has resulted in a directory '/usr/local/qwt-5.2.0' underneath which is directories for doc, include and lib. There also appears to be libqwt_designer_plugin.so in the directory '/usr/lib/qt4/plugins/designer' (I assume this is the plugin I Creator has to load so that qwt widgets appear in the toolbar ?)

2) I incuded the following in my .profile :


QT_DEBUG_PLUGINS=1
export QT_DEBUG_PLUGINS
QT_PLUGIN_PATH="/usr/lib/qt4/plugins/designer" # Point toward qwt plugin ?
export QT_PLUGIN_PATH


3)When starting up ./qtcreator from shell gives this output :


QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/sqldrivers/libqsqlite.so"
keys ("QSQLITE")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/iconengines/libqsvgicon.so"
keys ("svg", "svgz", "svg.gz")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/iconengines/libqsvgicon.so"
keys ()
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqgif.so"
keys ("gif")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqico.so"
keys ("ico")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqjpeg.so"
keys ("jpeg", "jpg")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqmng.so"
keys ("mng")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqsvg.so"
keys ("svg")
QFactoryLoader::QFactoryLoader() looking at "/home/kerubu/qtsdk-2009.03/bin/imageformats/libqtiff.so"
keys ("tiff", "tif")


5)QtCreator is installed in '~/qtsdk-2009.03/bin'. I tried


ldd qtcreator.bin
linux-gate.so.1 => (0xb7f0f000)
libExtensionSystem.so.1 => /home/kerubu/qtsdk-2009.03/bin/../lib/qtcreator/libExtensionSystem.so.1 (0xb7ee8000)
libAggregation.so.1 => /home/kerubu/qtsdk-2009.03/bin/../lib/qtcreator/libAggregation.so.1 (0xb7ee3000)
libQtGui.so.4 => /home/kerubu/qtsdk-2009.03/bin/../lib/libQtGui.so.4 (0xb74e2000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb745b000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb741d000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb7414000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb73fc000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb73f1000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb73c4000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb73b4000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb72c5000)
libQtNetwork.so.4 => /home/kerubu/qtsdk-2009.03/bin/../lib/libQtNetwork.so.4 (0xb71a0000)
libQtCore.so.4 => /home/kerubu/qtsdk-2009.03/bin/../lib/libQtCore.so.4 (0xb6f4a000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6f44000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb6f3b000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb6e83000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb6e7f000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb6e65000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6d76000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb6d50000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6d41000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb6bde000)
libQtXml.so.4 => /home/kerubu/qtsdk-2009.03/bin/../lib/qtcreator/../libQtXml.so.4 (0xb6b96000)
libz.so.1 => /lib/libz.so.1 (0xb6b80000)
libpcre.so.3 => /lib/libpcre.so.3 (0xb6b4e000)
libuuid.so.1 => /lib/libuuid.so.1 (0xb6b49000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb6b22000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb6b1d000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb6b03000)
/lib/ld-linux.so.2 (0xb7f10000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6afe000)


But I'm not sure if that is what you meant in your earlier post. If it is, then as you can see qwt is not listed.

Finally you should know I installed the SDK as a binary rather than build individually the Qt libraries and Creator.

Sorry to be a pain but I'm really confused about how to get plugins working.

Kerubu
2nd September 2009, 23:54
OK I've spent the whole day and evening trying unsuccessfully to get Qwt to work with the latest Creator 1.2.1

I found that there is an Ubuntu package for creator 1.0.0 and that qt4.5.0 is automatically installed when installing Ubuntu although the package for creator is only available for Ubuntu 9.04. I need Qt for both 8.10 and 9.04 so I tried installing the package on my 9.04 machine. I also found that Qwt runtime is also automatically loaded when installing Ubuntu but not the development package, so I installed that.. and low and behold there are the Qwt widgets in Creator 1.0.0 !

So with fresh enthusiasm I attempted to build and install the Qt example customwidget (http://qt.nokia.com/doc/4.5/designer-customwidgetplugin.html).. and success.. the widget appears on the toolbar !!

So then I tried to build qwt from source. I first removed the development package then followed the instructions as given in the INSTALL file.

FAIL ! No Qwt widgets at all.

I then tried various things all to no avail, then I thought perhaps it has something to do with the versions on Qt and Qwt runtimes, so I removed all traces of Qt and Qwt Ubuntu packages, and installed the SDK. First running the binary to install Creator and then building from source Qt itself.

I then tried a clean build of Qwt from the source, checkin the .pro and .pri files which appeared to be ok. Did a 'make install' then run Creator. Guess what ?

NOTHING.

Checked the plugin directory for the qwt '/usr/local/Trolltech/Qt-4.5.2/plugins/designer/ and there's the plugin.

Next I thought I'd try to build the example from before.. the simple custom widget. Checked the directory as above.. and there's the plugin. The I realised that's the plugins for Qt.. I need to check the plugins for Creator, which are under a different directory, and sure enough the plugin is missing. So a quck change to 'target.path' to point at the plugin directory for Creator, re build and there it is in Creator !

So I changed the target.path in designer.pri to that one too.. guess what..

NOTHING !

The plugin appears in the directory but no widgets in Creator ?

Why is it so hard to install Qwt ???????:confused:

Uwe
3rd September 2009, 06:55
I tried


ldd qtcreator.bin

But I'm not sure if that is what you meant in your earlier post. If it is, then as you can see qwt is not listed.

Of course you have to check the plugin not the creator binary. Try "ldd /../../libqwt_designer_plugin.so".
If the Qwt library is not resolved you have to set the LD_LIBRARY_PATH ( or see man ldconfig ).

Also check the log messages of the creator about the directory of the Qwt designer plugin.

Uwe

Kerubu
3rd September 2009, 16:25
OK Finally success !


ldd libqwt_designer_plugin.so

resulted in :


libqwt.so.5 => not found

Well had to do a bit of reading around to get an understanding of libraries etc and static and shared libraries and to comprehend what 'LD_LIBRARY_PATH' does.

Unfortunately setting 'LD_LIBRARY_PATH' in ~/.profile in Ubuntu doesn't work, as described here. (https://bugs.launchpad.net/ubuntu/+bug/366728) Trying various things didn't work except setting LD_LIBRARY_PATH on the command line e.g. :


export LD_LIBRARY_PATH=/usr/local/qwt-5.2.0

As this must be done manually at every login I don't regard this as a satisfactory solution, so I simply changed the qwtconfig.pri to install the libraries in standard linux locations :



...
unix {
#Change the the install base to standard Linux locations otherwsie LD_LIBRARY_PATH needs
#to be defined but this environment variable doesn't work - bug #366728 or security measure ?
#INSTALLBASE = /usr/local/qwt-5.2.0
INSTALLBASE = /usr
}

win32 {
INSTALLBASE = C:/Qwt-5.2.0
}

target.path = $$INSTALLBASE/lib
headers.path = $$INSTALLBASE/include
#doc.path = $$INSTALLBASE/doc
doc.path = /usr/local/qwt-5.2.0/doc
...

I also altered the designer.pro file as the plugin didn't seem to appear in the plugin directory, so I manually added the full target.path :


target.path = /home/kerubu/qtsdk-2009.03/bin/designer

Now everything works !

Uwe, as this seems to be a problem with Ubuntu you might want to put some link on your home page to this posting or I can send you a list of steps that I took to get Qwt working :o)

Thanks for keeping on nudging me in the right direction, at least I understand more now about shared libraries !

Uwe
4th September 2009, 07:45
As this must be done manually at every login I don't regard this as a satisfactory solution, so I simply changed the qwtconfig.pri to install the libraries in standard linux locations :
Or check the man page of ldconfig. Another option is to set LD_LIBRARY_PATH in your ~/.xinitrc.


Uwe, as this seems to be a problem with Ubuntu you might want to put some link on your home page to this posting or I can send you a list of steps that I took to get Qwt working :o)

Well a missing configuration of the dynamic loader is not a problem of the distribution. IMHO the source of the problem is the Qt creator/designer, that silently ignores the plugins leaving the user without any hint.

Uwe

UsenetCoder
13th November 2009, 19:06
Where You add this line? To which file?



target.path = /home/kerubu/qtsdk-2009.03/bin/designer

I Try use Your solution to run QT with QWT but i still have error :
error while loading shared libraries: libqwt.so.5: cannot open shared object file: No such file or directory

Kerubu
13th November 2009, 19:31
Where You add this line? To which file?



target.path = /home/kerubu/qtsdk-2009.03/bin/designer

I Try use Your solution to run QT with QWT but i still have error :
error while loading shared libraries: libqwt.so.5: cannot open shared object file: No such file or directory

From here :


I also altered the designer.pro file as the plugin didn't seem to appear in the plugin directory, so I manually added the full target.path :


target.path = /home/kerubu/qtsdk-2009.03/bin/designer