|
環境:ubuntu16.04(Qt5.7creater 需要在16.04 版本上運行-迅為IMX6Q開發板)
下載鏈接:http://cn.ubuntu.com/download/
編譯器:arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
下載鏈接: http://www.veryarm.com/arm-none-linux-gnueabi-gcc
觸摸工具:tslib-1.4.tar.gz
下載鏈接: http://vdisk.weibo.com/s/AcUHxOERV2k0?sudaref=www.baidu.com
Qt 源碼:qt-everywhere-opensource-src-5.7.0.tar.gz
下載鏈接: http://download.qt.io/official_releases/qt/5.7/5.7.0/
1.搭建環境
1.1 安裝 vim ssh
apt-get install vim ssh
遇到問題 SSH 連接失敗
解決:vim /etc/ssh/sshd_config
加
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-
ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-
sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-
hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-
nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-
sha1,curve25519-sha256@libssh.org
找到下面這段代碼,修改如下
# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
之后重啟 service ssh restart
1.2 安裝編譯器
將源碼放到/usr/local/arm 下解壓
修改環境變量 vim /etc/profile 并 source 如下圖
arm+tab 鍵,確定可以顯示 arm-none-linux-gnueabi-
輸入 arm-none-linux-gnueabi-gcc -v 顯示 gcc version 4.8.3 20140320
(prerelease) (Sourcery CodeBench Lite 2014.05-29),那就沒問題了。如果提示 no
such 等,要 sudo apt-get install lib32z1 lib32ncurses5
2.編譯 tslib
解壓源碼 tslib-1.4.tar.gz
cd tslib
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
安裝完之后執行
./autogen.sh
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++
--host=arm-none-linux-gnueabi --prefix=/opt/tslib1.4
ac_cv_func_malloc_0_nonnull=yes
make
make install
vim /opt/tslib1.4/etc/ts.conf 修改第二行如下
3.編譯 Qt5.7 的源碼
注意是-O2
在 qt-everywhere-opensource-src-5.7.0 下建立一 autoconfigure.sh 文件內容為:
(沒有編譯 examples,用戶需要可自行調整參數)設置完成后,運行./autoconfigure.sh
之后再 make make install
4.生成 system.img
參考“Linux 系統編程_v2.1.pdf”編譯最小 linux,做到打包生成 system.img 前一步(也
可直接使用迅為提供的“最小 linux 文件系統”),將前兩節生成的“qt-5.7.0”“tslib1.4”
拷貝到“opt”目錄下如下圖。(注意 qt5.7.0 文件名統一成 qt-5.7.0)
將字庫文件夾“fonts”拷貝到“opt/qt-5.7.0/lib/”下。
同時將“libstdc.tar.gz”拷貝到“lib”解壓,并輸入命令“ln -s libstdc++.so.6.0.19
libstdc++.so.6”。
修改環境變量“vim etc/profile”如下圖。
修改開機啟動腳本“vi etc/init.d/rcS”,最后加一行“/bin/qt5.7 &”。
將迅為提供的“
qt5.7”文件拷貝到“bin”下。
參照“Linux 系統編程_v2.1.pdf”編譯最小 linux,打包生成 system.img。若出現
一般出現該錯誤是由于應用程序是 32 位導致的,可以使用 file 命令來查看:
root@ubuntu:/usr/local/bin# file make_ext4fs make_ext4fs: ELF 32-bit LSB executable,
Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
2.6.8, stripped 可以從上面看到 make_ext4fs 為 32 位程序,所以我們需要讓 64 位機支持運
行 32 位應用。 執行下面兩條命令即可解決問題: apt-get install lib32c-dev
apt-get install lib32stdc++6 再運行 make_ext4fs 就不會報錯了。
輸入命令打包系統鏡像“make_ext4fs -s -l 314572800 -a root -L linux system.img
system”
內核使用最小 linux 即可。燒寫鏡像到開發板。
使用迅為提供的“hello”測試程序進行測試,成功
5. qtcreater
將“qt-opensource-linux-x64-5.7.0.run”拷貝到 ubuntu16.04 任意文件夾下,
“chmod 777 qt-opensource-linux-x64-5.7.0.run”,之后直接“./qt-opensource-linux-
x64-5.7.0.run”執行,安裝一直點下一步就 OK!
|
|