Labels

20/10/2010

Install Qwt in Ubuntu

(link to Install Qwt in Gumstix)

System info:
Ubuntu 10.04 (lucid)
Kernel 2.6.32-26-generic
Qwt: 5.21

Qwt library contains lots of GUI components, such as 2D plot widget.

Download .tar.gz file, extract it. go to that folder:
(PS: qwt-6.0.0-rc3 is quite buggy, use qwt-5.2.1)

$ cd qwt-6.0.0-rc3
$ qmake
$ make

Then, error occurs:


cd src/ && /usr/bin/qmake /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src/src.pro -unix -o Makefile
cd src/ && make -f Makefile 
make[1]: Entering directory `/home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src'
compiling qwt_abstract_scale_draw.cpp
In file included from qwt_abstract_scale_draw.h:13,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_global.h:13:21: error: qglobal.h: No such file or directory
In file included from qwt_scale_div.h:14,
                 from qwt_abstract_scale_draw.h:14,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_interval.h:15:20: error: qdebug.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:14,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_scale_div.h:15:19: error: qlist.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:15,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_text.h:14:21: error: qstring.h: No such file or directory
qwt_text.h:15:19: error: qsize.h: No such file or directory
qwt_text.h:16:19: error: qfont.h: No such file or directory
In file included from qwt_abstract_scale_draw.cpp:11:
qwt_math.h:26:20: error: qpoint.h: No such file or directory
qwt_math.h:27:19: error: qmath.h: No such file or directory

...

When I installed Qt4 creator, it didn't install qt library and source files into the Ubuntu library system. When I use qt creator to compile a program, it uses it's own library files, not the system library files. When I "make" qwt, it is looking for the system library files (and head files .h)

Search the qt4 development installation files, which will install all qt4 library file and source file into system library.

$ apt-cache search qt4-dev

libqwt5-qt4-dev - Qt4 widgets library for technical applications (development)
libsmokeqt4-dev - development files for Qt 4 Smoke library
pyqt4-dev-tools - Development tools for PyQt4
python-qt4-dev - Development files for PyQt4
freecad-doc - FreeCAD documentation
libntrack-qt4-dev - Development package for libntrack-qt4
libqglviewer-qt4-dev - an OpenGL 3D viewer library based on Qt4 - development files
libqwtplot3d-qt4-dev - 3D plotting library based on Qt4/OpenGL (development)
libsoqt4-dev - Qt4 GUI component toolkit for Inventor - development
libsource-highlight-qt4-dev - Syntax highlighting library for Qt (development files)
libtelepathy-qt4-dev - Qt 4 Telepathy library (headers and static library)
libtulip-qt4-dev - Tulip graph library - Qt/OpenGL GUI development files
libvtk5-qt4-dev - Visualization Toolkit - A high level 3D visualization library
libavahi-qt4-dev - Development headers for the Avahi Qt 4 integration library
libpoppler-qt4-dev - PDF rendering library -- development files (Qt 4 interface)
libqt4-dev - Qt 4 development files
libqt4-qt3support - Qt 3 compatibility library for Qt 4
libqt4-sql - Qt 4 SQL module
qt4-dev-tools - Qt 4 development tools
qt4-doc - Qt 4 API documentation
qt4-doc-html - Qt 4 API documentation (HTML format)


$ sudo apt-get install libqt4-dev

then try install again:

$ qmake qwt.pro
$ make
$ sudo make install

done!

run Qt4 creator, no qwt widget!
google a round, need to copy libqwt lib file to Qt plugin folder:
$ cp /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/qtsdk-2010.04/bin/designer

run Qt4 creator, still no new widget!

$ cd /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer
$ ldd libqwt_designer_plugin.so

linux-vdso.so.1 =>  (0x00007fff92bff000)
libqwt.so.6 => not found
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f4205968000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f420571b000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f42049a1000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f42044cb000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f4203c76000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4203a59000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4203745000)
libm.so.6 => /lib/libm.so.6 (0x00007f42034c1000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f42032aa000)
libc.so.6 => /lib/libc.so.6 (0x00007f4202f27000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f4202d21000)
librt.so.1 => /lib/librt.so.1 (0x00007f4202b19000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f420283b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f42025b4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f420236c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f4202163000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f4201f47000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f4201d3d000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f4201b08000)
libz.so.1 => /lib/libz.so.1 (0x00007f42018f0000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f42016de000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f42013a8000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f42011a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4206076000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f4200f75000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f4200d6f000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f4200b46000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f420092a000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f4200725000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f420051f000)


this means the libqwt lib files (libqwt.so.6 libqwt.so.6.0 etc) has not been installed in system library, which is in /usr/lib64 (I am using 64bit Ubuntu)
$ sudo cp -a /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/lib/* /usr/lib64
$ ldd /home/czhang/qtsdk-2010.04/bin/designer/libqwt_designer_plugin.so

linux-vdso.so.1 =>  (0x00007fff823ff000)
libqwt.so.6 => /usr/lib/libqwt.so.6 (0x00007f38ab037000)
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f38aab6e000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f38aa921000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f38a9ba7000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f38a96d1000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f38a8e7c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f38a8c5f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f38a894b000)
libm.so.6 => /lib/libm.so.6 (0x00007f38a86c7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f38a84b0000)
libc.so.6 => /lib/libc.so.6 (0x00007f38a812d000)
libQtSvg.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtSvg.so.4 (0x00007f38a7ecd000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f38a7cc8000)
librt.so.1 => /lib/librt.so.1 (0x00007f38a7abf000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f38a77e1000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f38a755b000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f38a7312000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f38a7109000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f38a6eee000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f38a6ce3000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f38a6aae000)
libz.so.1 => /lib/libz.so.1 (0x00007f38a6897000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f38a6684000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f38a634e000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f38a614a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f38ab569000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f38a5f1b000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f38a5d16000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f38a5aec000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f38a58d0000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f38a56cc000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f38a54c5000)

run Qt4 creator, sweat, see them!

After add a Qwt widget, built project, get some error messages:


error: undefined reference to 'QGraphicsItemPrivate::height() const'            libQtSvg.so.4
error: undefined reference to 'QListData::detach(int)'                                    libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setWidth(double)'       libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::width() const'              libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setHeight(double)'      libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetHeight()'              libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetWidth()'               libQtSvg.so.4
error: undefined reference to 'QListData::detach_grow(int*, int)'                  libQtSvg.so.4
error: collect2: ld returned 1 exit status

google around, found i need to add link to QtSvg in .pro file

LIBS += -L/usr/local/lib -lQtSvg

build program, good.


*==============================*
The following QWT installation guide is contributed by Tulga. After a long struggle on fighting with QWT, Tulga installed QWT successfully on Ubuntu :) good job!

"anyone needs fully operational qwt install guide on qwt?? I made one! I'm ready to share with all of you my 2 day nervebraking job. In the end: this whole thing is so easy, when you have right information! The only thing, that above tutorial is missing is the "sudo apt-get install libqt4-dev" command. We need to make sure that this package is installed, otherwise the MAKE command was failing for me, and i think for some other people. This package is not installed automatically with QT4, so we need to finish it manually."

QWT installation on QT steps (in 7 minutes!):


sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools

By Tulga:
1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-6.0.0-rc5.tar.bz2
3. cp qwt-6.0.0-rc5.tar.bz2 /home/tulga/
4. tar -xjvf qwt-6.0.0-rc5.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0-rc5/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer. 

Post your opinions on above steps. I would like to hear them!

*==============================*

After tried Tulga's method, some steps need to be correct. Meanwhile, I am still using qwt.5.2.1, because qwt.6.0.0 has made some changes. For example, qwt_data.h is changed to be QwtSeriesData.h. I don't want to change my code which based on qwt-5.2.1.
Here is Tulga's method version 2:


sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools

1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-5.2.1.tar.bz2
3. cp qwt-5.2.1.tar.bz2 /home/tulga/
4. tar -xjvf qwt-5.2.1.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
(add:
$ sudo cp -a /home/czhang/qwt-5.2.1/lib/* /usr/lib64
$ ldd /home/czhang/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so)
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer.



===============================
The following installation guide from Uwe.

1) Download qwt-5.2.1.tar.bz2
2) tar xfj qwt-5.2.1.tar.bz2
3) cd qwt-5.2.1
4) qmake
5) make
6) su -c "make install" ( Boys, what's so hard about doing this ? )

Now the designer plugin should be copied into the plugins/designer directory of your Qt install directory. All other files can be found in /usr/local/qwt-5.2.1.

The following steps are Linux or Qt basics:

7) The Qwt designer plugin ( or any application using Qwt ) needs to see the Qwt library. Read about ldconfig or LD_LIBRARY_PATH how to do so. Don't continue before "ldd /plugins/designer/libqwt_designer_plugin.so" shows a valid path for libqwt.so.

When using LD_LIBRARY_PATH note, that an environment variable is only valid for the process itsself and its child processes. Until you have understood what this means better start the designer/creator manually from the shell, where you have set LD_LIBRARY_PATH.

8) Add the following to your application project file


INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIB += -L/usr/local/qwt-5.2.1/lib -lqwt



10 comments:

  1. Hi rashmi, can you post what you got when you do
    $ ldd xxx/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so

    ReplyDelete
  2. Anonymous8/2/11 15:21

    This crap QWT doesn't work for me! I spent whole day doing this shit without a result. Uwe should really work and test their qwt packages! I have an Ubuntu 10. The simplest MAKE command doesn't work for the package, that i downloaded from their homepage hundreds of times! The package even doesn't have necessary files to correctly compile itself. I'm extremely frustrated on this qwt

    ReplyDelete
  3. Anonymous10/2/11 05:48

    Okey! I need to calm down. After following these steps and executing $ ldd xxx/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so my Ubuntu 10.4 crashed. It never turned on after it(VFS unable to mount). So i had to spend 3 more hours to format Ubunty and MAKE my buildroots for AVR32. Also i tried this QWT on windows. And It works! Now i'm going to format my ubuntu again, because it crashed again, OMG!! However, the Designer plugin is still not visible on QT. What i am missing?

    ReplyDelete
  4. Anonymous11/2/11 08:39

    thx i have made it in 1 hour for my ubuntu 10.10, qt 4.7.0, qtcreator 2.0.1, qwt-6.0.0-rc5

    ReplyDelete
  5. Hi, the ldd command just lists libraries and their versions, also shows where they are located in the system. I can not think any reason cause the system crash. strange...

    ReplyDelete
  6. Anonymous19/2/11 04:59

    i don't know the reason of crashing. But do not worry, it is nothing to do with ldd, as i conclude. So, anyone needs fully operational qwt install guide on qwt?? I made one! I'm ready to share with all of you my 2 day nervebraking job. In the end: this whole thing is so easy, when you have right information! The only thing, that above tutorial is missing is the "sudo apt-get install libqt4-dev" command. We need to make sure that this package is installed, otherwise the MAKE command was failing for me, and i think for some other people. This package is not installed automatically with QT4, so we need to finish it manually.

    ReplyDelete
  7. Anonymous19/2/11 05:07

    Post your opinions on above steps. I would like to hear them!

    ReplyDelete
  8. Anonymous21/2/11 10:13

    Thanks for your tutorial! It's the only workable tutorial i have found for QWT installation! I relied heavily on it.

    ReplyDelete
  9. Anonymous21/2/11 13:33

    Hi guys who success installed the QWT on Ubuntu, can you list your ubuntu, kernel and Qt versions plz? I'll install the bloody QWT base on exact OS system what you got. Thanks

    ReplyDelete
  10. Hmm~~~, that's a good idea. That will be easier for others to install qwt without get error message due to using different os or software version. I have added my system information at the beginning.

    ReplyDelete