分类: LINUX
2011-06-28 11:02:29
This is my instructions and patches for porting snappy/libspicec-glib.so extracted from spicec-gtk-0.5 onto Android-ARM.
It's still nascent and raw though, more hacking is needed!
These are my steps, suppose you're familiar with cross compiling.
1.I use the NDK r4c and agcc built and setup as previous blogs
2. Then I cross compile 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 \
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
But the build of gettext will not fully succeed,never mind, I need only libintl.so so just make install.
3) glib-2.28.1.tar.gz
1st, do patching with my attached file in the blog:
http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx
#patch -p0 <
glib-android.patch
2nd, write this into the cache file arm.cache:
#cat > arm.cache
ac_cv_android_arm=yes
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no
ctrl-D
3rd,make sure you have the tools such as
glib-genmarshaller of right vision in your host machine(you may need to
first install glib on your host machine)
4th, autoconf; then configured the same as libiconv.
5td, make;make install
3. Also I have to port pixman and openssl and jpeg onto android.
1)pixman-0.20.0,jpeg-6b: config. make;make install same as libiconv
(you may should change
/* TLS */
#if defined(PIXMAN_NO_TLS)
into
/* TLS */
#define PIXMAN_NO_TLS
#if defined(PIXMAN_NO_TLS)
in /pixman/piman-compiler.c)
and add this onto pixman/pixman-cpu.c:
typedef struct
{
uint32_t a_type; /* Entry type */
union
{
uint32_t a_val; /* Integer value */
} a_un;
} elf_aux_entry;
typedef elf_aux_entry Elf32_auxv_t ;
)
2)openssl-1.0.0: config by:
./Configure linux-generic32 no-asm shared --prefix=/data/local
then modify the Makefile:
gcc-->agcc
change ar/nm/ranlib to their arm-eabi- peers,
set CFLAGS as
CFLAG= -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -UDSO_DLFCN -UHAVE_DLFCN_H -UTERMIO -O3 -fomit-frame-pointer -Wall
etc.
make;make install
4. for snappy and libspicec-glib.so
1).tar xf spice-gtk-0.5.tar.gz
2).#patch -p0 < snappy-android.patch ;
patch file is in the blog:
http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx
3).ensure to succeed in the normal ./configure and make on the current host machine to generate config.h and some other files.
#CC=gcc \
./configure \
--prefix=/usr/local/mylocal \
--enable-shared \
--cache-file=arm.cache \
--with-coroutine=gthread
#make
4).#cd gtk/
5). you make use or reference my attached file :amakfile
in:
http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx
#make clean -f amakefile
#make -f amakefile
6) put the lib*.so files and exec. file snappy onto android device and run.
#LD_LIBRARY_PATH=/system/lib:/data/local/lib ./snappy -h 192.168.1.31 -p 5900 -o ahoo.ppm
This the run-log:
http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx
This is the snapped image:
That's it! Mail me if you've got any problems!
Happy hacking!