从源代码编译PHP时,为OpenSSL创建错误

时间:2015-04-09 12:55:06

标签: php compilation compiler-errors openssl makefile

我试图在Ubuntu Hardy x86_64上从源代码编译PHP 5.3.10和5.6.7(我知道,它已经过时了)。下面是我使用的配置语句:

./configure  
--prefix=/opt/php5
--with-config-file-path=/opt/php5/etc 
--with-curl 
--with-pear 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-zlib 
--with-xpm-dir 
--with-freetype-dir 
--with-t1lib 
--with-mcrypt 
--with-mhash 
--with-mysql 
--with-mysqli 
--with-pdo-mysql 
--with-xmlrpc 
--with-xsl 
--with-bz2 
--with-gettext 
--with-fpm-user=www-data 
--with-fpm-group=www-data 
--enable-fpm 
--enable-exif 
--enable-wddx 
--enable-zip 
--enable-bcmath 
--enable-calendar 
--enable-ftp 
--enable-mbstring 
--enable-soap 
--enable-sockets 
--enable-sqlite-utf8 
--enable-shmop 
--enable-dba 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--no-create 
--no-recursion 
--with-openssl 

但是在发出make命令时遇到问题:

/bin/bash /usr/local/src/php-5.6.7/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/openssl/ -I/usr/local/src/php-5.6.7/ext/openssl/ -DPHP_ATOM_INC -I/usr/local/src/php-5.6.7/include -I/usr/local/src/php-5.6.7/main -I/usr/local/src/php-5.6.7 -I/usr/local/src/php-5.6.7/ext/date/lib -I/usr/local/src/php-5.6.7/ext/ereg/regex -I/usr/include/libxml2 -I/usr/X11 -I/usr/include/freetype2 -I/usr/local/src/php-5.6.7/ext/mbstring/oniguruma -I/usr/local/src/php-5.6.7/ext/mbstring/libmbfl -I/usr/local/src/php-5.6.7/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php-5.6.7/ext/sqlite3/libsqlite -I/usr/local/src/php-5.6.7/ext/zip/lib -I/usr/local/src/php-5.6.7/TSRM -I/usr/local/src/php-5.6.7/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -c /usr/local/src/php-5.6.7/ext/openssl/openssl.c -o ext/openssl/openssl.lo
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:434: error: 'zif_openssl_get_cert_locations' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:437: error: 'zif_openssl_spki_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:438: error: 'zif_openssl_spki_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:439: error: 'zif_openssl_spki_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:440: error: 'zif_openssl_spki_export_challenge' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:443: error: 'zif_openssl_pkey_free' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:444: error: 'zif_openssl_pkey_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:445: error: 'zif_openssl_pkey_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:446: error: 'zif_openssl_pkey_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:447: error: 'zif_openssl_pkey_get_private' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:448: error: 'zif_openssl_pkey_get_public' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:449: error: 'zif_openssl_pkey_get_details' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:456: error: 'zif_openssl_x509_read' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:457: error: 'zif_openssl_x509_free' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:458: error: 'zif_openssl_x509_parse' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:459: error: 'zif_openssl_x509_checkpurpose' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:460: error: 'zif_openssl_x509_check_private_key' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:461: error: 'zif_openssl_x509_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:462: error: 'zif_openssl_x509_fingerprint' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:463: error: 'zif_openssl_x509_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:466: error: 'zif_openssl_pkcs12_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:467: error: 'zif_openssl_pkcs12_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:468: error: 'zif_openssl_pkcs12_read' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:471: error: 'zif_openssl_csr_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:472: error: 'zif_openssl_csr_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:473: error: 'zif_openssl_csr_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:474: error: 'zif_openssl_csr_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:475: error: 'zif_openssl_csr_get_subject' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:476: error: 'zif_openssl_csr_get_public_key' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:482: error: 'zif_openssl_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:483: error: 'zif_openssl_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:484: error: 'zif_openssl_seal' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:485: error: 'zif_openssl_open' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:492: error: 'zif_openssl_pkcs7_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:493: error: 'zif_openssl_pkcs7_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:494: error: 'zif_openssl_pkcs7_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:495: error: 'zif_openssl_pkcs7_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:497: error: 'zif_openssl_private_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:498: error: 'zif_openssl_private_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:499: error: 'zif_openssl_public_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:500: error: 'zif_openssl_public_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:508: error: 'zif_openssl_error_string' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: 'zm_startup_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: (near initialization for 'openssl_module_entry.module_startup_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: 'zm_shutdown_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: (near initialization for 'openssl_module_entry.module_shutdown_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: 'zm_info_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: (near initialization for 'openssl_module_entry.info_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zm_startup_openssl':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: 'OPENSSL_DEFAULT_STREAM_CIPHERS' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: for each function it appears in.)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: warning: passing argument 3 of 'zend_register_string_constant' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1210: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1210: warning: passing argument 3 of 'zend_register_long_constant' makes integer from pointer without a cast
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1211: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1211: warning: passing argument 3 of 'zend_register_long_constant' makes integer from pointer without a cast
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1233: error: 'php_openssl_ssl_socket_factory' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1233: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1234: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1236: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1238: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1239: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1246: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zif_openssl_encrypt':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5188: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5188: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5197: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5197: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zif_openssl_decrypt':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5252: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5252: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5281: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5281: error: invalid operands to binary &
make: *** [ext/openssl/openssl.lo] Error 1

这完全正常,我可以在不包含--with-openssl命令时编译/ make / make install

我尝试从apt,源代码,不同版本(0.9.8和0.9.7)等安装openssl。

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

在这里回答了我自己的问题:

我删除了以下configure个选项,后来的make工作顺利。

--no-create --no-recursion

这解决了我的问题。