نصب صحیح Guest Additions روی virtual box نیاز به اجرا دستور زیر در ابتدا دارد:
sudo apt-get install make gcc linux-headers-$(uname -r)
- ۰ نظر
- ۲۸ مرداد ۰۱ ، ۱۳:۰۶
نصب صحیح Guest Additions روی virtual box نیاز به اجرا دستور زیر در ابتدا دارد:
sudo apt-get install make gcc linux-headers-$(uname -r)
This article mainly describes the porting process of QT. For the porting process of tslib, you can search for the reference of "The whole process of tslib1.4 porting". If you don't need a touch screen,
you don't need to port tslib.
Make sure the following software is installed,
sudo apt-get install xorg-dev libfontconfig1-dev \
libfreetype6-dev libx11-dev libxcursor-dev libxext-dev \
libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev
1. Unzip the source code qt-everywhere-opensource-src-5.4.1.tar.gz, and enter the source code folder
tar xzf qt-everywhere-opensource-src-5.4.1.tar.gz
cd qt-everywhere-opensource-src-5.4.1/
vi qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
Change it to the following, you should actually need to make corresponding changes according to your own development environment:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_INCDIR += /usr/local/tslib/include
QMAKE_LIBDIR += /usr/local/tslib/lib
modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc -lts
QMAKE_CXX = arm-linux-gnueabihf-g++ -lts
QMAKE_LINK = arm-linux-gnueabihf-g++ -lts
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++ -lts
modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
./configure \
-prefix /usr/local/qt5.4.1 \
-confirm-license \
-opensource \
-release \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-tslib \
-no-opengl \
-no-sse2 \
-no-openssl \
-no-nis \
-no-cups \
-no-glib \
-no-dbus \
-no-xcb \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-make examples -nomake tools -nomake tests -no-iconv
sudo make && make install
After completing the above steps, qt5.4.1 will be installed into /usr/local/qt5.4.1. Then copy qt5.4.1 in /usr/local/ to the
/opt/ directory of the development board, and copy tslib in /usr/local/ to /usr/local/ of the development board.
vi /etc/bash.bashrc
Add the following:
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/tslib/lib:/opt/qt5.4.1/lib
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/tslib/bin
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/qt5.4.1/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=/opt/qt5.4.1/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE
After saving and exiting, make the above environment variables take effect:
source /etc/bash.bashrc
/opt/qt5.4.1/examples/touch/pinchzoom/pinchzoom
/opt/qt5.4.1/examples/svg/embedded/fluidlauncher/fluidlauncher
We can see that QT running in linuxfb mode has no frame border, which is a feature of qt5, which seems to be better transferred to
mobile terminals such as mobile phones.
When testing the program, it may prompt that some library files do not exist. You can copy the corresponding library files under the cross compiler in the ubuntu host to the licheepi
development board, and then add environment variables to make it effective. Copy it if you don't know.
Open any editor to create a bash file. Here, nano editor is used to create the file and filename is set as ‘First.sh’
$ nano First.sh
Add the following bash script to the file and save the file.
#!/bin/bash
echo "Hello World"
$ bash First.sh
Or,
$ chmod a+x First.sh
$ ./First.sh
For programs with a single source file, using gcc is simple.
/* File name is hello_world.c */
#include <stdio.h>
int main(void)
{
int i;
printf("Hello world!\n");
}
To compile the file hello_world.c from the command line:
gcc hello_world.c
gcc will then compile program and output the executable to the file a.out. If you want to name the executable, use the -o option.
gcc hello_world.c -o hello_world
The executable will then be named hello_world instead of a.out. By default, there are not that many warnings that are emitted by gcc. gcc has many warning options and it is a good idea to look through the gcc documentation to learn what is available. Using '-Wall' is a good starting point and covers many common problems.
gcc -Wall hello_world.c -o hello_world
Install well zlib Behind the library , Proceed again libpng The installation of the library .
cd libpng-1.6.37
export LDFLAGS="-L/home/book/mytest/zlib-1.2.11"
export CPPFLAGS="-L/home/book/mytest/zlib-1.2.11"
./configure --host=arm-linux-gnueabihf --prefix=$PWD/tmp
make
sudo make install
First installation zlib library
zlib Official website :http://www.zlib.net/
compile zlib library ,./configure Incoming... Is not allowed –host Parameters ; If you don't support it, you need export CC Set to your arm Tool chain
Through here $ export CC=arm-linux-gnueabihf-gcc( Modify according to your own cross compiler tool chain arm-linux-gnueabihf-gcc) Configure the cross compiler tool .
cd zlib-1.2.11
export CC=arm-linux-gnueabihf-gcc
./configure --prefix=$PWD/tmp
make
make install