Linux mobile phone DIY. Porting software topics. QT/QTE compiling environment

Source: Internet
Author: User
I. Sequencing

An accidental idea is to place the QT program of segmentation fault in the new summer e600
When running on motoe680, segmentation fault exists. I suddenly realized that the problem was okay.
Can it be not as complicated as originally imagined? I have taken a simple look at the QT makefile and have gone through a series of tests,
The cause of segmentaion fault is the compilation parameter.

Ii. Important Notes

To facilitate a better understanding of this article, we provide the following link.
Full range of articles address, mobile phone application development column: http://blog.csdn.net/liwei_cmg
Related important outcome: http://play.younet.com/view.php? Tid = 24045

Iii. QTE program running conditions

Most Linux mobile phones are based on QTE. Two conditions are required to run QTE. One is the Lib file
LD_LIBRARY_PATH is specified, and the other is fontdir, while fontdir is specified by qtdir. That is to say
The qtdir/lib/fonts directory must exist. You can see the following example of environment variables:

Moto e680

#! /Bin/bash
Export qtdir =/usr/lib/ezx
Export LD_LIBRARY_PATH = $ qtdir/lib: 'pwd'
Export ezx_res_font_path = $ qtdir/lib/Fonts
Exec./$ *

Philips 968, Xia xine600

#! /Bin/sh
Export cechome =/mnt/cellon
Export qtdir = $ cechome/QT
Export cecdir = $ cechome/CEC
Export LD_LIBRARY_PATH =/mnt/SD/e600/lib: $ cechome/lib: $ cecdir/lib: $ qtdir/lib: LD_LIBRARY_PATH
Exec./$ *

It can be seen that the running condition is simple, and the QTE running mode is not that easy.

Iv. QTE program running mode

Here are some examples:

A. Run the qnes simulator of PHILIPS 968 on xiaxin e600

#! /Bin/sh
Export cechome =/mnt/cellon
Export qtdir = $ cechome/QT
Export qws_keyboard = tty
Export cecdir = $ cechome/CEC
Export LD_LIBRARY_PATH =/mnt/SD/e600/lib: $ cechome/lib: $ cecdir/lib: $ qtdir/lib:/mnt/doc/IBM/JVM/bin: $ LD_LIBRARY_PATH
Export qws_display =: 1:/dev/fb0
/Mnt/doc/cec_local/bin/qnesexe-qws 2>/mnt/SD/e600/log/qnesrunerror.txt

Description: The simulator and the phone's original system have buttons and screen conflicts. That is, when a keyboard or screen event occurs
Both accept events. The game will be blurred.

#! /Bin/sh
Export cechome =/mnt/cellon
Export qtdir = $ cechome/QT
Export cecdir = $ cechome/CEC
Export LD_LIBRARY_PATH =/mnt/SD/e600/lib: $ cechome/lib: $ cecdir/lib: $ qtdir/lib:/mnt/doc/IBM/JVM/bin: $ LD_LIBRARY_PATH
/Mnt/doc/cec_local/bin/qnesexe 2>/mnt/SD/e600/log/qnesrunerror.txt

Description: The simulator runs normally. The simulator preferentially accepts keyboard and screen events.

B. Motorola e680 runs common QTE programs

Compile with the e680 Library:
Arm-Linux-G ++ helloqt. cpp-O helloqtezx-fno-tions-fno-rtti-dqws-wall-g/
-I/home/GCC/src/dev-ezx-0.2.0/include/Qt-I/home/GCC/src/dev-ezx-0.2.0/include/ezx/
-L/home/GCC/src/dev-ezx-0.2.0/lib-L/home/GCC/src/dev-ezx-0.2.0/lib/ezx/lib/
-Lezxappbase-XScale-r-lqte-MT-XScale-r/
-Lezxjpeg-XScale-r-lezxnotification-XScale-R


#! /Bin/bash
Export qtdir = 'pwd'
Export LD_LIBRARY_PATH = $ qtdir:/usr/lib/ezx/lib
Export ezx_res_font_path = $ qtdir/Fonts
Exec./helloqtezx

