Hi3520A开发QT porting

把qt-embedded-linux-opensource-src-4.5.3.tar.gz拷贝到/home/chl/temp/qt/(工作目录,视自己情况而定,但交叉编译后arm的文件系统下最好也在同样名称的目录下,否则可能会运行出错,原因未仔细分析);
tar xvzf qt-embedded-linux-opensource-src-4.5.3.tar.gz

cd qt-embedded-linux-opensource-src-4.5.3

vim mkspecs/qws/linux-arm-g++/qmake.conf,把所有的arm-linux-改为arm-hismall-linux-

./configure --prefix=/home/chl/temp/qt/Trolltech/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc

vim examples/examples.pro,删除行
contains(QT_CONFIG, webkit): SUBDIRS += webkit
否则编译example webkit时会报错

vim demos/demos.pro,删除两行
contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):SUBDIRS += demos_browser
demos_browser.subdir = browser
否则编译demo browser会出错

./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc

Qmake.conf

qmake configuration for building with arm-linux-g++

include(…/…/common/g++.conf)
include(…/…/common/linux.conf)
include(…/…/common/qws.conf)

modifications to g++.conf

QMAKE_CC = arm-hisiv100-linux-uclibcgnueabi-gcc
QMAKE_CXX = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_LINK = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_LINK_SHLIB = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_CFLAGS += -march=armv7-a -mcpu=cortex-a9
QMAKE_CXXFLAGS += -march=armv7-a -mcpu=cortex-a9

modifications to linux.conf

QMAKE_AR = arm-hisiv100-linux-uclibcgnueabi-ar cqs
QMAKE_OBJCOPY = arm-hisiv100-linux-uclibcgnueabi-objcopy
QMAKE_STRIP = arm-hisiv100-linux-uclibcgnueabi-strip

load(qt_config)

./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource

-no-pch /
-xplatform /
qws/linux-arm-g++ /
-arch arm /
-embedded arm /
-no-freetype /
-qt-mouse-pc /
-fast /
-no-largefile /
-no-accessibility /
-no-xmlpatterns -no-phonon -no-webkit -no-scripttools /
-no-nis -no-cups -no-iconv -no-pch /

ZLib.h is missing.

Install Toolchain and Qt Embedded for Beagleboard-xM

Reference link: http://treyweaver.blogspot.com/2010/10/setting-up-qt-development-environment.html
http://mfcoding.wordpress.com/2012/08/22/beagleboard-xm-compiling-qt-embedded/

Details:
Toolchain: angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2
Qt Embedded: qt-everywhere-opensource-src-4.7.4.tar.gz

Step 1: Update and install libraries:
sudo apt-get install libgmp3-dev libmpfr-dev zlib1g-dev libncurses5-dev

Step 2: Go to the download directory and run:
sudo tar -xvj -C / -f angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2

Step 3: Unzip the tar file you just downloaded. Go into the download directory and execute:
tar -xvzf qt-everywhere-opensource-src-4.7.4.tar.gz

Step 4: Go to folder: qt-everywhere-opensource-src-4.7.4:
cd qt-everywhere-opensource-src-4.7.4
and make a new mkspecs directory for the BeagleBoard Processor:
cp -R mkspecs/qws/linux-arm-g++/ mkspecs/qws/linux-dm3730-g++/

Step 5: Edit the /mkspecs/qws/linux-dm3730-g++/qmake.conf

qmake configuration for building with arm-linux-g++

include(…/…/common/g++.conf)
include(…/…/common/linux.conf)
include(…/…/common/qws.conf)

modifications to g++.conf

#Toolchain

#Compiler Flags to take advantage of the ARM architecture
QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp

QMAKE_CC = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/gcc
QMAKE_CXX = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK_SHLIB = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++

modifications to linux.conf

QMAKE_AR = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/ar cqs
QMAKE_OBJCOPY = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/objcopy
QMAKE_STRIP = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/strip

load(qt_config)

Step 6: Configure options for Qt:
./configure -prefix /opt/qt-dm3730 -embedded arm -little-endian -no-qt3support -nomake examples -nomake demos -opensource -confirm-license -xplatform qws/linux-dm3730-g++

Step 7: Make and Install:
make -j4
sudo make install

*SETTING UP the Beagleboard-xM /
Now it is time to set up the Beagleboard. All of the Qt files that you need to move to the BeagleBoard can be found in the /opt/qt-arm/lib directory on your Linux Build System.

Unfortunately Qt expects the library and font files to have the same directory structure on your build machine and your target machine. On our systems that directory is opt/qt-dm3730 because we used “-prefix opt/qt-dm3730” in our configuration. So on your Beagleboard you need create the opt/qt-dm3730/lib directory.
cd /
mkdir opt
cd opt
mkdir qt-dm3730
cd qt-dm3730
mkdir lib
cd lib

Now you need to copy all the files out of your build system’s /opt/qt-arm/lib directory and put those into the BeagleBoard-xM’s /opt/qt-arm/lib directory. You can get the files to the Beagleboard by either networking, using a usb drive or plug the SD card into your Linux Build System.

You will now need to set up the BeagleBoard’s path to point to this library directory. Edit the PATH statement in /etc/profile to the following:

