Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6660683
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: C/C++

2015-09-21 11:39:57

编译xerces-c (静态库)—CentOS 7— android-ndk

[root@localhost xerces-c-3.1.2]# pwd
/opt/cBPM-android/xerces-c-3.1.2
[root@localhost xerces-c-3.1.2]# make clean

export XERCES="/opt/cBPM-android/xerces-c-3.1.2/"
export NDK_ROOT="/opt/android-on-linux/android-ndk-r10d"
export TOOLCHAIN="$NDK_ROOT/platforms/android-21/arch-arm"
export ARMVERSION=7
export SYSROOT="$TOOLCHAIN"
export CFLAGS="--pipe --sysroot=$SYSROOT -I$NDK_ROOT/sources/cxx-stl/stlport/stlport -I$NDK_ROOT/platforms/android-21/arch-arm/usr/include -I$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/include -I$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed -I$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include -I$XERCES/src/xercesc/xinclude -I$XERCES/tests/src/xinclude -I$XERCES/tests/src/xinclude/tests/xinclude"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L$SYSROOT/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/armeabi-v7a -L/opt/cBPM-android/criteria-lin/lib -lstlport_static -lgcc -lc -liconv"
export CPATH="$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/arm-linux-androideabi-cpp"
export CXX="$CPATH/arm-linux-androideabi-g++"
export CC="$CPATH/arm-linux-androideabi-gcc"
export LD="$CPATH/arm-linux-androideabi-ld"
export AR="$CPATH/arm-linux-androideabi-ar"


[root@localhost xerces-c-3.1.2]# ac_cv_func_iconv_open=yes ac_cv_func_iconv_close=yes ac_cv_func_mblen=yes ac_cv_func_wcstombs=yes ac_cv_func_mbstowcs=yes ac_cv_func_iconv=yes ./configure --host="arm-linux-eabi" --enable-static --disable-shared --enable-transcoder-iconv

[root@localhost xerces-c-3.1.2]# make -j5
[root@localhost xerces-c-3.1.2]# cp ./src/.libs/libxerces-c.a /opt/cBPM-android/criteria-lin/lib


-----------------------

/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/include
/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/stlport/stlport
/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/gabi++/include
/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include

/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib
/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/stlport/libs/armeabi-v7a
/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi

-----------------------

// -nostdlib -Xlinker -R$SYSROOT/usr/lib $SYSROOT/usr/lib/crtbegin_static.o $SYSROOT/usr/lib/crtend_android.o
// ls /opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/stlport/libs/armeabi-v7a
// libstlport_shared.so  libstlport.so  libstlport_static.a  thumb

[root@localhost xerces-c-3.1.2]# ./configure --host=arm-linux-androideabi --enable-static --disable-shared --enable-transcoder-iconv

错误:configure: error: Xerces cannot function without a transcoder

解决方法如下:
//编译静态库
[root@localhost xerces-c-3.1.2]# ac_cv_func_iconv_open=yes ac_cv_func_iconv_close=yes ac_cv_func_mblen=yes ac_cv_func_wcstombs=yes ac_cv_func_mbstowcs=yes ac_cv_func_iconv=yes ./configure --host=arm-linux-androideabi --enable-static --disable-shared --enable-transcoder-iconv
[root@localhost xerces-c-3.1.2]# make -j5


错误:
xercesc/util/PlatformUtils.cpp:713:4: error: #error No timing support is configured for this platform. You must configure it.
解决方法,在 config.h  加下面一行
#define HAVE_GETTIMEOFDAY 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1

//成功编译静态库
[root@localhost xerces-c-3.1.2]# find . -name libxerces-c.a
./src/.libs/libxerces-c.a

//复制库文件(arm)
[root@localhost xerces-c-3.1.2]# cp ./src/.libs/libxerces-c.a /opt/cBPM-android/criteria-lin/lib


+++++++++++++编译Criteria.Tools.Executor错误
xercesc/util/XMLAbstractDoubleFloat.cpp:430: error: undefined reference to 'localeconv'

解决方法:+++++++++++++ 在上面基础上,编译xerces-c (静态库)
[root@localhost xerces-c-3.1.2]# pwd
/opt/cBPM-android/xerces-c-3.1.2
[root@localhost xerces-c-3.1.2]# find . -name XMLAbstractDoubleFloat.cpp
./src/xercesc/util/XMLAbstractDoubleFloat.cpp
[root@localhost xerces-c-3.1.2]# gedit ./src/xercesc/util/XMLAbstractDoubleFloat.cpp

//    lconv* lc = localeconv();
//    char delimiter = *lc->decimal_point;

    char delimiter = '.';        //把localeconv()调用给绕过去了

保存,重新编译xerces-c (静态库)

阅读(1715) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~