Description: The QTE program runs completely normal. You can drag to maximize and minimize the number.


Use the self-compiled QTE (qt2.3.10) library for compilation (VFP ):
Arm-Linux-G ++-c-I $ qtdir/include-pipe-dqws-fno-tions-fno-rtti-O2-wall-w-dno_debug-O helloqt. O helloqt. CPP
Arm-Linux-G ++-L $ qtdir/lib-wl,-rpath, $ qtdir/lib-O helloqtvfp helloqt. O-lqte-LM

#! /Bin/bash
Export qtdir = 'pwd'
Export LD_LIBRARY_PATH = $ qtdir:/usr/lib/ezx/lib
Export ezx_res_font_path = $ qtdir/Fonts
Exec./helloqtezx-qws

Description: The QTE program will disappear after a few operations on the menu, not to mention minimizing and dragging.


[Cause Analysis]

We can initially understand that the QTE-based mobile phone system has a QTE server.
The order is based on this QTE server, and the Lib file provided by the mobile phone encapsulates the server-based application functions.
Let's take a look at Example A. If the environment variables related to qws are declared, the system must use an independent QTE Server
To run qnes. If the-qws parameter is not added, the following message is displayed:

Qsocket: writeblock: socket is not open
Qsocket: writeblock: socket is not open
Qsocket: writeblock: socket is not open
Qsocket: writeblock: socket is not open
No QT/Embedded Server appears to be running.
If you want to run helloqtvfp as a server,
Add the "-qws" command-line option.

After-qws is added, it runs as a server. This is certainly because the existing QTE server on the mobile phone is in conflict,
In the event of a button screen event, both servers accept and process the screen, so it is not difficult to understand the screen in Example.
Let's look at example B. Using the Lib file provided by the mobile phone will naturally let the QTE program run on the original QTE server.
The self-compiled QTE library file obviously needs to be restarted in the QTE server state, and it is normal
.

Therefore, you can write e680 software or e600 or 968 QTE software. It is best to use its own lib file,
Otherwise, it will conflict with the original system and cannot run properly.

5. Build a compilation environment

As mentioned in the previous article, the key points for building a cross-compilation environment are listed below.
I am using cross-tools 0.42, and it is no longer easier to do cross-compilation environment than this tool.

Main script Liwei. Sh

#! /Bin/sh
Set-ex
Tarballs_dir = $ toolchain_dir/crosstool-0.42/downloads
Result_top = $ toolchain_dir
Export tarballs_dir result_top
Gcc_ages = "C, C ++"
Export gcc_ages

Mkdir-p $ result_top
Eval 'cat Liwei. dat liweicmp. dat 'sh all. Sh -- notest
Echo done.

Compile parameter configuration Liwei. dat

Kernelconfig = 'pwd'/arm. config
Target = arm-Linux
Target_cflags = "-o"
Gcc_extra_config = "-- with-float = soft -- With-CPU = XScale -- enable-cxx-flags =-mcpu = XScale"
Glibc_extra_config = "-- without-FP"

Compile the source file and configure liweicmp. dat.

Binutils_dir = binutils-2.15
Gcc_dir = gcc-3.4.0
Glibc_dir = glibc-2.2.5
Linux_dir = linux-2.4.19
Glibcthreads_filename = glibc-linuxthreads-2.2.5

Gcc-3.4.0 patch remove some conflicting items, glibc, kernel and other patches for cross-Tool
Default built-in

Gcc-3.3.3h-ppc-asm-spec.patch
Gcc-3.4.0-arm-softfloat.patch
Gcc-3.4.0-pr14808-refix.patch
Gcc-3.4.0-ultrasparc3-default64.patch
Pr15647-fix.patch
Pr13250-fix.patch

The added gcc-3.4.0-arm-softfloat.patch can be searched online, but there are different versions.
List all my contents here (exaggerated, just copy and create a patch file, note that if it is a UNIX Lattice
Type ):

