使用的libxml为Android [英] Using libxml for Android

查看:153
本文介绍了使用的libxml为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序工作正常的Mac和Windows平台,目前针对Android和iOS的, 应用程序使用libxml的XML数据的分析,我的问题是?

We have an application working fine for Mac and Windows platform, now targeting for Android and iOS, Application using libxml for parsing of XML data, and my question is ?

1 - 我需要建立的libxml为Android平台或它已经存在作为NDK的一部分吗?

1 -- Do i need to build libxml for Android platform or its already there as a part of NDK ?

如果有必要建立任何指针如何开始?

if need to build any pointers how to start ?

推荐答案

您有两种选择:

写的Andr​​oid.mk,可以成功地构建libxml的,依靠的是在你的主Android.mk的结果。您可以尝试在你的Mac本身建立的libxml(使用配置脚本并进行),以获得的文件需要建立什么样的想法,如果有任何特殊标志需要传递。

Write an Android.mk that can successfully build libxml, and depend on the result of that in your main Android.mk. You can try to build libxml natively (using the configure script and make) on your Mac to get an idea of what files need to be built, and if any special flags need to be passed.

或者,使用的libxml的配置脚本,并使用NDK的工具链为Android打造的libxml。你必须做一些事情是这样的:

Or, Use libxml's configure script and build libxml for Android using the NDK's toolchain. You'll have to do something like this:

NDK_ROOT=/path/to/ndk
API_LEVEL=YOUR_API_LEVEL
SYSROOT=$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm

export CC="$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/Darwin-x86/bin/arm-linux-androideabi-gcc"
export CFLAGS="--sysroot=$SYSROOT"
export LDFLAGS="--sysroot=$SYSROOT"

./configure --host=arm-linux-gnueabi --enable-static --disable-shared
make libxml2.la

从技术上主机三联供Android是 ARM-Linux的androideabi ,但大多数配置脚本不承认它,并为我们的目的, -gnueabi 足够接近。

Technically the host triplet for Android is arm-linux-androideabi, but most configure scripts don't recognize it, and for our purposes here, -gnueabi is close enough.

我结束了提示使libxml2.la 而不仅仅是因为测试没有建立正常。由此产生的库将结束在的.libs / 文件夹。

I ended up suggesting make libxml2.la rather than just make because the tests weren't building properly. The resulting library will end up in the .libs/ folder.

第二种方法可能会更容易一些,但如果你打算建立自己的应用程序的多个架构(ARM,的ARMv7-A,甚至x86和MIPS),编写自己的Andr​​oid.mk将节省您的时间在漫长运行。

The second method might be a little easier, but if you intend to build your app for multiple architectures (arm, armv7-a, maybe even x86 and mips), writing your own Android.mk will save you time in the long run.

这篇关于使用的libxml为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