ios iconv编译

1.下载libiconv库文件

https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

2.编译脚本

(1)建立编译文件夹build

(2)编译脚本build_ios.sh

ROOT_DIR=/Users/hello/Desktop/libiconv-1.15/build
###################################################
# iOS SDK location.

###################################################

IOS_SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
SIM_SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
DEVROOT=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/
export CC=${DEVROOT}/usr/bin/clang
export CXX=${DEVROOT}/usr/bin/clang++
export PATH=${DEVROOT}/usr/bin:$PATH
export MACOSX_DEPLOYMENT_TARGET=10.13

function build_ for ()

{

make clean

BUILD_FOR=$1
HOST=$2
if [ "$BUILD_FOR" == "x86_64" ] || [ "$BUILD_FOR" == "i386" ]
then
SDKROOT=$SIM_SDKROOT
else
SDKROOT=$IOS_SDKROOT
fi
###################################################
# Build $1 version,
###################################################
export ARCH_TARGET= "-arch ${BUILD_FOR} -isysroot $SDKROOT"
export CFLAGS= "${ARCH_TARGET} -g -O3 -fembed-bitcode -miphoneos-version-min=7.0"
export CXXFLAGS= "${CFLAGS} -std=c++11 -stdlib=libc++"
export LDFLAGS= "${ARCH_TARGET} -stdlib=libc++ -lc++ -lc++abi"
../../configure --prefix=${ROOT_DIR}/bin/${BUILD_FOR} \
--with-sysroot=$SDKROOT \
--enable-shared \
--disable-static \
--host=${HOST} || exit 1
make || exit 2    
make install || exit 3
}
#build_for i386 i386-apple-darwin
#build_for x86_64 x86_64-apple-darwin
#build_for armv7 armv7-apple-darwin
#build_for armv7s armv7s-apple-darwin
build_ for arm64 arm-apple-darwin


(3)在真机上使用时,需要使用install_name_tool

        install_name_tool -id 改变自身的链接位置

        install_name_tool -change 改变依赖库链接位置

 (4) 库文件下载地址

        https://download.youkuaiyun.com/download/qiushanrenjia/10400652

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值