NDK and iconv.h dependency
I'm trying to build a lib with Adroid NDK which depends on iconv.h
This is what I did so far:
I created a project structure like this:
<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
Here is my jni/Android.mk file:
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开发者_Go百科.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)
according to this thread: http://groups.google.com/group/android-ndk/browse_thread/thread/012d679319e4ea6e
So, then I run "./configure && make" from /external/libiconv-1.13.1 in order to generate iconv.h from iconv.h.in
Then I run ndk-build from /jni/zxing
- All my zxing now compiles without a problem.
- /external/libiconv-1.13.1/lib/iconv.h compiles as well
Whereas /external/libiconv-1.13.1/libcharset/lib/localcharset.c gives me the following error:
lib/localcharset.c:49:24: error: langinfo.h: No such file or directory
My guess is that I did something wrong while doing ./configure && make on libiconv as the inclusion of "langinfo.h" is conditioned by HAVE_LANGINFO_CODESET defined in libiconv-1.13.1/config.h which in turn comes from libiconv-1.13.1/config.h.in...
BTW, if I force HAVE_LANGINFO_CODESET to 0, then I have others error while compiling localcharset.c
So, I'm out of ideas :( Can some one help me please? Thanks, Luca.
精彩评论