首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法为iOS使用ssl构建curl

无法为iOS使用ssl构建curl
EN

Stack Overflow用户
提问于 2013-06-19 22:17:23
回答 1查看 4.1K关注 0票数 3

我正在尝试编译curl库,以便在我的Xcode项目中使用它。我遵循了http://www.creativealgorithms.com/blog/content/building-libcurl-ios-42中描述的步骤,并且curl库构建得很好。但是对于我来说,为armv7,armv6,i386架构编译curl库变得非常困难。

我已经为目标架构构建了openssl库,位于

代码语言:javascript
复制
/Users/me/Desktop/MyProject/libs/openssl/.

我正在尝试使用以下脚本配置curl库:

代码语言:javascript
复制
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -I/Users/me/Desktop/MyProject/libs/openssl/include/"
export LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -Wl,-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/me/Desktop/MyProject/libs/openssl/lib/"
./configure --with-ssl=/Users/me/Desktop/MyProject/libs/openssl  --host=arm-apple-darwin10

执行结果如下:

代码语言:javascript
复制
checking for CRYPTO_lock in -lcrypto... yes
checking for SSL_connect in -lssl... yes
checking openssl/x509.h usability... no
checking openssl/x509.h presence... no
checking for openssl/x509.h... no
checking openssl/rsa.h usability... no
checking openssl/rsa.h presence... no
checking for openssl/rsa.h... no
checking openssl/crypto.h usability... no
checking openssl/crypto.h presence... no
checking for openssl/crypto.h... no
checking openssl/pem.h usability... no
checking openssl/pem.h presence... no
checking for openssl/pem.h... no
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
checking openssl/err.h usability... no
checking openssl/err.h presence... no
checking for openssl/err.h... no
checking x509.h usability... no
checking x509.h presence... no
checking for x509.h... no
checking rsa.h usability... no
checking rsa.h presence... no
checking for rsa.h... no
checking crypto.h usability... no
checking crypto.h presence... no
checking for crypto.h... no
checking pem.h usability... no
checking pem.h presence... no
checking for pem.h... no
checking ssl.h usability... no
checking ssl.h presence... no
checking for ssl.h... no
checking err.h usability... no
checking err.h presence... no
checking for err.h... no
configure: error: OpenSSL libs and/or directories were not found where specified!

查看config.log文件,我看到上面列出的每个文件都有以下几行:

代码语言:javascript
复制
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -isystem /Users/me/Desktop/MyProject/libs/openssl/include/ -g0 -O2 -Wno-system-headers  -I/Users/me/Desktop/MyProject/libs/openssl/include -I/Users/me/Desktop/MyProject/libs/openssl/include/openssl conftest.c >&5
conftest.c:77:25: error: openssl/err.h: No such file or directory

你能给我一点提示吗,我哪里做错了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-20 04:24:54

基本上,配置脚本找不到openssl头文件。

你在/Users/me/Desktop/MyProject/libs/openssl/下面有什么?默认情况下,您应该有如下内容:

代码语言:javascript
复制
├── include
│   └── openssl
│       ├── ssl.h
│       ├── ...
├── lib
│   ├── libssl.1.0.0.dylib
│   ├── libssl.a
│   ├── ...

也就是说,你有什么理由不使用原生的Darwin SSL库(也就是Secure Transport)吗?从版本7.27.0开始,libcurl现在本机支持它,这特别方便。

您一定要参考这个curl-ios-build-scripts项目,它为libcurl提供了一个针对iOS/OSX并支持Darwin SSL的构建系统。

如果你需要继续使用openssl,你可以参考这个项目的前一个版本来支持它:参见commit 92f40bc

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17193665

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档