سؤال

I'm trying to compile curl library to use it in my Xcode project. I followed steps described in http://www.creativealgorithms.com/blog/content/building-libcurl-ios-42, and curl library builds just fine. But it became really hard for me to compile curl library for armv7, armv6, i386 architectures with ssl enabled.

I have openssl library already built for target architectures, and located at

/Users/me/Desktop/MyProject/libs/openssl/.

I'm trying to configure curl library using following script:

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

The result of executing is following:

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!

Looking to the config.log file, I see following lines for each of file listed above:

/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

Could you please give me a clue, what I am doing wrong?

هل كانت مفيدة؟

المحلول

Basically the configure script cannot find the openssl header files.

What do you have under /Users/me/Desktop/MyProject/libs/openssl/? By default you should have something like this:

├── include
│   └── openssl
│       ├── ssl.h
│       ├── ...
├── lib
│   ├── libssl.1.0.0.dylib
│   ├── libssl.a
│   ├── ...

That being said, is there any reason why you do not use the native Darwin SSL library (a.k.a Secure Transport)? As of version 7.27.0, libcurl now supports it natively which is particularly convenient.

You should definitely refer to this curl-ios-build-scripts project that provides a build system for libcurl that targets iOS/OSX and supports Darwin SSL.

If you need to stick with openssl, you can refer to the former version of this project that used to support it: see commit 92f40bc.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top