2015-01-28
Prepare two files:
Qt-x11-opensource-src-4.5.3.tar.gz
Qt-creator-opensource-linux-x86_64-3.3.0.run
1. Get the source code
SRC Official website: ftp://ftp.qt.nokia.com/qt/source/
Qt-x11-opensource-src-4.5.3.tar.gz released on October 1, 2009, size 122 Mb.
2. Decompression
Tar Xvfz qt-x11-opensource-src-4.5.3.tar.gz
3. Generate Makefile File
./configure
This time he will ask you: "Which edition of Qt does you want to use?"
Then give you two types to choose from:
Type ' C ' If you want the commercial Edition.
Type ' o ' If you want to use the Open Source Edition.
The first one is the commercial version and the second is the free version.
Select ' O ' (qt/embedded free version is Qt in order to develop the embedded version provided by Free software).
At this point, the licensing interface appears.
Select ' Yes ' to accept the license agreement.
Start building the makefile file. This will take about 5-10 minutes.
4. Qt compilation
Gmake//If there is an error here, the solution can be found below
This process takes a long time and requires about two hours.
5. Qt Installation
Run Gmake Install
Default installation to/usr/local/trolltech/qt-4.5.3
About 5-10 minutes. Normal end, installation complete.
Run the/usr/local/trolltech/qt-4.5.3/bin/designer and see Qt start, which means Qt is installed.
6. Setting Environment variables
First, modify the user environment variables
Vi/home/defonds/.bashrc
Add the following information at the end of the
Export qtdir=/usr/local/trolltech/qt-4.5.3
Export path= $QTDIR/bin: $PATH
Export manpath= $QTDIR/man: $MANPATH
Export ld_library_path= $QTDIR/lib: $LD _library_path
Second, modify all user environment variables
Vi/etc/profile
Add the following information at the end of the
Export qtdir=/usr/local/trolltech/qt-4.5.3
Export path= $QTDIR/bin: $PATH
Export manpath= $QTDIR/man: $MANPATH
Export ld_library_path= $QTDIR/lib: $LD _library_path
Three, test
Re-open a terminal and enter the command:
Qmake-v
Output Result:
QMake version 2.01a
Using Qt version 4.5.3 in/usr/local/trolltech/qt-4.5.3/lib
Enter the command:
Which Qmake
Output Result:
/usr/local/trolltech/qt-4.5.3/bin/qmake
Demonstrate that the QT environment variable has been configured successfully.
The Qt-creator installation method is simple, namely:
1. Download Qt-creator-opensource-linux-x86_64-3.3.0.run
2, chmod +x Qt-creator-opensource-linux-x86_64-3.3.0.run
./Qt-creator-opensource-linux-x86_64-3.3.0.run
The next step is a very familiar installation interface.
Just a reboot, please!
At the beginning of the compilation, Gmake useless method:
Through the above analysis, there are two ways to solve this problem, one is to change the qmake link, so that qmake this command link to the installation directory of our installed version of the Qmake, there is another way is to change the environment variables.
First of all, the method of changing the link, through the above introduction, this actually operation is relatively straightforward and simple, command and experimental results are as follows:
[Email protected]:/# rm/etc/alternatives/qmake
[Email protected]:/#
Ln-s/usr/local/trolltech/qt-4.8.4/bin/qmake/etc/alternatives/qmake
[Email protected]:/# qmake-v
QMake version 2.01a
Using Qt version 4.8.4 in/usr/local/trolltech/qt-4.8.4/lib
As you can see, Qmake has successfully changed to version 4.8.4.
The second approach is to change the environment variables, which I did not attempt to be interested in validating myself.
VI/HOME/DEFONDS/.BASHRC is used to modify user environment variables and add the following information after the file
Export qtdir=/usr/local/trolltech/qt-4.8.4
Export path= $QTDIR/bin: $PATH
Export manpath= $QTDIR/man: $MANPATH
Export ld_library_path= $QTDIR/lib: $LD _library_path
Modify all user Environment variables Vi/etc/profile also add the above environment variable information after the file. This approach should be equally feasible.
Cross-compiling arm version of Qt (qt-everywhere-opensource-src-4.8.4)
Due to the actual project needs, QT compiled into the linux-arm version, the following is the entire operation process, the use of QT program has been written in the actual development board running, posted here, I hope to provide help for the needs of friends.
Preparatory work:
Linux kernel version:
Development computer: Ubuntu12.04, Development Board: linux-2.6.37
Cross-compilation Tool:
Arm-none-linux-gnueabi 4.4.1
QT installation package:
Qt-everywhere-opensource-src-4.8.4.tar.gz
Installation
I. Installing the cross-compilation tool
1. The cross-compilation tool used by this machine is: Arm-none-linux-gnueabi
2. Add the path of the cross-compilation tool to the appropriate environment variable:
Export path=/usr/local/arm-2009q1-203/bin/: $PATH
3. See if the Arm-none-linux-gnueabi Compilation tool was successfully installed with the following command
A. Execution: arm-none-linux-gnueabi-g++-V
B. Implementation: ARM-NONE-LINUX-GNUEABI-GCC-V
If the corresponding version information is printed correctly in both steps, the Arm-none-linux-gnueabi compilation tool
The installation is successful!
Two. Cross-compiling the arm version of QT
1. Download qt source package qt-everywhere-opensource-src-4.8.4.tar.gz;
2. Extracting QT Source Packages
TAR-XVFZ qt-everywhere-opensource-src-4.8.4.tar.gz
3. Modify the file:
/usr/local/qt-4.8.4-linux-arm/mkspecs/qws/linux-arm-g++/qmake.conf
# Set the cross-compilation toolchain:
# The cross-compilation tool used in this project is arm-none-linux-gnueabi-g++
#
QMAKE_CC = ARM-NONE-LINUX-GNUEABI-GCC
Qmake_cxx = arm-none-linux-gnueabi-g++
Qmake_link = arm-none-linux-gnueabi-g++
Qmake_link_shlib = arm-none-linux-gnueabi-g++
Qmake_ar = Arm-none-linux-gnueabi-ar CQS
Qmake_objcopy = Arm-none-linux-gnueabi-objcopy
Qmake_strip = Arm-none-linux-gnueabi-strip
4. (if required, modify the g++.conf file)
Modified files:/usr/local/qt-4.8.4-linux-arm/mkspecs/common/g++.conf
# Set compilation flags using the ARM advanced features:
#
Qmake_cflags_release + =-o2-march=armv7-a-MTUNE=CORTEX-A8-MFLOAT-ABI=SOFTFP
5. Configure QT Compilation options
Enter the QT decompression directory and execute the following command:
./configure-prefix/usr/local/qt-4.8.4-embedded arm-xplatform/qws/linux-arm-g++-depths 16,24,32-little-endian- No-mmx-no-3dnow-no-sse-no-sse2-no-glib-no-cups-no-largefile-no-accessibility-no-openssl-no-gtkstyle- Qt-freetype-qt-mouse-pc-qt-mouse-linuxtp-qt-mouse-linuxinput-plugin-mouse-pc-fast-qt-gfx-transformed- Opensource-confirm-license
or write a script config.sh, content like above, then run this script:./config.sh
6. Execute make command;
This step takes approximately 2-3 hours
Error: Qtconcurrentiteratekernel.cpp: (. text+0x3c): Undefined reference to ' clock_gettime '
Modified: Vim src/corelib/makefile plus-LRT
LIBS = $ (sublibs)-L/OPT/QT-EVERYWHERE-OPENSOURCE-SRC-4.8.4/LIB-LPTHREAD-LM-LDL-LRT
7. Execute the Make install command;
8. Modify User Environment variables
Export armqtdir=/usr/local/qt-4.8.4
Export path= $ARMQTDIR/bin: $PATH
Export manpath= $ARMQTDIR/man: $MANPATH
Export ld_library_path= $ARMQTDIR/lib: $LD _library_path
9. Test whether the ARM version of QT is installed and configured successfully:
A. Implementation: Qmake-v
Print the following corresponding information:
QMake version 2.01a
Using Qt version 4.8.4 in/usr/local/qt-4.8.4/lib
B. Implementation: Which Qmake
Print the following corresponding information:
/usr/local/qt-4.8.4/bin/qmake
C. Write a simple test program with the file name Hello.cpp, enter the file directory, and compile the project to see if it can be compiled correctly
Hello.cpp Source:
#include <QApplication>
#include <QDebug>
int main (int argc,char *argv[])
{
Qdebug ("Hello, Welcome to Qt world!");
return 0;
}
The following actions are performed in order:
@1. Execution: Qmake-project hello1.cpp
Generate Hello1.pro Project files
@2. Execution: Qmake Hello1.pro
Generate Makefile File
@3. Execution: Make
Generate HELLO.O, hello file
If you perform the @2 step, the following error occurs:
Qmakespec have not been set, so configuration cannot is deduced.
Error Processing Project File:hello1.pro
Then the QMAKESPEC variable is not set and executed:
Export qmakespec=/usr/local/qt-4.8.4/mkspecs/qws/linux-arm-g++
cd/usr/local/qt-4.8.4/lib/
File libqt* Look at the output information is elf ARM
The/usr/local/qt-4.8.4/lib/libqt* root file system is then/usr/lib/
QT Installation Tutorial under Linux