Search code examples
androidglib

How to compile glib on android


Does anyone have a set of .mk files (and anything else needed) to compile glib on android? The NEWS file implies that at least version 2.41.5 is supported (there is a commit message about not using issetugid() on android.)

I have successfully compiled https://github.com/ieei/glib but this is only 2.26 and I thought I'd check before re-inventing the wheel.

Thanks,


Solution

  • I made this work using the standalone tool chain and the following setup:

    git clone https://git.gnome.org/browse/glib
    cd glib
    NOCONFIGURE=1 ./autogen.sh
    
    cat << EOF > android.cache
    glib_cv_stack_grows=no
    glib_cv_uscore=no
    ac_cv_func_posix_getpwuid_r=no
    ac_cv_func_posix_getgrgid_r=no
    EOF
    
    CPPFLAGS=/path/to/standalone/include LDFLAGS=/path/to/standalone/lib ./configure \
    --prefix=/path/to/standalone --bindir=$AS_BIN --build=i686-pc-linux-gnu --host=arm-linux-androideabi \
    --cache-file=android.cache