我正在尝试使用Adroid NDK构建一个依赖于iconv.h的lib
这是我到目前为止所做的:
我创建了一个这样的项目结构:
<my_prj>/jni
- Android.mk
- Application.mk
<my_prj>/jni/zxing
- all my lib source files requiring iconv.h
<my_prj>/external/libiconv-1.13.1
- libiconv sources downloaded from here http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
这是我的jni / Android.mk文件:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libiconv
LOCAL_CFLAGS := \
-Wno-multichar \
-D_ANDROID \
-DLIBDIR="c" \
-DBUILDING_LIBICONV \
-DIN_LIBRARY
LOCAL_SRC_FILES := \
../external/libiconv-1.13.1/lib/iconv.c \
../external/libiconv-1.13.1/libcharset/lib/localcharset.c \
../external/libiconv-1.13.1/lib/relocatable.c
LOCAL_C_INCLUDES += \
../external/libiconv-1.13.1/include \
../external/libiconv-1.13.1/libcharset \
../external/libiconv-1.13.1/libcharset/include
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libzxing
LOCAL_SRC_FILES := \
zxing/DecodeHints.cpp \
zxing/ReaderException.cpp \
...and many more...
LOCAL_C_INCLUDES += \
../external/libiconv-1.13.1/include
LOCAL_STATIC_LIBRARIES := libiconv
include $(BUILD_SHARED_LIBRARY)
根据这个帖子:http://groups.google.com/group/android-ndk/browse_thread/thread/012d679319e4ea6e
那么,我从/external/libiconv-1.13.1运行“./configure& amp ;& amp; make”,以便从iconv.h.in生成iconv.h
然后我从/ jni / zxing
运行ndk-build而/external/libiconv-1.13.1/libcharset/lib/localcharset.c给出了以下错误:
lib / localcharset.c:49:24:错误:langinfo.h:没有这样的文件或目录
我的猜测是我在做./configure&amp;&amp ;;时做错了什么。在libiconv上制作,因为包含“langinfo.h”的条件是libiconv-1.13.1 / config.h中定义的HAVE_LANGINFO_CODESET,后者又来自libiconv-1.13.1 / config.h.in ...
BTW,如果我强制HAVE_LANGINFO_CODESET为0,那么在编译localcharset.c时我有其他错误。
所以,我没有想法:( 有谁可以帮助我吗? 谢谢,卢卡。