Monday, December 10, 2012

libQtGui.so: undefined reference to `FcFreeTypeQueryFace'

RedHat64 + qt sdk-offline-linux-x86_64 +FcFreeTypeQueryFace+Building application yields libQtGui.so: undefined reference to `FcFreeTypeQueryFace'

Cause for compiling the sources.

When my office have blocked access to internet for all RedHat workstations ,i could not download packages,and it was not possible to download from the PC side as well,because of the company security policies.so i had to download it from somewhere, get it,and compile in the workstation.


I started with invoking Qt_SDK_Lin64_offline_v1_1_2_en.run file for installing the SDK like this and got this error,
./Qt_SDK_Lin64_offline_v1_1_2_en.run: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./Qt_SDK_Lin64_offline_v1_1_2_en.run)



so i started compiling gcc4.3.2 and its dependent sources(mpfr-2.4.2.tar,gmp-4.3.2.tar,mpc-0.8.1.tar)
-----------------------------------------------------------------------------------------------------
1.mpfr-2.4.2.tar
mkdir mpfrbuild ; cd mpfrbuild ; ../mpfr-2.4.2/./configure --prefix=$PWD ;make -j8 && make install

2.gmp-4.3.2.tar
mkdir gmpbuild ; cd gmpbuild ; ../gmp-4.3.2/./configure --prefix=$PWD ;make -j8 && make install


3.mpc-0.8.1.tar
mkdir mpcbuild ; cd mpcbuild ; ../mpc-0.8.1/./configure --with-gmp-lib=/gmpbuild/lib --with-gmp-include=/gmpbuild/include --with-mpfr-include=/mpfrbuild/include --with-mpfr-lib=/mpfrbuild/lib --with-mpc-include=/mpcbuild/include --with-mpc-lib=/mpcbuild/lib --prefix=$PWD ;make -j8 && make install


4 Configuring and compiling the GCC 4.6.3
------------------------------------------

mkdir gcc463build ; cd gcc463build ; ../gcc-4.6.3/./configure --with-gmp-lib=/gmpbuild/lib --with-gmp-include=/gmpbuild/include --with-mpfr-include=/mpfrbuild/include --with-mpfr-lib=/mpfrbuild/lib --with-mpc-include=/mpcbuild/include --with-mpc-lib=/mpcbuild/lib --enable-languages=c,c++  --prefix=$PWD ;make -j8 && make install



Errors when compiling GCC sources
-------------------------------------
checking for suffix of object files... configure: error: in `../x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

By adding mpc,mpfr,gmp Library paths to the LD_LIBRARY_PATH the make continues

to do
-----
for this error libQtGui.so: undefined reference to `FcFreeTypeQueryFace'


Download fontconfig-2.4.2.tar.gz+  make;make install
and  setenv /PATH/TO/THE/LIBRARY:$LD_LIBRARY_PATH
or  LIBS += -L/PATH/TO/fontconfig-2.4.2/lib in the .pro or CMakeLists.txt

more comments and information is available at http://theitdepartment.wordpress.com/2009/03/15/centos-qt-fcfreetypequeryface/

Sunday, August 26, 2012

Qt Tips


How to  add QToolbar to the MainWindow using QT Designer.

Method 1
Drag and Drop from the QActionEditor

Create some QActions from Action Editor tab in the designer.Each of these QActions can be edited from their context menu.these can be dragged on to the

default mainToolBar present on the mainWindow.



Method 2
Selet from mainwindow contextmenu
Right-click on the main window and select Add toolbar from the context menu. To add buttons to the toolbar, you must create some QActions. Select the Action

Editor tab (if the tab is nowhere to be seen, go to the view menu and make sure Action Editor is checked), push the create new action button and fill the

form that appears. Then drag your newly created action from the list in the action editor to the toolbar.

Method 3
Writing UI Code in C++
Generally if you write C++ code this can be done in multiple ways using addToolBar();
QToolBar *tool = new QToolBar;
tool->setGeometry(0,0,200,20);
QToolButton *button = new QToolButton;
button->setGeometry(0,0,10,20);
tool->addWidget(button);

If the area is not specified then the toolbar is placed at the end of the current tool bar block.otherwise it will be added to the specified area in the main window.

Eg:-
QToolBar *fileToolBar= addToolBar(Qt::BottomToolBarArea,fileToolBar);
A nice example is available which illustrates, how to code in Qt with C++ is available here.

Thursday, August 23, 2012

What is Opengl and Qt with OpenGL.


What is opengl

OpenGL is the industry’s most widely used 2D and 3D graphics API.

OpenGL is a low level API which requires the programmer to write the exact steps needed to render a scene in a 3d space.

So it is up to the programmer to specify geometry primitives in a 3D space, apply coloring,texturing, lighting effects and render the objects onto the screen.

As OpenGL is "low-level" graphics API, An application using OpengGL must tell the computer how to draw a scene in terms of low level primitives such as vertices, lines and polygons.

For example, to draw a cube, the cube’s eight vertices must be specified.

Imagine attempting to render something as complex as a Cam-shaft using one of these low-level APIs.
As, these APIs are highly sensitive to the order in which functions are called, making direct OpenGL API call is  error prone.

So high-level APIs which support object oriented 3D visualization have been developed.
These scene graph APIs allow the programmer to define a scene and then  place objects in the scene.

For 2D visualization there is no standard for scenegraph,Qt has QGraphicsView which allows to render the 2d scenes easily using opengl.

For 3D visualization, APIs like Open Inventor and VTK are standard.

OpenGL is cross-platform, but the choice of the widget toolkit that encapsulates the OpenGL scene willl limit the  application to a particular platform.

QtOpenGL 

Role of Qt.

Qt provides the 'glue-code' required to embed an opengl rendered area into a window,With Qt Window System,QWS, the window management,handling events like widget paint event,and user input events like mouse,keyboard events.

with Qt's cross platform API it will be easier for porting the application on to  the desired platform.

Not only that any visualization application definitely requires additional APIs to print documents, parse XML, read databases, and use threads,networking, and so on and so forth.

An ideal toolkit should support all these additional utilities and be cross-platform at the same time.
Qt becomes the best choice among the other windowing tool-kits,such as Motif on the X platform, Microsoft Foundation Classes (MFC) under Windows platform,as it supports both the platforms and also many IDE's like VisualStudio,Eclipse,NetBeans.


Not only that Qt has an unique IDE Qt-Creator a versatile cross-platform complete integrated development environment available on Linux, Mac OS X and Windows operating systems.