PATH="/opt/qt-arm/lib:…

There are a few packages you need to install on your BeagleBoard-xM to support Qt.
Connect your BeagleBoard to the Internet.

If you have not updated your opkg mangers library in a while then run:

opkg update

To get the packages run:

opkg install libgles-omap3
opkg install libstdc++6
opkg install libpng12-0

These packages are the ones that I found I needed when running a Qt program that uses the QtCore andQtGUI; other packages may need to be added as your Qt program uses more Qt libraries.

If you are unable to connect the BeagleBoard to Internet you can go here to download the packages.

Building and Running a Qt Program.

Start Qt-Creator; Create a new project. Go to Projects and make sure your Build Settings is set to QT BeagleBoard 4.6.2. Build your project. Copy your executable to the BeagleBoard and execute it. Normally you will be running the program (if it is a GUI application) using the Frame Buffer and you will need to use the -qws option.

My-First-BB-Program -qws

./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib

Qt4.7.3
root@ubuntu:~/jsdwork/qt-everywhere-opensource-src-4.7.4# ./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian

2014年1月28日星期二
./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-script -no-scripttools

QT 4.5.3
./configure --prefix=/home/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-scripttools

Change install prefix to lib/qthaisi
./configure --prefix=/lib/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-scripttools
2014年2月6日星期四
qmake.conf

qmake configuration for building with arm-linux-g++

include(…/…/common/g++.conf)
include(…/…/common/linux.conf)
include(…/…/common/qws.conf)

modifications to g++.conf

QMAKE_CC = arm-hisiv100-linux-uclibcgnueabi-gcc
QMAKE_CXX = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_LINK = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_LINK_SHLIB = arm-hisiv100-linux-uclibcgnueabi-g++
QMAKE_CFLAGS += -march=armv6
QMAKE_CXXFLAGS += -march=armv6

#QMAKE_CFLAGS += -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp
#QMAKE_CXXFLAGS += -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp

modifications to linux.conf

QMAKE_AR = arm-hisiv100-linux-uclibcgnueabi-ar cqs
QMAKE_OBJCOPY = arm-hisiv100-linux-uclibcgnueabi-objcopy
QMAKE_STRIP = arm-hisiv100-linux-uclibcgnueabi-strip
load(qt_config)

22:49:00
With debug
./configure --prefix=/lib/qtHisi -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-scripttools -debug -no-opengl -separate-debug-info -exceptions
指令集中包含VMOV指令,是把浮点数放到寄存器。
修改了qmake.conf,改用ARM6_T的CXX flagstaff。Hope I can get around it.

474

./configure --prefix=/lib/qtHisi474 -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-scripttools -debug
Edit to get accepte4,then make && make install ok.
/home/open/work/qt-everywhere-opensource-src-4.7.4/src/network/socket/qnet_unix_p.h:121: undefined reference to `accept4’

/*
#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
// use accept4
int sockflags = SOCK_CLOEXEC;
if (flags & O_NONBLOCK)
sockflags |= SOCK_NONBLOCK;
fd = ::accept4(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen), sockflags);
if (fd != -1 || !(errno == ENOSYS || errno == EINVAL))
return fd;
#endif
*/

下午1时42分

./configure --prefix=/lib/qtHisi485 -no-pch -xplatform qws/linux-arm-g++ -arch arm -embedded arm -no-freetype -qt-mouse-pc -no-glib -no-dbus -no-iconv -no-iconv -no-cups -no-nis -no-openssl -no-libmng -no-libpng -no-gif -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-xmlpatterns -no-qt3support -no-accessibility -opensource -qt-zlib -little-endian -no-webkit -nomake demos -nomake examples -nomake tools -no-scripttools -debug
failed.

7.更改虚拟机的环境变量
export QMAKESPEC=/work/xingwang/qtlib/mkspecs/qws/linux-arm-g++
export PATH="/work/xingwang/qtlib/bin":$PATH

要根据实际情况更改上边的2个环境变量。/work/xingwang/qtlib是QT的安装路径

export PATH=$PATH:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin

export QMAKESPEC=/home/qtlinux/mkspecs/qws/linux-arm-g++
export PATH="/home/qtlinux/bin": P A T H e x p o r t P A T H = " / o p t / q t c r e a t o r − 2.6.2 / b i n " : PATH export PATH="/opt/qtcreator-2.6.2/bin": PATHexportPATH="/opt/qtcreator2.6.2/bin":PATH

8.检查QT环境变量是否设置成功。
输入 which qmake 后显示路径应该是QT安装目录里的qmake.

下午9时18分
Missing zlib.h
root@ubuntu:~/work/qt-embedded-linux-opensource-src-4.5.3/include/QtGui# cp /usr/local/include/zlib.h .
root@ubuntu:~/work/qt-embedded-linux-opensource-src-4.5.3/include/QtGui# cp /usr/local/include/zconf.h .
2014年2月4日星期二
对自己的程序不进行优化的话,可以修改/opt/EmbedSky/qt-4.5/__install/arm/mkspecs/common下的g++.conf中的QMAKE_CFLAGS_RELEASE += -O2 为-O0;

QTcreator

/opt/qtcreator-2.6.2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值