• 编译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编译就可以得到静态库文件。

  • 相关阅读:
    python面向对象--类的刨析
    python装饰器中高级用法(函数加参)
    运用python中装饰器方法来解决工作中为原有代码添加功能问题
    python学习之路---基础概念扩展:变量,表达式,算法,语句,函数,模块,字符串
    理解cpu过高的逻辑思维与分析方法
    mysql 二进制安装
    K8s高可用集群部署(四)
    K8S集群管理+docker私有仓库harbor搭建(三)
    Python之内置函数的一些使用
    Python之处理svg文件中的style属性
  • 原文地址:https://www.cnblogs.com/hbf369/p/3049496.html
Copyright © 2020-2023  润新知