知是行的主意,行是知的功夫。这篇文章主要讲述(OK) 编译xerces-c-3.1.2(静态库)—CentOS 7— android-ndk相关的知识,希望能为你提供帮助。
编译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
解决方法如下:
【(OK) 编译xerces-c-3.1.2(静态库)—CentOS 7— android-ndk】//编译静态库
[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 (静态库)
推荐阅读
- "三关" + "一关"
- 欢迎进入 Windows8 的世界!
- 和学生们的合影-20160522-chenqingy-zhaoq
- (OK) 编译xerces-c-3.1.2(动态库)—CentOS 7— android-ndk
- 开发 Windows 8 应用 - 0 - windows 8 开发资源
- DRT移植各种成熟稳定的C工具包到DELPHI
- 线上排除问题流程
- navicat给datetime设置默认值
- Ingress 大全20220426