Steps to establish a Qt environment in Linux

  
                

In order to use Qt under Linux, you need to install G++ environment before installing Qt. After installation, you need to set environment variables. You only need to complete the Qt development environment in seven steps. The following small series will give you details. Introduce how to build a Qt environment under Linux, let's learn together.

a, G ++ installation environment

sudo apt-get install build-essential

some additional relevant environment. If not installed, some qt components can not be compiled properly, such as openGL

sudo apt-get install libx11-dev libxau-dev libxaw7-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp- Dev

sudo apt-get install libxext-dev libxfixes-dev libxfont-dev libxft-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev

sudo apt-get install Libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev

sudo apt-get install libglib2.0-dev

sudo Apt-get install libssl-dev

sudo apt-get install libgtk2.0-dev

sudo apt-get install libcups2-dev

sudo apt-get install libgl1- Mesa-dev libglu1-mesa-dev

sudo apt-get install libgstreamer0.10-dev

Second, extract the code

tar zxvf qt-everywhere-opensource-src- 4.8.4.tar.gz

After decompressing and entering the decompressed source code folder

3. Execute. /configure generates makefile

. /configure -prefix /usr/local/Qt-4.8.2

(The directory /usr/local/Qt-4.8.2 specified above is the installation directory after make install)

The following dialog box appears to select open source edition. This is a free version. Enter yes to accept the agreement.

(1) If your machine's various library files are complete, after a short while, the configuration is complete, the following information will appear

Qt is now configured for building , just run ‘make’

Once everything is built , you must run ‘make install’

Qt will be installed into /usr/local/Qt-4.8.2

To reconfigure ,run ‘make confclean’ and ‘configure’

Description Makefile file generated successfully

(2) If the following message appears

Basic XLib functionality test failed!

You might need to modify the include and library search paths by editing

QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/gcgily/qt-everywhere-opensource-src-4.8.4/mkspecs/linux- g++

It’s still the old way, so it’s always changing. Go to config.test/x11/xlib and execute the make command to see the error message

g++ -Wl,-O1 -o xlib xlib.o -L/usr/X11R6/lib -lXext -lX11 -lm

/usr/bin/ld: can't find -lXext

See it, g++ in /usr/X11R6/lib, can't find libXext.so.

The reason is that you need to install the development package of libX11. The package name in Ubuntu/debian is libX11-dev

Based on past experience. Proactively install the following 3 packages before /configure, basically everything is fine.

sudo apt-get install libX11-dev libXext-dev libXtst-dev

Install the required package and then re-install . /configure can generate Makefile

If it appears: Project ERROR: Package gstreamer-app-0.10 not found, execute the following command

apt-get install libgstreamer0.10-dev libgstreamer-plugins -base0.10-dev if it appears: g++: error: unrecognized command line option ‘-fuse-ld=gold’

This is a bug in Qt: https://bugs.webkit.org/show_bug .cgi? Id=89312

In a system with a gold linker, the compile script will add the -fuse-ld=gold option, but this option gcc is not supported. The solution is to remove this option, find the file src/3rdparty/webkit/Source/common.pri, and mask QMAKE_LFLAGS+=-fuse-ld=gold.

#

QMAKE_LFLAGS+=-fuse-ld=gold
Previous12Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved