ndk编译iconv

需要注意的是libiconv的根目录名要改为jni,才能正常编译,否则提示NDK_PROJECT_PATH未定义,然后停止编译

iconv  (转自 http://www.huyinqiu.com/dokuwiki/android/ndk%E7%BC%96%E8%AF%91iconv)

下载地址:libiconv-1.14

环境配置:

  1. $ NDK=/path/to/ndk
    $ export PATH=$PATH:$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/
    $ ./configure --host=arm-eabi CC=arm-linux-androideabi-gcc CPPFLAGS="-I$NDK/platforms/android-9/arch-arm/usr/include/" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$NDK/platforms/android-9/arch-arm/usr/lib/ -L$NDK/platforms/android-9/arch-arm/usr/lib/" LIBS="-lc"

Android.mk

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

你可能感兴趣的:(ndk编译iconv)