(However, dx, such as Yunyang, tried it and found that the problem could not be solved by copying. Only the original patch file can be compiled and passed. The cause of the problem needs to be determined. Currently, we recommend that you use the patch file that is decompressed by the GZ package on the Internet. )

Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/coff. h gcc-3.4.0/GCC/config/ARM/coff. h
--- Gcc-3.4.0-orig/GCC/config/ARM/coff. h 15:25:22. 000000000 + 0100
++ Gcc-3.4.0/GCC/config/ARM/coff. h 19:07:06. 059409600 + 0200
@-31,11 + 31,16 @@
# Define target_version fputs ("(ARM/coff)", stderr)
 
# UNDEF target_default
-# Define target_default (arm_flag_soft_float | arm_flag_apcs_32 | arm_flag_apcs_frame | arm_flag_mmu_traps)
+ # Define target_default/
+ (Arm_flag_soft_float/
+ | Arm_flag_vfp/
+ | Arm_flag_apcs_32/
+ | Arm_flag_apcs_frame/
+ | Arm_flag_mmu_traps)
 
# Ifndef multilib_defaults
# Define multilib_defaults/
-{"Marm", "mlittle-Endian", "msoft-float", "mapcs-32", "MnO-thumb-interwork "}
+ {"Marm", "mlittle-Endian", "mapcs-32", "MnO-thumb-interwork "}
# Endif
 

/* This is coff, but prefer stabs .*/
Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/elf. h gcc-3.4.0/GCC/config/ARM/elf. h
--- Gcc-3.4.0-orig/GCC/config/ARM/elf. h 15:25:22. 000000000 + 0100
++ Gcc-3.4.0/GCC/config/ARM/elf. h 19:12:16. 976486400 + 0200
@-46,7 + 46,9 @@
 
# Ifndef subtarget_asm_float_spec
# Define subtarget_asm_float_spec "/
-% {MAPCs-float:-mfloat }%{ msoft-float:-mfpu = softfpa }"
+ % {MAPCs-float:-mfloat }/
+ % {Mhard-float:-mfpu = FPA }/
+ % {! Mhard-float :%{ msoft-float:-mfpu = softfpa }% {! Msoft-float:-mfpu = softvfp }}"
# Endif
 
# Ifndef asm_spec
@-+ @@
# Endif
 
# Ifndef target_default
-# Define target_default (arm_flag_soft_float | arm_flag_apcs_32 | arm_flag_apcs_frame | arm_flag_mmu_traps)
+ # Define target_default/
+ (Arm_flag_soft_float/
+ | Arm_flag_vfp/
+ | Arm_flag_apcs_32/
+ | Arm_flag_apcs_frame/
+ | Arm_flag_mmu_traps)
# Endif
 
# Ifndef multilib_defaults
# Define multilib_defaults/
-{"Marm", "mlittle-Endian", "msoft-float", "mapcs-32", "MnO-thumb-interwork", "fno-leading-underscore "}
+ {"Marm", "mlittle-Endian", "mapcs-32", "MnO-thumb-interwork", "fno-leading-underscore "}
# Endif
 

# Define target_asm_file_start_app_off true
Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/linux-elf.h gcc-3.4.0/GCC/config/ARM/linux-elf.h
--- Gcc-3.4.0-orig/GCC/config/ARM/linux-elf.h 07:18:11. 000000000 + 0100
+ + Gcc-3.4.0/GCC/config/ARM/linux-elf.h 19:19:06. 935979200 + 0200
@-30,9 + 30,27 @@
/* Do not assume anything about header files .*/
# Define no_implicit_extern_c
 
-/* Default is to use APCS-32 mode .*/
+ /*
+ * Default is to use APCS-32 mode with soft-VFP.
+ * The old Linux default for floats can be achieved with-mhard-float
+ * Or with the configure -- With-float = hard option.
+ * If-msoft-float or -- With-float = soft is used then software float
+ * Support will be used just like the default but with the legacy
+ * Big endian word ordering for double float representation instead.
+ */
+
# UNDEF target_default
-# Define target_default (arm_flag_apcs_32 | arm_flag_mmu_traps)
+ # Define target_default/
+ (Arm_flag_apcs_32/
+ | Arm_flag_soft_float/
+ | Arm_flag_vfp/
+ | Arm_flag_mmu_traps)
+
+ # UNDEF subtarget_extra_asm_spec
+ # Define subtarget_extra_asm_spec "/
+ % {! Mcpu = *:-mcpu = XScale }/
+ % {Mhard-float:-mfpu = FPA }/
+ % {! Mhard-float :%{ msoft-float:-mfpu = softfpa }% {! Msoft-float:-mfpu = softvfp }}"
 
