1. 程式人生 > >arm下交叉編譯glib-2.28.8

arm下交叉編譯glib-2.28.8

 

廢話不多, 直接上配置:
CC=arm-none-linux-gcc  ./configure --build=i686-linux --host=arm-none-linux \
        glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes \
        ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no glib_cv_monotonic_clock=yes
 
 注意如下幾點:      
 1. 在configure的時候, 會出現找不到glib-compile-schemas錯誤,
 解決辦法很簡單, 就是先用host編譯glib-2.28.8, 也就是直接:
 ./configure --prefix=<your glib2 install path>; make; make install
 編譯好以後, 設定環境變數PATH=<your glib2 install path>/bin:$PATH即可, 就可以找到glib-compile-schemas了。
 
  2. 在Make的如果還會出現如下錯誤:
gsimpleaction.c: In function 'g_simple_action_class_init':
gsimpleaction.c:329: error: 'g_cclosure_marshal_VOID__VARIANT' undeclared (first use in this function)
gsimpleaction.c:329: error: (Each undeclared identifier is reported only once

這個錯誤原因是因為glib-genmarshal版本過老引起的, 可以從gobject目錄下安裝該檔案到:<your glib2 install path>/bin即可解決,
一般如果做了第一步, 這步就不會出錯了,因為第一步安裝的時候會把這個檔案安裝好了。

3. 如果在編譯gio/tests的時候出現如下錯誤:
/usr/bin/msgfmt -o test.mo ./de.po; \
        /bin/mkdir -p de/LC_MESSAGES; \
        cp -f test.mo de/LC_MESSAGES
./de.po:15: keyword "msgctxt" unknown
./de.po:15:8: parse error
/usr/bin/msgfmt: found 2 fatal errors
cp: cannot stat `test.mo': No such file or directory

這個問題就是因為/usr/bin/msgfmt版本過老引起的, 請下載的gettext-0.17或者更新版本, 在host下編譯安裝後,
設定環境變數 PATH=<your gettext install path>/bin:$PATH, 同時還要在configure的時候指定ac_cv_path_MSGFMT=msgfmt,
否則設定了環境變數也沒用, 編譯的時候還是會強制使用/usr/bin/msgfmt

做了以上3點以後, glib-2.28.8就能大功編成了。