Debian 中安裝minigui 1.3.3

一. 下載文件
    libminigui-1.3.3.tar.gz
    mg-samples-1.3.0.tar.gz (示例)
    minigui-res-1.3.3.tar.gz(資源)
    qvfb-1.1.tar.gz (virtual frame buffer)

二. 編譯源碼

    [注]: 1. 由於安裝實例程序時,將出現/usr/local/lib/libminigui.so: undefined reference to `pthread_kill_other_threads_np'
             建議先將./libminigui-1.3.3/src/kernel/init.c:435:        pthread_kill_other_threads_np (); 註釋掉。

          2. libminigui-1.3.3目錄下, make menuconfig,需要ncurses庫支持(apt-get install libncurses5-dev)。

    2.1. 編譯libminigui

           libminigui-1.3.3 # make menuconfig

          如果對配置的選項不是很清楚,可以查看文檔《Linux/uClinux + MiniGUI: 嵌入式系統開發原理、工具及過程》的附錄B部分。這裏保持默認配置,然後退出配置界面並保存設置。

          如果出現如下錯誤,可以運行 ./configure後,再運行make
          Saving your MiniGUI configuration...scripts/mkconfig: 33: Syntax error: "(" unexpected

接着執行make進行編譯:

        根據需要進行必要的參數選擇後,保存配置參數.
        執行make,進行編譯。

    編譯中遇到的問題:
    2.1.1. varbitmap.c:248: error: static declaration of 'var_bitmap_font_ops' follows non-static declaration
        varbitmap.h:38: error: previous declaration of 'var_bitmap_font_ops' was here
        make[4]: *** [varbitmap.lo] 錯誤 1
        make[4]: Leaving directory `~/download/minigui/minigui1.3.x/soures/libminigui-1.3.3/src/font'
        make[3]: *** [all-recursive] 錯誤 1
        make[3]: Leaving directory `~/download/minigui/minigui1.3.x/soures/libminigui-1.3.3/src/font'
        make[2]: *** [all-recursive] 錯誤 1
        make[2]: Leaving directory `~/download/minigui/minigui1.3.x/soures/libminigui-1.3.3/src'
        make[1]: *** [all-recursive] 錯誤 1
        make[1]: Leaving directory `~/download/minigui/minigui1.3.x/soures/libminigui-1.3.3'
        make: *** [all] 錯誤 2

    解決辦法(三種):
        1) 重新運行make menuconfig,將“Font options”中的“Var bitmap font”選項去掉即可:
          │ │ [*] Raw bitmap font         │ │
          │ │ [ ] Var bitmap font         │ │
          │ │ [*] Incore font sansserif   │ │
          │ │ [*] Incore font courier     │ │
          │ │ [*] Incore font symbol      │ │
          │ │ [*] Incore font vgas        │ │
          │ │ [*] Qt Prerendered Font     │ │
          │ │ [*] TrueType font           │ │
          │ │ [*] Adobe Type1 font        │ │

        2) 修改src/font/varbitmap.c文件,將static改爲extern。
            249    extern FONTOPS var_bitmap_font_ops = {  //change static to extern

        3) 安裝freetype-1.3.1

    2.1.2. In file included from defkeymap.c:15:
        keyboard.h:43: error: expected ')' before '*' token
        keyboard.h:49: error: expected specifier-qualifier-list before 'INIT_KBD_LAYOUT'
        keyboard.h:52: error: expected ')' before '*' token
        defkeymap.c:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'plain_map'
        defkeymap.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'shift_map'
        defkeymap.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'altgr_map'
        defkeymap.c:74: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ctrl_map'
        defkeymap.c:93: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'shift_ctrl_map'
        defkeymap.c:112: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'alt_map'
        defkeymap.c:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ctrl_alt_map'
        defkeymap.c:150: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
        defkeymap.c:267: error: expected ')' before '*' token

        原因及修改辦法:
            原因是代碼中沒有定義ushort和u_short,在keyboard.h中添加定義:
                typedef unsigned short u_short;
            修改下面兩個源文件,將ushort修改爲u_short.
                src/gui/keyboard.h
                src/gui/defkeymap.c

    2.1.3. gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../include -I../../include -I../ -g -O2 -D__MINIGUI_LIB__ -Wall -Wstrict-prototypes -pipe -MT fbvideo.lo -MD -MP -MF .deps/fbvideo.Tpo -c fbvideo.c  -fPIC -DPIC -o .libs/fbvideo.lo
        fbvideo.c:19:63: error: asm/page.h: No such file or directory
        fbvideo.c: In function 'FB_VideoInit':
        fbvideo.c:368: error: 'PAGE_SIZE' undeclared (first use in this function)
        fbvideo.c:368: error: (Each undeclared identifier is reported only once
        fbvideo.c:368: error: for each function it appears in.)
        make[4]: *** [fbvideo.lo] 錯誤 1
        make[4]: Leaving directory `/home/epic/arm2440/minigui/2.0.x/libminigui-2.0.3-linux/src/newgal/fbcon'
        make[3]: *** [all-recursive] 錯誤 1
        make[3]: Leaving directory `/home/epic/arm2440/minigui/2.0.x/libminigui-2.0.3-linux/src/newgal'
        make[2]: *** [all-recursive] 錯誤 1
        make[2]: Leaving directory `/home/epic/arm2440/minigui/2.0.x/libminigui-2.0.3-linux/src'
        make[1]: *** [all-recursive] 錯誤 1
        make[1]: Leaving directory `/home/epic/arm2440/minigui/2.0.x/libminigui-2.0.3-linux'
        make: *** [all] 錯誤 2

        原因及修改辦法:
        版本稍高一點Linux系統中沒有 <asm/page.h>
        不過好在minigui也只是用到了文件中的一個宏定義 -- PAGE_SIZE
        只需要註釋掉#include 然後#define一個即可  如下:
            //#include <asm/page.h>        /* For definition of PAGE_SIZE */
            #define PAGE_SIZE 4096  

        2.1.4.grid.c: In function 'AddCol':
        grid.c:626: error: lvalue required as left operand of assignment
        grid.c:627: error: lvalue required as left operand of assignment
        grid.c:638: error: lvalue required as left operand of assignment
        grid.c:639: error: lvalue required as left operand of assignment
        grid.c:667: error: lvalue required as left operand of assignment
        grid.c:668: error: lvalue required as left operand of assignment
        grid.c:680: error: lvalue required as left operand of assignment
        grid.c:681: error: lvalue required as left operand of assignment
        grid.c: In function 'AddRow':
        grid.c:733: error: lvalue required as left operand of assignment
        grid.c:734: error: lvalue required as left operand of assignment
        grid.c:745: error: lvalue required as left operand of assignment
        grid.c:746: error: lvalue required as left operand of assignment
        grid.c:774: error: lvalue required as left operand of assignment
        grid.c:775: error: lvalue required as left operand of assignment
        grid.c:788: error: lvalue required as left operand of assignment
        grid.c:789: error: lvalue required as left operand of assignment
        make[3]: *** [grid.lo] 錯誤 1
        make[3]: Leaving directory `/home/jack/download/minigui/minigui1.3.x/soures/libminigui-1.3.3/ext/control'
        make[2]: *** [all-recursive] 錯誤 1
        make[2]: Leaving directory `/home/jack/download/minigui/minigui1.3.x/soures/libminigui-1.3.3/ext'
        make[1]: *** [all-recursive] 錯誤 1
        make[1]: Leaving directory `/home/jack/download/minigui/minigui1.3.x/soures/libminigui-1.3.3'
        make: *** [all] 錯誤 2

        原因及修改辦法:
            error: lvalue required as left operand of assignment
            出錯原因:編譯器版本不同,現在的gcc明確要求指定操作順序。
            http://oss.lzu.edu.cn/modules/lifetype/index.php?op=ViewArticle&articleId=131&blogId=6
            不過在這裏爲什麼要做強制類型轉換,PGRIDCOLHDR定義中沒有pRowHdr及pColHdr的定義。相反pRowHdr及pColHdr在pCelll中有定義。
            這麼做感覺沒什麼意義,直接將"(PGRIDCOLHDR)"刪除。
            //(PGRIDCOLHDR)pCell1->pRowHdr = pRowHdr;
            pCell1->pRowHdr = pRowHdr;

            當然一定要做強制類型轉換,將其修改爲
            626 ((PGRIDCOLHDR)pCell1)->pHeadCell->pRowHdr = pRowHdr;

        [說明]
        編譯成功後運行make install進行libminigui庫的安裝,默認配置下將安裝到/usr/local/目錄下,可以在make menuconfig中修改“Development environment options”中的“Path prefix”來指定安裝目錄。如果使用其他目錄,則需要注意相關的目錄必須添加進環境PATH變量中,否則在編譯MiniGUI應用程序時會出現找不到包含文件等錯誤信息。