# Define subtarget_cpu_default target_cpu_arm6
 
@-+ @@
 
# UNDEF multilib_defaults
# Define multilib_defaults/
-{"Marm", "mlittle-Endian", "mhard-float", "mapcs-32", "MnO-thumb-interwork "}
+ {"Marm", "mlittle-Endian", "mapcs-32", "MnO-thumb-interwork "}
 
# Define cpp_apcs_pc_default_spec "-d1_apcs_32 __"
 
@-55,7 + 73,7 @@
% {Shared:-LC }/
% {! Shared: % {profile:-lc_p} % {! Profile:-LC }}"
 
-# Define libgcc_spec "% {msoft-float:-lfloat}-lgcc"
+ # Define libgcc_spec "-lgcc"
 
/* Provide a startfile_spec appropriate for GNU/Linux. Here we add
The GNU/Linux magical crtbegin. o file (see crtstuff. c) which
Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/t-Linux gcc-3.4.0/GCC/config/ARM/t-Linux
--- Gcc-3.4.0-orig/GCC/config/ARM/t-Linux 23:09:07. 000000000 + 0200
++ Gcc-3.4.0/GCC/config/ARM/t-Linux 20:31:59. 102846400 + 0200
@-4, 7 + 4, 10 @@
Libgcc2_debug_cflags =-G0
 
Lib1asmsrc = ARM/lib1funcs. ASM
-Lib1asmfuncs = _ udivsi3 _ divsi3 _ umodsi3 _ modsi3 _ dvmd_lnx
+ Lib1asmfuncs = _ udivsi3 _ divsi3 _ umodsi3 _ modsi3 _ dvmd_lnx/
+ _ Negdf2 _ addsubdf3 _ muldivdf3 _ cmpdf2 _ unorddf2 _ fixdfsi _ fixunsdfsi/
+ _ Truncdfsf2 _ negsf2 _ addsubsf3 _ muldivsf3 _ cmpsf2 _ unordsf2/
+ _ Fixsfsi _ fixunssfsi
 
# Multilib_options = mhard-float/msoft-float
# Multilib_dirnames = hard-float soft-float
Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/unknown-elf.h gcc-3.4.0/GCC/config/ARM/unknown-elf.h
--- Gcc-3.4.0-orig/GCC/config/ARM/unknown-elf.h 15:25:22. 000000000 + 0100
+ + Gcc-3.4.0/GCC/config/ARM/unknown-elf.h 19:09:09. 016212800 + 0200
@-30,7 + 30,12 @@
 
/* Default to using APCS-32 and software floating point .*/
# Ifndef target_default
-# Define target_default (arm_flag_soft_float | arm_flag_apcs_32 | arm_flag_apcs_frame | arm_flag_mmu_traps)
+ # Define target_default/
+ (Arm_flag_soft_float/
+ | Arm_flag_vfp/
+ | Arm_flag_apcs_32/
+ | Arm_flag_apcs_frame/
+ | Arm_flag_mmu_traps)
# Endif
 
/* Now we define the strings used to build the spec file .*/
Diff-urnd gcc-3.4.0-orig/GCC/config/ARM/xscale-elf.h gcc-3.4.0/GCC/config/ARM/xscale-elf.h
--- Gcc-3.4.0-orig/GCC/config/ARM/xscale-elf.h 01:26:43. 000000000 + 0200
+ + Gcc-3.4.0/GCC/config/ARM/xscale-elf.h 20:15:36. 620105600 + 0200
@-49,11 + 49,12 @@
Endian, regardless of the endian-ness of the memory
System .*/

