zoukankan      html  css  js  c++  java
  • 编译libcurl iOS

    首先设定环境变量:

    真机:

    export IPHONEOS_DEPLOYMENT_TARGET="4.3"
    export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2"
    export CFLAGS="-arch armv7 -arch armv7s -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"
    export LDFLAGS="-arch armv7 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"
    ./configure --disable-shared --enable-static --disable-dependency-tracking --host="armv7-apple-darwin"

    模拟器:

    export IPHONEOS_DEPLOYMENT_TARGET="4.3"
    export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2"
    export CFLAGS="-arch i386 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk"
    export CPPFLAGS="-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IPHONEOS_DEPLOYMENT_TARGET%%.*}0000"
    export LDFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk"
    ./configure --disable-shared --enable-static --host="i386-apple-darwin" 

    编译:
    a)  打开Xcode选择: File->New Project->iOS->Library->Cocoa Touch Static Library
    添加文件:Add->Existing Files (选择curl中 "src"文件夹),Add->Existing Files (选择curl中 "lib"文件夹)
    
删除文件:从项目中删除 "src/macos" 文件夹(Delete->Delete references),并且去掉Makefile and Makefile.inc(共四个,src和lib中各两个)的”target”标志。(注意是在project中操作,不是在target中操作)
     
    b)  打开“build”选项,查找OTHER_C_FLAGS设置下面信息
    -DHAVE_CONFIG_H -I/ca/dev/code/lib/curl/curl-latest/include -I/ca/dev/code/lib/curl/curl-latest/lib
    
说明: /ca/dev/code/lib/curl/curl-latest就是刚才解压curl源代码的路径,在本机中是
    -DHAVE_CONFIG_H -I/libcurl/curl/include -I/libcurl/curl/include/lib

    然后直接利用Xcode编译就可以得到静态库文件。

  • 相关阅读:
    linux环境下zookeeper下载安装
    vue父组件传值给子组件
    nginx配置负载均衡
    centos安装与配置keepalived+nginx高可用
    centos7安装jdk1.8
    linux系统centos7安装最新版本nginx
    vue项目简单菜单排序
    原生js复制粘贴上传图片前后台代码,兼容firebox,chrome, ie11,亲测有效
    mysql字符集与比较规则
    EL和JSTL表达式的使用
  • 原文地址:https://www.cnblogs.com/hbf369/p/3049496.html
Copyright © 2011-2022 走看看