最新版的libiconv 1.14目前还不支持64位系统,只能编译出32位库。

libiconv 1.14下载地址:

http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz


libiconv介绍:

http://www.gnu.org/software/libiconv/


linux系统编译安装方法:

$ ./configure --prefix=/usr/local
$ make
$ make install
执行make会报错:

./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 ^
make[2]: *** [progname.o] 错误 1
make[2]:正在离开目录 `/home/min/projects/libiconv-1.14/srclib'
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/home/min/projects/libiconv-1.14/srclib'
make: *** [all] 错误 2

 修改方法参考:解决编译libiconv时报错:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

修改后make可以通过,但执行make install还是会报错:

/usr/bin/install: cannot create regular file '/usr/local/lib/libcharset.so.1.0.0': Permission denied
make[2]: *** [install] 错误 1
make[2]:正在离开目录 `/home/min/projects/libiconv-1.14/libcharset/lib'
make[1]: *** [install] 错误 2
make[1]:正在离开目录 `/home/min/projects/libiconv-1.14/libcharset'
make: *** [install] 错误 2

提示权限拒绝,需要用管理员权限安装,先执行su或者直接用sudo make install安装。

--------------------------------

Android NDK编译iconv,参考:ndk编译iconv

编译出来的是32位的,64的无法编译成功。

NDK目录下的编译mk文件也只是编译了32位库,Android.mk文件位于:android-ndk-r10e/sources/android/support

内容如下,iconv.c文件只再32位库中编译

LOCAL_PATH := $(call my-dir)

android_support_c_includes := $(LOCAL_PATH)/include

ifneq ($(filter $(NDK_KNOWN_DEVICE_ABI64S),$(TARGET_ARCH_ABI)),)
# 64-bit ABIs
android_support_sources := \
    src/musl-locale/catclose.c \
    src/musl-locale/catgets.c \
    src/musl-locale/catopen.c

else
# 32-bit ABIs

android_support_sources := \
    src/libdl_support.c \
    src/locale_support.c \
    src/math_support.c \
    src/stdlib_support.c \
    src/wchar_support.c \
    src/locale/duplocale.c \
    src/locale/freelocale.c \
    src/locale/localeconv.c \
    src/locale/newlocale.c \
    src/locale/uselocale.c \
    src/stdio/stdio_impl.c \
    src/stdio/strtod.c \
    src/stdio/vfprintf.c \
    src/stdio/vfwprintf.c \
    src/msun/e_log2.c \
    src/msun/e_log2f.c \
    src/msun/s_nan.c \
    src/musl-ctype/iswalnum.c \
    src/musl-ctype/iswalpha.c \
    src/musl-ctype/iswblank.c \
    src/musl-ctype/iswcntrl.c \
    src/musl-ctype/iswctype.c \
    src/musl-ctype/iswdigit.c \
    src/musl-ctype/iswgraph.c \
    src/musl-ctype/iswlower.c \
    src/musl-ctype/iswprint.c \
    src/musl-ctype/iswpunct.c \
    src/musl-ctype/iswspace.c \
    src/musl-ctype/iswupper.c \
    src/musl-ctype/iswxdigit.c \
    src/musl-ctype/towctrans.c \
    src/musl-ctype/wcswidth.c \
    src/musl-ctype/wctrans.c \
    src/musl-ctype/wcwidth.c \
    src/musl-locale/catclose.c \
    src/musl-locale/catgets.c \
    src/musl-locale/catopen.c \
    src/musl-locale/iconv.c \
    src/musl-locale/intl.c \