Qt4.7 arm編譯

第一步 編譯tslib
cd tslib
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux --cache-file=arm-linux.cache -prefix=/usr/local/tslib
make
make install
第二步 編譯QT4.7的各種版本

ARM版
解壓qt-everywhere-opensource-src-4.7.0.tar.gz,並拷貝出三份,分別命名成qt-4.7.0-arm、qt-4.7.0-x86、qt-4.7.0-pc
cd qt-4.7.0-arm
./configure -prefix /usr/local/Trolltech/qt-4.7.0-arm -opensource -confirm-license -release -shared -embedded arm -xplatform qws/linux-arm-g++ -no-qt3support -fast -no-largefile -qt-mouse-tslib -I /usr/local/tslib/include -L /uar/local/tslib/lib -make tools -make demos -make examples -make docs -qt-libjpeg -qt-libpng -qt-libtiff -qt-gif -multimedia
make
make install
1.使用4.3.3交叉編譯器出現以下錯誤:
../3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp: In function 'void* TrySbrk(size_t, size_t*, size_t)':
../3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp:126: error: 'sbrk' was not declared in this scope
make[1]: *** [obj/release/TCSystemAlloc.o] Error 1
make[1]: Leaving directory `/home/bakul/Qt/qt-everywhere-opensource-src-4.6.3/src/script'
make: *** [sub-script-make_default-ordered] Error 2
解決方法:
    到目錄/usr/local/arm/4.3.3/arm-none-linux-gnueabi/libc/usr/include下打開unistd.h頭文件,第996行註釋的內容反註釋,
extern void *sbrk (intptr_t __delta) __THROW;
後來又改成:
extern void *sbrk (size_t __delta) __THROW;
不知道爲什麼,把這個函數的引用的給註釋掉了,希望高手解析一下。繼續編譯,再也沒有這個錯誤提示。
X86版
cd qt-4.7.0-x86
./configure -prefix /usr/local/Trolltech/qt-4.7.0-x86 -opensource -confirm-license -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb -make tools
make
make install
PC版
cd qt-4.7.0-pc
./configure -prefix /usr/local/Trolltech/qt-4.7.0-pc -opensource -confirm-license
make
make install
第三步 編譯qvfb
接下來安裝PC版本的qvfp
cd qt-4.7.0-pc
cd tools/qvfp
make
cp qt-4.7.0-pc/bin/qvfp /usr/local/Trolltech/qt-4.7.0-x86/bin
make
至此安裝完成
第四步 設置QTCreater
把usr/local/Trolltech/qt-4.7.0-x86/examples/widgits/calculator文件夾複製到root/tmp文件夾下
啓動QtCreator,File-->Open File or Project...,打開root/tmp/calculator/calculator.pro
這裏我們分兩部分,首先編譯x86下的,並運行在qvfb下,再編譯arm下的,最後移到開發板下運行。
x86下的編譯與調試
1.在QtCreator界面左側點擊Projects圖標,打開工程設置界面。
2.在Edit Project Settings for Project calculator-->Build Settings-->Edit Build Configuration;單擊Add,在下拉列表中選擇Using Qt Version “x86”彈出對話框單擊Ok按鈕,在Edit Build Configuration:下會出現藍色的Make x86 Release active.字符,單擊激活x86 Release。
3.在Run Settings-->Edit run configuration;右側單擊Show Details按鈕,在打開的下拉列表中Arguments;文本框中添加參數“-qws”
4.設置完畢,點擊Edit圖標,回到編輯界面。
5.編譯:在Build菜單下,先Clean Project “calculator”,然後Build Project “calculator”,在右下角Compile Output窗口能看到編譯信息
6.運行:
啓動終端,輸入/usr/local/Trolltech/qt-4.7.0-x86/bin/qvfb -width 800 -height 480 &,啓動qvfb
回到QtCreator,Build-->Run,運行程序,切換我們的qvfb窗口中,就可以看到calculator的運行界面了
第五步 製作適合嵌入式系統的字庫文件

把windows下的simhei.ttf拷貝到lib下的fonts目錄中
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章