1

我尝试使用此http://x2on.de/2010/12/16/tutorial-script-for-building-openssl-for-ios-iphoneipad/编译 openssl 库,但得到了

In file included from cryptlib.c:117:
cryptlib.h:62:20: error: stdlib.h: No such file or directory
cryptlib.h:63:20: error: string.h: No such file or directory
In file included from cryptlib.h:65,
                 from cryptlib.c:117:
../e_os.h:444:30: error: unistd.h: No such file or directory
../e_os.h:449:29: error: sys/types.h: No such file or directory
In file included from cryptlib.h:72,
                 from cryptlib.c:117:
../include/openssl/crypto.h:125:19: error: stdio.h: No such file or directory
In file included from cryptlib.h:72,
                 from cryptlib.c:117:
../include/openssl/crypto.h:175: error: expected specifier-qualifier-list before ‘size_t’
../include/openssl/crypto.h:465: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:465: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:466: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:467: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:468: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:470: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:471: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:477: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:477: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:478: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:479: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:480: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:482: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:483: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:500: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:535: error: expected ‘)’ before ‘*’ token
In file included from cryptlib.h:74,
                 from cryptlib.c:117:
../include/openssl/bio.h:634: error: expected ‘)’ before ‘*’ token
../include/openssl/bio.h:706: error: expected ‘)’ before ‘*’ token
../include/openssl/bio.h:707: error: expected ‘)’ before ‘*’ token
In file included from ../include/openssl/err.h:127,
                 from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/lhash.h:186: error: expected declaration specifiers or ‘...’ before ‘FILE’
../include/openssl/lhash.h:187: error: expected declaration specifiers or ‘...’ before ‘FILE’
../include/openssl/lhash.h:188: error: expected declaration specifiers or ‘...’ before ‘FILE’
In file included from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/err.h:140:19: error: errno.h: No such file or directory
In file included from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/err.h:343: error: expected ‘)’ before ‘*’ token
cryptlib.c: In function ‘CRYPTO_THREADID_set_numeric’:
cryptlib.c:430: warning: incompatible implicit declaration of built-in function ‘memset’
cryptlib.c: In function ‘CRYPTO_THREADID_set_pointer’:
cryptlib.c:441: warning: incompatible implicit declaration of built-in function ‘memset’
cryptlib.c: In function ‘CRYPTO_THREADID_current’:
cryptlib.c:507: error: ‘errno’ undeclared (first use in this function)
cryptlib.c:507: error: (Each undeclared identifier is reported only once
cryptlib.c:507: error: for each function it appears in.)
cryptlib.c: In function ‘CRYPTO_THREADID_cpy’:
cryptlib.c:518: warning: incompatible implicit declaration of built-in function ‘memcpy’
cryptlib.c: In function ‘OPENSSL_showfatal’:
cryptlib.c:906: error: ‘stderr’ undeclared (first use in this function)
cryptlib.c: In function ‘OpenSSLDie’:
cryptlib.c:918: warning: incompatible implicit declaration of built-in function ‘abort’
cryptlib.c: In function ‘OPENSSL_stderr’:
cryptlib.c:926: error: ‘stderr’ undeclared (first use in this function)
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1
What can I fix it 

如果您知道请帮助我,请如何解决此错误。谢谢你。

4

3 回答 3

0

我尝试使用此http://x2on.de/2010/12/16/tutorial-script-for-building-openssl-for-ios-iphoneipad/编译 openssl 库,但得到了

您的问题是由于路径和 sysroot 问题造成的。从外观上看,该脚本是一个可怕的 hack。

OpenSSL 项目有一个脚本,用于设置环境并为 iOS 设备构建库。你可以在这里找到它:setenv-ios,sh。不幸的是,网络上或其 wiki 中没有文档。OpenSSL FIPS 用户指南 2.0对此进行了介绍(请参阅附录 E)。

这是我用来构建库(使用脚本)的配方。确保 OpenSSL tar 球和脚本位于同一目录中(下面的“根”目录)。

# Start fresh
$ rm -rf openssl-1.0.1e/
$ chmod a+x setenv-ios-11.sh

# From the 'root' directory
$ . ./setenv-ios-11.sh
$ tar xzf openssl-1.0.1e.tar.gz
$ cd openssl-1.0.1e/

$ perl -pi -e 's/install: all install_docs install_sw/install:install_docs install_sw/g' Makefile.org
$ ./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/ios-6.1

$ make depend
$ make all
$ sudo -E make install

一定要包括前导“。” (dot) 设置环境时。安装后,您的头文件和库将位于/usr/local/ssl/ios-6.1.

如果您有任何问题,请查阅OpenSSL FIPS 用户指南 2.0,但忽略 FIPS 相关内容。

于 2013-10-02T07:38:40.990 回答
0

取决于你需要什么,你可以考虑在你的项目中使用 Cocoapods,然后你可以像这样使用 pod:https ://github.com/krzak/OpenSSL

只需添加到 Podfile:

pod 'OpenSSL', :podspec => 'https://raw.github.com/krzak/OpenSSL/master/OpenSSL.podspec'

并进行编码。

于 2013-10-21T00:23:28.377 回答
0

如果您同时安装了 Windows SDK 10 和 Windows Driver SDK 10,也可能会发生该错误。在这种情况下,VCVARS 似乎会设置错误的包含路径

于 2016-11-17T09:19:17.047 回答