ndk编译libiconv库

Linux环境

下载地址:http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar zxvf libiconv-1.16.1.tar.gz
mv libiconv-1.16.1 jni

在根目录
新建Android.mk

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libiconv
LOCAL_CFLAGS := \
    -Wno-multichar \
    -DANDROID \
    -DLIBDIR="c" \
    -DBUILDING_LIBICONV \
    -DIN_LIBRARY
 
LOCAL_SRC_FILES := \
    libcharset/lib/localcharset.c \
    lib/iconv.c \
    lib/relocatable.c
 
LOCAL_C_INCLUDES += \
                    $(LOCAL_PATH)/include \
                    $(LOCAL_PATH)/libcharset \
                    $(LOCAL_PATH)/lib \
                    $(LOCAL_PATH)/libcharset/include \
                    $(LOCAL_PATH)/srclib
include $(BUILD_SHARED_LIBRARY)

新建Application.mk

APP_STL := c++_static
APP_ABI := armeabi-v7a arm64-v8a
APP_PLATFORM := android-19
ndk-build NDK_PROJECT_PATH=$(pwd) NDK_APPLICATION_MK=Application.mk APP_BUILD_SCRIPT=Android.mk NDK_DEBUG=0

遇到编译错误如下:

/home/work/android/libiconv-1.16/obj/local/arm64-v8a/objs/iconv/libcharset/lib/localcharset.o: In function `locale_charset':
/home/work/android/libiconv-1.16/jni/libcharset/lib/localcharset.c:696: undefined reference to `nl_langinfo'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/work/android/libiconv-1.16/obj/local/arm64-v8a/libiconv.so] Error 1

修改configure文件

HAVE_LANGINFO_CODESET的值为0,重新编译即可
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值