接着要運行ldconfig加載新生成的鏈接庫,否則將會出現類似找不到“libminigui-1.3.so.3”的錯誤消息


    2.2 安裝MiniGUI的資源包:
        在源碼目錄中直接運行: sudo make install即可
        ~/download/minigui/minigui1.3.x/soures/minigui-res-1.3.3 $ make install

    2.3 安裝qvfb:
        2.3.1 configure時,提示缺少Qt頭文件。
            ~/download/minigui/minigui1.3.x/soures/qvfb-1.1$ ./configure
            checking for Qt... configure: error: Qt (>= Qt 3.0.3) (headers and libraries) not found. Please check your installation!
            For more details about this problem, look at the end of config.log.

            原因是缺少Qt的頭文件,需要安裝Qt的開發包,如果安裝後依然不能找到,在編譯時直接指定路徑即可。
          ./configure --with-qt-dir=/usr/lib/qt3 --with-qt-includes=/usr/include/qt3
          其中qt-3爲當前qt的版本號.

            Debian下也可以使用auto-apt編譯:
            安裝auto-apt: $sudo apt-get install auto-apt
                          $auto-apt run ./configure

        2.3.2 make && sudo make install

    2.4 安裝示例程序:
        2.4.1 ~/download/minigui/minigui1.3.x/soures/mg-samples-1.3.1$ ./configure
        2.4.2 ~/download/minigui/minigui1.3.x/soures/mg-samples-1.3.1$ make
            編譯出錯,提示信息如下:
            make[1]: Entering directory `/home/jack/download/minigui/minigui1.3.x/soures/mg-samples-1.3.1/src'
            source='helloworld.c' object='helloworld.o' libtool=no /
                depfile='.deps/helloworld.Po' tmpdepfile='.deps/helloworld.TPo' /
                depmode=gcc3 /bin/sh ../depcomp /
                gcc -DPACKAGE_NAME=/"/" -DPACKAGE_TARNAME=/"/" -DPACKAGE_VERSION=/"/" -DPACKAGE_STRING=/"/" -DPACKAGE_BUGREPORT=/"/" -DPACKAGE=/"mg-samples/" -DVERSION=/"1.3.1/" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MINIGUI_COMMON_H=1 -DHAVE_DECL__LITE_VERSION=0 -DHAVE_DECL__STAND_ALONE=0 -DHAVE_DECL__USE_NEWGAL=1  -I. -I.     -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT -c `test -f 'helloworld.c' || echo './'`helloworld.c
            gcc  -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT   -o helloworld  helloworld.o  -lminigui -lm -lpthread -lc
            /usr/local/lib/libminigui.so: undefined reference to `pthread_kill_other_threads_np'
            collect2: ld returned 1 exit status
            make[1]: *** [helloworld] 錯誤 1
            make[1]: Leaving directory `/home/jack/download/minigui/minigui1.3.x/soures/mg-samples-1.3.1/src'
            make: *** [all-recursive] 錯誤 1

            原因:刪除 MiniGUI 源代碼中調用'pthread_kill_other_threads_np'這個函數
            的語句。應該在 src/kernel/init.c 文件中,也可以運行 grep 找一下這個函數。
            ~/download/minigui/minigui1.3.x/soures$ grep -r -n 'pthread_kill_other_threads_np' .
            ./libminigui-1.3.3/src/kernel/init.c:435:        pthread_kill_other_threads_np ();

        2.4.3 sudo make install


    2.5 安裝綜合例子mde-1.3.0

            ./configure && make && make install


---至此安裝完成---


三 配置qvfb,運行示例程序
    3.1 編輯/usr/local/etc/MiniGUI.cfg,將GAL和IAL引擎均改爲qvfb:
         25 [system]
         26 # GAL engine
         27 gal_engine=qvfb
         28
         29 # IAL engine
         30 ial_engine=qvfb
         31
         32 mdev=/dev/mouse
         33 mtype=IMPS2
         34
         35 [fbcon]
         36 defaultmode=1024x768-16bpp
         37
         38 [qvfb]
         39 defaultmode=640x480-16bpp
         40 display=0
         41

    3.2 運行"qvfb &"以後臺運行方式啓動虛擬幀緩衝區:
        linux:/home/work/minigui/mg-samples-1.3.1 # qvfb &
    3.3 菜單File->Configure,修改顯示模式與MiniGUI.cfg保持一致,即“640x480-16bpp”。

    否則在運行綜合示例俄羅斯方塊時,會出現以下提示:
        ./russia
        No available video device.
        NEWGAL: Does not find matched engine: qvfb.
        GDI: Can not get graphics engine information!
        InitGUI failure when using /usr/local/etc/MiniGUI.cfg as cfg file.

 

           qvfb config
    3.4 接着就可以運行示例程序:
        ~/download/minigui/minigui1.3.x/soures/mg-samples-1.3.1/src$ ./worldtime
        worldtime運行效果圖

 

    3.5 俄羅斯方塊綜合示例:mde-1.3.0/russia$  ./russia

 

 

四 參考資料
http://blog.csdn.net/binghuiliang/archive/2007/09/28/1805026.aspx
http://hi.baidu.com/aokikyon/blog/item/558a4a3e7f9a173b71cf6c53.html
http://oss.lzu.edu.cn/modules/lifetype/index.php?op=ViewArticle&articleId=131&blogId=6

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章