Current location - Health Preservation Learning Network - Healthy weight loss - Linuxqt compilation
Linuxqt compilation
How to compile and run qt program under linux?

Command line editor under 1.Linux: #mkdirhello//mkdir command creates a hello directory #cdhello//cd command switches to the newly created hello directory #vimain.cpp// creates a main.cpp file with vi in the hello directory, and enters the following code #include in the main.cpp file.

How to install qt embedded system under ubuntu?

1CD ~/qtenv23chmodu+xqt-SDK-Linux-x86-OpenSource-2010.04.bin45./Qt-SDK-Linux-x86-OpenSource-2010.04.bin In order to facilitate file management, 2. Decompress the source code package and establish a Qtenv directory under the user directory to store the compiled source files. Mkdir$HOME/Qtenv creates arm and x86 directories under qtembedded directory. These two directories are mainly created for compiling QTE of a user's arm development version, and the other directory is used to store QTE for qvfb under x86, which is convenient for demonstration and development. 1cd~/Qtenv 2mkdirarmx86 Next, copy the source code package to arm and x86 respectively and decompress it. Although this will waste some hard disk space (ps: the hard disk on the host is too worthless), it can save a lot of time for future reconfiguration and compilation. 1cd ~/Qtenv 2 mvqt-everywhere-open source-src-4 . 6 . 3 . tar . bz2 ./arm 3cd ~/Qtenv/ arm 4 tarxjvfqt-everywhere-open source-src-4 . 6 . 3 . tar . bz2 5 6cd ~/Qtenv/X86 7 mvqt-everywhere-open source-src-4 . 6 . 3 . tar . bz2 ./ X86 tar xjvf./x86/Qt-everywhere-open source-src-4.6.3.tar.bz2 is decompressed and configured as arm platform and x86 platform respectively, and it can be accessed. //Configuration-Embedded-Help Configuration. The command code is as follows: 1cd ~/qtenv/arm2. /configure-prefix $ home/qtenv/arm-embedded arm-nomakedocs-nomakedemo-nomake example 3make4makeinstall56cd ~/qtenv/x867. /configure-prefix $ home/qtenv/arm-embedded x86-no make docs-no make demo-no make examples 8 make 9 make install. After a long time of configuration and compilation, the qte installation is completed. I made two mistakes in compiling the arm version. I compiled with reference to "compiling qt-embedded-4.6.2 under arm-linux-gcc3.4. 1". After compilation and installation, you need to set the system environment variables, which can be temporary or permanent. Temporary line setting is directly input1exportqtenv = $ home/qtenv2exportqtxdir = $ qtenv/qtsdk3exportqtedir = $ qtenv/x86 4 exportpath = $ qtxdir/Qt/ Bin: $ path5exportld _ library _ path = $ qtxdir/lib: $ ld _ library _ path6exportqvfbdir = $ qtxdir/qt/bin7exportqtemakedir = $ qtedir/bin These variables can be added or deleted according to your own preferences. This setting method is invalid after closing the current command terminal. The second method is editing. Bash_profile file, add the above command line and save the restart command terminal.

How to build QT running environment in ARMLinux environment?

1 is 2, and QtCreator is just an integrated development tool. This version is free online and offline. Qte is not the latest, but it's better to use the same one you developed in Linux. First, cross-compile the Qte library under Linux, then transplant the Lib file to the board, and finally compile your pc through the cross-compile library.

How to run the transplanted QT program under raspberry pie?

You can refer to SQLiteStudio, a cross-platform SQLite management tool written by Qt, which encapsulates the dependent Qt library itself, can be decompressed and used immediately, and is compatible with different Linux distributions. The reason is actually similar to the Qt library of Windows Qt program.

Pass parameters to the connector before compiling:

Description:

-Wl tells the compiler to pass the following parameters to the linker.

Rpath is a parameter of gcc. When the program is loaded, it will search the rpath directory to find the * * * shared library.

The directory information added by rpath is saved in the executable file.

$ORIGIN indicates the directory where the executable file is located.

In other words, the runtime program will first load the dependency library in the lib of its own directory, and if not, look it up in the system library.

If your program does not pass the rpath parameter at compile time, you can also use patchelf to modify the rpath of the program:

Note: Stripping after patchelf modifies the file will cause file damage.

Therefore, it is necessary to use strip to delete the symbol table and shrink the binary file first, and then use patchelf to set rpath.

Off-topic, there is neither glibc library nor library linker ld-linux.so.3 on Android.

If you want to run the software on DebianARM on Android (such as Raspbian of Raspberry Pie), you can also package the * * * library that the program depends on, so that the program can also run on Android, such as PHP:

That is, you put the library linker ld-linux-armhf.so.3 and the library that PHP depends on in /data/local/tmp/web/lib, and then set the names, you can run Raspberry Pi PHP in the adbshell of Android.

Of course, you can also use patchelf to set PHP interpreter and rpath, and the effect is similar:

How to cross-compile a QT application?

1. Set the environment variable: rPATH= = to be added as a qmake path generated after compiling across environments, which is usually the architecture with the host system. At the same time, it is necessary to ensure that the cross-gcc compiler defines the platform description file of rQMAKESOEC = = cross-compiled objects in the path, such as the installation file of makeespec/QWS/Linux-arm-g++rqtdir = Qt. Library and header file rLD_LIBRARY_PATH= cross-compilation library for storing Qt, and prepare the link library r2 of the compilation target. Execute the environment variable r Usually we will put the above settings in a bash script and execute it when necessary. Start compiling r 1. Use qmake-project to generate project file * * ****.pror2 use qmake to generate Makefile r3 use make to compile and migrate: use readeif tool to analyze the source code library of the target system, and then copy the related libraries to the target file system. Usually we also follow the script. R Generally speaking, we can solve any routine or repetitive work through scripts.