我正在尝试编译curl库,以便在我的Xcode项目中使用它。我遵循了http://www.creativealgorithms.com/blog/content/building-libcurl-ios-42中描述的步骤,并且curl库构建得很好。但是对于我来说,为armv7,armv6,i386架构编译curl库变得非常困难。
我已经为目标架构构建了openssl库,位于
/Users/me/Desktop/MyProject/libs/openssl/.我正在尝试使用以下脚本配置curl库:
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执行结果如下:
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文件,我看到上面列出的每个文件都有以下几行:
/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你能给我一点提示吗,我哪里做错了?
发布于 2013-06-20 04:24:54
基本上,配置脚本找不到openssl头文件。
你在/Users/me/Desktop/MyProject/libs/openssl/下面有什么?默认情况下,您应该有如下内容:
├── 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。
https://stackoverflow.com/questions/17193665
复制相似问题