-# Define subtarget_extra_asm_spec "% {! Mcpu = *:-mcpu = XScale }/
-% {Mhard-float:-mfpu = FPA }/
-% {! Mhard-float :%{ msoft-float:-mfpu = softfpa;:-mfpu = softvfp }}"
+ # Define subtarget_extra_asm_spec "/
+ % {! Mcpu = *:-mcpu = XScale }/
+ % {Mhard-float:-mfpu = FPA }/
+ % {! Mhard-float :%{ msoft-float:-mfpu = softfpa }% {! Msoft-float:-mfpu = softvfp }}"
 
# Ifndef multilib_defaults
# Define multilib_defaults/
-{"Mlittle-Endian", "MnO-thumb-interwork", "marm", "msoft-float "}
+ {"Mlittle-Endian", "MnO-thumb-interwork", "marm "}
# Endif

6. How to test a simple QT Program

The following is a very simple QT program, which is also a tutorial from QTE.

Helloqt. cpp

# Include <qapplication. h>
# Include <qpushbutton. h>

Int main (INT argc, char ** argv)
{
Qapplication A (argc, argv );

Qpushbutton Hello ("Hello world! ", 0 );
Hello. Resize (100, 30 );

A. setmainwidget (& Hello );
Hello. Show ();
Return a.exe C ();
}

Download the qte-2.3.10 (other versions didn't try), we need his header file, unzip it. My
PATH is/home/GCC/toolchain/qt-2.3.10, bring e600 or 968 with libqte-mt.so.2.3.8
Copy to/home/GCC/toolchain/qt-2.3.10/lib and make some soft connections or simply directly
Copy (such as libqte. So, libqte-mt.so...) to copy the libjpeg. so.62.0.0
Fork compile Lib, at this time also need to do similar operations, I here path is/home/GCC/toolchain/gcc-3.4.0-glibc-2.2.5/ARM-Linux/lib

Set environment variables:

Export toolchain_dir =/home/GCC/toolchain
Export Path =/usr/local/sbin:/bin:/usr/sbin:/usr/bin:/usr/x11r6/bin:/root/bin: $ toolchain_dir/gcc-3.4.0-glibc-2.2.5/ARM-Linux/bin
Export qtdir = $ toolchain_dir/qt-2.3.10

Compile with the following command:
Arm-Linux-G ++-c-I $ qtdir/include-pipe-dqws-fno-tions-fno-rtti-O2-wall-w-dno_debug-O helloqt. O helloqt. CPP
Arm-Linux-G ++-L $ qtdir/lib-wl,-rpath, $ qtdir/lib-O helloqtfpa helloqt. O-lqte-LM

This helloqtfpa can be run on e600, 968, I was using the e600 libqte-mt.so.2.3.8
After compilation, it can run normally on 968. I personally think that the difference between e600 and 968 is that
Handle the keyboard.
 
In addition, the depressing segmentation fault problem for a while ago is that I used the following
Statement Compilation:
Arm-Linux-G ++-L $ qtdir/lib-I $ qtdir/include-wl,-rpath, $ qtdir/lib-O helloqterr helloqt. cpp-lqte-LM
The most important parameter is-dqws. If it is not compiled,-qws will certainly see segmentation fault.
As for why, I have never done QTE development, but I still don't know.


VII. Summary

So far, from solving the installation package, to opening the shell entry, to removing the software installation restrictions, and then to graphical
After software migration, Xia xine600 and Philips 968 finally achieved substantial results.
At the end of this article, I was excited to hear about the major breakthrough of subtle in Telnet!
If you are interested, refer to the e680 QTE compilation method and use the e600 environment to compile the entire QTE.
In addition, qtopia, Opie, and other software series all need to be mined.
Sorry, the floating point problem is not completely solved, and the e600 and 968 are the upper layers.
No graphical source code. The third is e600, And the QTE Library File In 968 contains too little content. These issues are true.
Poor migration of practical application software.
In addition, the problem becomes more and more professional when it comes to actual software. Taking the player as an example, you are willing to write to solve the floating point problem.
It also studies the audio devices of the system, and may need to be produced by disassembly. A software outcome
It is not easy to get, so there is a long way to go.
Then again, if you can go all the way, you can get more than 10 thousand players.
More!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.