libiconv build in android

以编译libiconv-1.13.1为例
1,安装 NDK  设置安装NDK环境变量 ANDROID_NDK_ROOT (自行定义)
2,获取源码 
    $ mkdir libiconv
    $ cd libiconv
    $ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

3,解压,
    $ tar zxvf libiconv-1.13.1.tar.gz
4,把liniconv-1.13.1重命名为jni
    $ mv libiconv-1.13.1 jni
5,创建Android.mk文件
    $ cd jni
    $ vim Android.mk
复制一下内容到Android.mk中保存并且退出
LOCAL_PATH:= $(call my-dir)
#libiconv.so
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)

6,配置    生成linux环境下的config.h文件
    $ ./configure

7,make
    $ make

8,执行编译
     $ $ANDROID_NDK_ROOT/ndk-build V=1
8.1、编译时提示:

libiconv-1.14/jni/libcharset/lib/localcharset.c:51:24: error: langinfo.h: No such file or directory

解决方法:

修改目录文件libcharset/config.h的宏定义,禁止该宏定义:

/* Define if you haveand nl_langinfo(CODESET). */

#define HAVE_LANGINFO_CODESET 0

8.2、提示错误:

报“c undeclaired”错误

解决方法:

修改文件/libcharset/lib/localcharset.c中函数get_charset_aliases (void)

搜索:int c;

把该变量定义放到该函数的开始处

8.3 继续执行编译
     $ $ANDROID_NDK_ROOT/ndk-build V=1

此时编译完成
在目录jni/libs/armeabi-v7a下会有libiconv.so库文件
时间: 2024-10-17 11:58:20

libiconv build in android的相关文章

cocos2dx 编译错误 BUILD FAILEDG:\android\SDK\android-sdk-windows\tools\ant\build.xml:645: The following

BUILD FAILEDG:\android\SDK\android-sdk-windows\tools\ant\build.xml:645: The following erroroccurred while executing this line:G:\android\SDK\android-sdk-windows\tools\ant\build.xml:683: null returned: 1 解决办法: rd bin /S /Q cocos2dx 编译错误 BUILD FAILEDG:

ionic build --release android

ionic bulid android keytool -genkey -v -keystore demo.keystore -alias demo.keystore -keyalg RSA -validity 20000 jarsigner -verbose -keystore /yourpath/demo.keystore -signedjar demo_signed.apk demo.apk demo.keystore zipalign -v 4 your_project_name-una

how to build a android environment in ubuntu 15.10

As we know, the android development environment need four part: JDK SDK IDE ADT. Problems: there are JDK versions from different companise. Previous, I run the command: $sudo apt-get install openjdk-7-jdk to install openjdk released by ubuntu ,and th

google官方提供的编译android源码的环境初始化,Initializing a Build Environment

原文网址:http://source.android.com/source/initializing.html Initializing a Build Environment IN THIS DOCUMENT Choosing a Branch Setting up a Linux build environment Installing the JDK Installing required packages (Ubuntu 14.04) Installing required packag

Android获取Build和内存,分辨率等信息

package com.zms.getdeviceinfo; import android.app.ActivityManager; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.support.v7.app.ActionBarActivity; import

Android Build.VERSION.SDK_INT兼容介绍

尽管Android向下兼容不好,但是一个程序还是可以在多个平台上跑的.向下兼容不好,接口改变,新的平台上不能用旧的API,旧的平台更不可能用新的API,不等于一个平台需要一个APK.可以在高SDK上开发,并在程序中作版本判断,低版本运行环境使用旧的API. 例如要开发一个显示通话记录的程序,需要兼容1.6~2.2,我们知道不同的平台SDK level不同,1.5是3,1.6是4,2.2是8.对应的可以使用android.os.Build进行判断.源代码如下: Java代码   if(Build.

android.os.Build常用硬件属性常量

开发的时候,我们有时到用到Andorid手机的一些硬件参数,主要用到的是android.os.Build这个类,其常用的属性常量有: Build.MODEL /**设备名*/ Build.VERSION.SDK/**sdk版本号*/ Build.BOARD /**主板信息 */ Build.BRAND /**android设备厂商*/ Build.DEVICE /**设备参数*/ Build.DISPLAY /**显示屏参数*/ Build.FINGERPRINT /**硬件名称*/ Build

Android Build System Ultimate Guide

Android Build System Ultimate Guide April 8,2013 Lately, Android Open Source Project has gone through various changes. For instance, Since JB Google decided to replace bluez bluetooth stack with an open source stack implemented by Broadcom claiming t

Android Initializing a Build Environment

from://https://source.android.com/source/initializing.html#next-download-the-source Initializing a Build Environment IN THIS DOCUMENT Choosing a Branch Setting up a Linux build environment Installing the JDK Installing required packages (Ubuntu 12.04