基於linux下交叉編譯minigui體會
能不用minigui就不用是對的,這段時間一直在交叉編譯minigui,困難是妥妥的多,幾乎每一個包都有問題,現在我就記錄下碰到的問題,大部分都是在網上找的解決辦法,網上還是大神多啊,下載的庫都是在minigui官網下的,有些問題是庫的問題,低版本庫有問題,高版本庫自己就好了,自己也是莫名其妙。
[編譯zlib庫:]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
AS=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-as \
AR=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ar \
./configure --prefix=/home/lq/build/lq_work/minigui --shared
[編譯png庫:]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
AS=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-as \
AR=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ar \
CPPFLAGS="-g -I/home/lq/build/lq_work/minigui/include" \
LDFLAGS="-L/home/lq/build/lq_work/minigui/lib" \
./configure --prefix=/home/lq/build/lq_work/minigui \
--build=x86_64-linux \
--host=arm-linux-gnueabihf \
--target=arm-linux-gnueabihf
錯誤:
configure: error: zlib not installed
解決方法:
加下面的庫和標頭檔案
CPPFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
LDFLAGS="-L/home/lq/build/lq_work/minigui/lib"
[編譯jpeg庫:]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
AS=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-as \
AR=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ar \
./configure --prefix=/home/lq/build/lq_work/minigui \
--build=x86_64-linux \
--host=arm-linux-gnueabihf \
--target= arm-linux-gnueabihf
[編譯1.3.1 freetype庫]
其他版本的庫就編譯下面這行 我碰見的錯誤就下面那個
./configure --host=arm-linux-gnueabihf --prefix=/home/lq/build/lq_work/minigui --with-freetype=/home/lq/build/lq_work/minigui/freetype/
vi /home/lq/build/lq_work/minigui/freetype-2.3.9-fm20100818/builds/unix/install.mk +50 註釋掉
make &&make install
編譯1.3.1 freetype庫需要用到
vim config.cache
ac_cv_path_LD=${ac_cv_path_LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld}
ac_cv_prog_CC=${ac_cv_prog_CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc}
ac_cv_prog_CPP=${ac_cv_prog_CPP='/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ -E'}
重新配置
./configure --host=arm-linux-gnueabihf --prefix=/home/lq/build/lq_work/minigui
#修改Makefile檔案,以跳過編譯test目錄。
#去掉“all:”後的變數“tttest”
#註釋掉“install:”下的第二行:“cd $(FTTESTDIR); $(MAKE) –f$(MAKEFILE) install”
[編譯minigui-res-be-3.0.12資源庫]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
AS=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-as \
AR=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ar \
./configure --prefix=/home/lq/build/lq_work/minigui
[編譯libminigui-gpl-3.0.12核心庫]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
CFLAGS="-g -fgnu89-inline -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CPPFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CXXFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
LDFLAGS="-L/home/lq/build/lq_work/minigui/lib" \
./configure --enable-pngsupport --prefix=/home/lq/build/lq_work/minigui \
--build=x86_64-linux \
--host=arm-linux-gnueabihf \
--target= arm-linux-gnueabihf
錯誤:
將_va=va改成va_copy(_va=va) ;
[編譯libmgplus-1.2.4庫]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
CFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CPPFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CXXFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
LDFLAGS="-L/home/lq/build/lq_work/minigui/lib " \
MINIGUI_CFLAGS="-I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
MINIGUI_LIBS="-L/home/lq/build/lq_work/minigui/lib -lminigui_ths -ljpeg -lpng -ldl -lm -lpthread " \
./configure --prefix=/home/lq/build/lq_work/minigui \
--build=x86_64-linux \
--host=arm-linux-gnueabihf \
--target= arm-linux-gnueabihf
[編譯mg-samples]
CC=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-gcc \
CXX=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-g++ \
LD=/usr/local/linaro-armv7ahf-2015.11-gcc5.2/bin/arm-linux-gnueabihf-ld \
CFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CPPFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
CXXFLAGS="-g -I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
LDFLAGS="-L/home/lq/build/lq_work/minigui/lib " \
MINIGUI_CFLAGS="-I/home/lq/build/lq_work/minigui/include -I/usr/local/linaro-armv7ahf-2015.11-gcc5.2/include/" \
MINIGUI_LIBS="-L/home/lq/build/lq_work/minigui/lib -lminigui_ths -ldl -lpthread -lm -lpng -ljpeg -lz" \
./configure --prefix=/home/lq/build/lq_work/minigui \
--build=x86_64-linux \
--host=arm-linux-gnueabihf \
--target= arm-linux-gnueabihf
錯誤:
libminigui_ths.so定義未申明
在核心庫CLFAGS加上 -fgnu89-inline
libpng.so定義未申明
加上 -lz
MINIGUI_LIBS="-L/home/lq/build/lq_work/minigui/lib -lminigui_ths -lpng -ljpeg -ldl -lm -lpthread -lz" \
在開發板上執行:
修改配置
$ vim /usr/local/minigui/etc/MiniGUI.cfg
02 # 修改如下引數
03 # GAL engine and default options
04 gal_engine=fbcon
05
06 # IAL engine
07 ial_engine=console
08 mdev=/dev/input/mice
09 mtype=IMPS2
10
11 # 根據實際的顯示大小填
12 [fbcon]
13 defaultmode=480x272-16bpp
執行sample問題總結
(1)./helloworld: error while loading shared libraries: libminigui_ths-3.0.so.12: cannot open shared object file: No such file or directory
解決:
export LD_LIBRARY_PATH=/sdcard/ \
export LD_LIBRARY_PATH=/sdcard/lib:$LD_LIBRARY_PATH
(2)MISC: Can not locate your MiniGUI.cfg file or bad files!
KERNEL>InitGUI: Initialization of misc things failure!
解決:把libminigui-gpl-3.0.12/etc/MiniGUI.cfg複製到當前目錄下[mg-samples-3.0.12/src]
(3)KERNEL>InitGUI: Count not init mouse cursor!
KERNEL>InitGUI: Init failure, please check your MiniGUI configuration or resource.
解決:
修改MiniGUI.cfg配置檔案
[cursorinfo]
108 # Edit following line to specify cursor files path
109 #cursorpath=/usr/local/share/minigui/res/cursor/
110 cursorpath=/sdcard/share/minigui/res/cursor/
111 cursornumber=23
[resinfo]
137 #respath=/usr/local/share/minigui/res/
138 respath=/sdcard/share/minigui/res/
本來還有個unknow type png的錯誤,在核心庫新增LDCAFLAGS就好了,交叉編譯好了,正式進入專案開發!!