Http://blog.csdn.net/cuman/archive/2009/05/12/4174456.aspx
Install qt4 on redhat9.0
The Installation Platform is redhat9.0.
This article combines the online tutorials with your own practices.
First download ftp://ftp.qtsoftware.com/qt/source/ here
Qt-embedded-linux-opensource-src-4.5.1.tar.bz2
Qt-x11-opensource-src-4.5.1.tar.gz
Qt-x11 version can generate QT development tools, such as designer and so on, the most important is to get qvfb, embedded development with qvfb, You can do not need the actual development board, you can also develop QT applications. The QT-embedded version is specifically used for embedded. The installation steps are as follows:
[Root @ localhost linuxshare] # tar-jxvf qt-embedded-linux-opensource-src-4.5.1.tar.bz2
[Root @ localhost linuxshare] # tar-zxvf qt-x11-opensource-src-4.5.1.tar.gz
Then copy the qt-embedded-linux-opensource-src-4.5.1
Here, QT-embedded has two copies: qt-embedded-linux-opensource-src-4.5.1-x86 and qt-embedded-linux-opensource-src-4.5.1-arm. According to their name, we can know that the former is suitable for the X architecture, and the latter is suitable for the ARM architecture. Why do we need two? If you have a development board, you can only compile the QT-embedded version into an ARM architecture. However, it is much easier to develop it with qvfb in many cases, therefore, it is good to compile an X86 architecture. Is there any doubt that the qt-x11 is also suitable for the x86 structure, which is not repeated with QT-embedded? The answer is: the QT-embedded version can only run on the embedded board. programs compiled into the X86 architecture can only run on the x86 Embedded Board. As mentioned above, we need to develop qvfb, but qvfb can only execute X86 architecture applications, so we need to have QT-embedded generate libraries and other files about x86. Why is QT-embedded compiled into arm? The principle is very simple. My final QT application needs to run on the ARM architecture. Of course, this library is needed, so compiling it into arm is just a matter of course. Well, now a simple summary, first of all, using the library and development tools provided by the qt-x11 to develop the QT application, then, use QT-embedded to recompile the x86 library and tool to develop the QT application. This is the executable file that can be run on qvfb. Finally, you can use the arm library of QT-embeddedd to compile the program again to obtain executable programs that can run on the arm. Obviously, if there is a development board, the second step is optional (preferably). If there is no development board, the third step is unnecessary, in this way, you do not need to compile QT-embedded into a suitable ARM architecture.
Open a terminal and enter:
1. ln-S/usr/Kerberos/include/com_err.h/usr/include/
2. ln-S/usr/Kerberos/include/profile. h/usr/include/
3. ln-S/usr/Kerberos/include/krb5.h/usr/include/
It is set in this system. Otherwise, an error about "krb5.h" will be reported during compilation.
For other QT versions, for example, “qt-x11-opensource-src-4.4.3.tar.gz ", you also need to modify some files in it. It will report an error" 'readrgbaimageoriented' undeclared ". The modification method is to open it. /src/plugins/imageformats/tiff/q1_handler. CPP
Change inclureadrgbaimageoriented (TIFF, width, height, reinterpret_cast <uint32 *> (gradient image. Bits (), orientation_topleft, 0)
When readrgbaimage (TIFF, width, height, reinterpret_cast <uint32 *> (when image. BITs (), 0), because usr/include/Rewrite IO in RedHat 9. h does not have the previous function.
Compile and install oracle at the beginning. Just wait.
Qt-x11:
./Configure-qvfb
Make
CD tools/qvfb
Make
CD ../..
Make install
CP tools/qvfb */usr/local/trolltech/Qt-4.5.1/bin
Qt-embedded:
X86:
./Configure
Make
Make install
Arm:
./Configure-xplatform PWS/Linux-arm-G ++-arch arm
Make
Make install
The entire process takes more than five hours.
After the installation, the following interface appears, right, It installs the default path is:/usr/local/trolltech/Under the Qt-4.5.1
Configure the environment variables of qt4 as follows:
1. // open the/etc/profile file and add the following statement at the end of the file:
2. Path =/usr/local/trolltech/Qt-4.5.1/bin: $ path
3. qtdir =/usr/local/trolltech/Qt-4.5.1
4. manpath = $ qtdir/MAN: $ manpath
5. LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
6. Export path qtdir manpath LD_LIBRARY_PATH
Qt3 is enabled by default. Now let's modify the associated file that starts qt3 under "/usr/bin" and find "designer ", we found that this file really links the execution file of qt3. It is clear that the designer is a link and points to the designer of qt3 through the designer. Now we want the designer to be the designer of qt4 by default, you only need to redirect the link. Similarly, if you want qmake to use qt4 by default, you only need to redirect the link.
1. sudo RM/usr/bin/designer
2. sudo ln-S/usr/local/trolltech/Qt-4.5.1/bin/DESIGNER/usr/bin/designer
3. sudo RM/usr/bin/qmake
4. sudo ln-S/usr/local/trolltech/Qt-4.5.1/bin/qmake/usr/bin/qmake
I suggest you change the link to the execution file under "/usr/local/trolltech/Qt-4.5.1. In this way, you can thoroughly use qt4.
The default font of qt4 will contain garbled characters. Let's set it. Open qtconfig and select "forts". The other settings remain unchanged.
Open qdesigner to display our long-awaited qt4 Interface
Next we will install and debug the compilation environment. Here we will not select the kdevelop series. I think it is quite annoying to install it. The first redhat9 comes with QT 3.1.1, to install kdevelop3.5 (you can debug the qt4 Program), you must upgrade the QT version of the system to version 3.3, which is not exhausting, so here I will use the lightweight qdevelop0.26. The reason why I say it is lightweight is that it is "installed" (only need to compile (it must be qt4.3.x) and then use its execution file) time is short.
Http://qdevelop.org/pages/Downloads
Download “qdevelop-0.25.2.tar.gz "and decompress it. You only need qmake qdevelop. pro to make it again. This process takes about 10 minutes.
If the following error occurs during compilation:
1. src/initcompletion. cpp: In destructor 'virtual
2. initcompletion ::~ Initcompletion ()':
3. src/initcompletion. cpp: 52: Parse error before '+ 'token
4. src/initcompletion. cpp: 53: Confused by earlier errors, bailing out
5. Make: *** [Build/O/Unix/initcompletion. O] Error 1
You only need to modify the initcompletion. cpp file in the src directory:
1. // original file
2. initcompletion ::~ Initcompletion ()
3 .{
4. qstringlist list = qdir (qdir: temppath (). entrylist (qstringlist () <"qdevelop-completion-*", qdir: files );
5. foreach (qstring file, list)
6 .{
7. qfile (qdir: temppath () + "/" + file). Remove ();
8 .}
9 .........................
10 .}
11. // modify as follows:
12. initcompletion ::~ Initcompletion ()
13 .{
14. qstringlist list = qdir (qdir: temppath (). entrylist (qstringlist () <"qdevelop-completion-*", qdir: files );
15. foreach (qstring file, list)
16 .{
17. qstring STR = qdir: temppath () + "/";
18. qfile (STR + file). Remove ();
19 .}
20 .........................
21 .}
After compilation, you can run and use it.
Let's create a new project, first feel:
The disadvantage of develop is that it cannot display Chinese characters normally, so I had to write it elsewhere and paste it.
Compile and run:
Next we will give the program a home on the desktop:
In this way, it can be developed in windows. Increased development efficiency.