Glib交叉编译:g__cancellable_lock undeclared!&HEADER/C_IN undeclared!&undefined reference to "localeconv"

本文详细记录了在Android环境下交叉编译Glib时遇到的错误,包括`g__cancellable_lock`未声明、`HEADER/C_IN`未声明以及`localeconv`未引用的问题。通过修改配置、补丁应用等方式,成功解决这些问题,以便于后续的Android NDK开发。
摘要由CSDN通过智能技术生成

编译过程遇到了诸多问题,记录下来以便后续参考:


/libtool: eval: line 964: syntax error near unexpected token `|’

http://blog.csdn.net/dadoneo/article/details/8155044


'g__cancellable_lock' undeclared (first use in this function):

https://mail.gnome.org/archives/commits-list/2011-September/msg07202.html

http://gtk.awaysoft.com/read-318-1.html


'HEADER' undeclare! (first use in this function)

或 

C_IN undeclared!(first use in this function):

Full glib porting onto Android:  https://mail.gnome.org/archives/gtk-devel-list/2011-March/msg00096.html (Thanks to Shuxiang Lim)

============================================================================================

下面将原文整理贴出:


Full glib porting onto Android


  • From: Shuxiang Lim <shohyanglim gmail com>
  • To: gtk-devel-list gnome org
  • Subject: Full glib porting onto Android
  • Date: Wed, 23 Mar 2011 17:37:56 +0800

Hello glib/gtk guys!
   Recently I've been trying on a Android porting work for a project which has which uses glibs-2.22+ including libglib/libgio/libgthread/libgmodule. Other than using the  
already-on android/bluetooth/glib with only libglib-2.20 built, I have managed to hack by my own for a full glib porting.
   I hope such work will be enrolled into master-glib.
   N.B, this hacking is based on glib-2.28.1 and is still raw and unstable ,be care of use!
   Any correcting and improving is appreciated!
   This README.android has all the instructions and patches of my hacking:
======README.android=============
Shohyang Lim < shohyanglim@gmail.com >

Note that this document is not really maintained in a serious  fashion. Lots of information here might be misleading or outdated. You
have been warned.

This FULL Android porting is hacked by Shohyang Lim in the porting of one  project which uses glibs-2.28 including libglib/libgio/libgthread/libgmodule  other than the already-on android/bluetooth/glib with only libglib-2.20 built.

N.B, this hacking is based on glib-2.28.1 and is still raw and unstable,be care of use!
Any correcting and improving is appreciated!

General
=======
In a POSIXer's view, Android system is CRIPPLED: thus the porting of existing  libraries onto it is TOUGH. Please have this in mind.
The basic obstacles in porting:
1.Android does not have or offers less/no access in its  rimmed bionic C lib :
1>No SYS V shm.h/sem.h
2>Not standard pwd.h and getpwuid_r(),etc. methods
3>No locale.h 
4>Not standard IP/IPV6 headers/support such as arpa/*.h ones
5>Not standard pthread.                             
6>No iconv  funcs.
7>No intl/gettext funcs 
8>No i18n support and wchar_t.
...


2.Cross compiling troubles such as the typecast of pointers may be the sin of SIGBUS in ARM,ARM-THUMB troubles,...etc.
Therefore the hacking is mainly focusing on such missings. I suppose you are familiar with ARM cross compiling and Android NDK development.



Building all glibs prerequisites
=======================================

1>Android souce build system or Android NDK
for me, I use the android NDK r4c for Android 2.2 provided by Mozzila 
which has nearly full C++ support:
http://ftp.mozilla.org/pub/mozilla.org/mobile/source/android-ndk-r4c-0moz3.tar.bz2
and I have modified Andrew Ross's agcc to extract and use the toolchain from this NDK:
http://blog.csdn.net/rozenix/archive/2011/02/28/6212994.aspx

2> Cross compile the dependencies of glib2.28.1 onto Android in this order:
1)libiconv-1.13.1.tar.gz:
configured by:
CC=agcc CXX=agcc LD=arm-eabi-ld RANLIB=arm-eabi-ranlib \
PKG_CONFIG_LIBDIR=/data/local/lib/pkgconfig:/data/local/share/pkgconfig/ \
./configure \
--prefix=/data/local \
--host=arm-eabi-linux \
--enable-shared \
make; 

make install;

2)gettext-0.18.1.1.tar.gz
configured by:
CC=agcc CPPFLAGS="-I/data/local/include" LDFLAGS="-L/data/local/lib" \
CXX=agcc LD=arm-eabi-ld RANLIB=arm-eabi-ranlib \
PKG_CONFIG_LIBDIR=/data/local/lib/pkgconfig:/data/local/share/pkgconfig/ \
./configure \
--prefix=/data/local \
--host=arm-eabi-linux \
--enable-shared \
--cache-file=arm.cache \
--without-included-regex \
--disable-java --disable-openmp --without-libiconv-prefix \
--without-libintl-prefix --without-libglib-2.0-prefix \
--without-libcroco-0.6-prefix --with-included-libxml \
--without-libncurses-prefix --without-libtermcap-prefix \
--without-libcurses-prefix --without-libexpat-prefix --without-emacs


Make,But the build of gettext may not fully succeed,never mind, I need only libintl.so so just make install.


Cross compile glib-2.28.1.tar.gz
=======================================
1. do patching with the glib-android.patch attached in this file

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值