Gcc 如何修复OpenSSL错误“;lib64/libldap.so所需的libssl.so.10可能与libssl.so.1.1“冲突”;在CentOS 7上编译PHP时?

Gcc 如何修复OpenSSL错误“;lib64/libldap.so所需的libssl.so.10可能与libssl.so.1.1“冲突”;在CentOS 7上编译PHP时?,gcc,openssl,centos7,linker-errors,Gcc,Openssl,Centos7,Linker Errors,我从一个完全干净的CentOS 7安装开始,没有安装任何东西 从一开始,我就yum安装了这些RPM: 制造 定位 pcre-devel 外派德维尔酒店 epel释放 libxml2-devel 百日咳 wget 维姆 猞猁 libnghttp2-devel libnghttp2 nghttp2 libpng-devel 海湾合作委员会* perl模块加载条件 perl内核 旋度 openssl-devel 马里亚布·德维尔 unixODBC-devel bzip2-devel libjpeg-

我从一个完全干净的CentOS 7安装开始,没有安装任何东西

从一开始,我就
yum安装了这些RPM:

  • 制造
  • 定位
  • pcre-devel
  • 外派德维尔酒店
  • epel释放
  • libxml2-devel
  • 百日咳
  • wget
  • 维姆
  • 猞猁
  • libnghttp2-devel
  • libnghttp2
  • nghttp2
  • libpng-devel
  • 海湾合作委员会*
  • perl模块加载条件
  • perl内核
  • 旋度
  • openssl-devel
  • 马里亚布·德维尔
  • unixODBC-devel
  • bzip2-devel
  • libjpeg-devel
  • libXpm-devel
  • freetype-devel
  • gmp-devel
  • libmcrypt-devel
  • httpd-devel
**分辨率编辑** 添加了以下RPM:

  • 塞勒斯·萨斯勒
  • 赛勒斯·萨斯尔·德维尔
我使用下面的相应命令从源代码处编译了OpenSSL 1.1.1、cURL 7.62.0和HTTPD 2.4.38:

OpenSSL 卷曲 HTTPD 到目前为止,一切正常。我能够通过远程机器上的浏览器加载HTML页面。(打开端口80后)

这就是我开始遇到问题的地方

**OPENLDAP编辑(通过编译OPENLDAP解决)**

PHP 弄错 运行<代码>时进行清洁;make
我遇到了以下错误:

  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
  //usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  make: *** [sapi/cli/php] Error 1
制作测试日志
make test
命令返回相同的错误

/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

要停止此警告,请使用系统SSL库,不要自己编译它


或者,您必须构建您正在使用的所有库,这些库是针对OpenSSL的链接,您自己(在您的例子中是libldap)

谢谢,这对我很有用。我将使用工作配置脚本更新原始问题,包括配置和安装OpenLDAP库。为了使用最新版本的OpenSSL,我必须用最新版本的已编译OpenSSL编译OpenLDAP。
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
  --prefix=/opt/curl \
  --with-ssl \
  LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib"
  CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
make clean
make
make install
$ curl -V
curl 7.62.0 (x86_64-pc-linux-gnu) libcurl/7.62.0 OpenSSL/1.1.1 zlib/1.2.7 nghttp2/1.31.1
Release-Date: 2018-10-31
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
  --prefix=/opt/httpd \
  --with-included-apr \
  --enable-so \
  --with-port=80 \
  --enable-http2 \
  --enable-ssl \
  --enable-ssl=shared \
  --with-ssl=/opt/openssl \
  --with-curl=/opt/curl \
  LDFLAG="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib -L/opt/curl/lib -Wl,-rpath,/opt/curl/lib" \
  CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include -I/opt/curl/include -Wl,-rpath,/opt/curl/include"
$ make clean
$ make
$ make install
$ httpd -v
Server version: Apache/2.4.38 (Unix)
Server built:   Mar 13 2019 15:14:01
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
  --prefix=/opt/openldap \
  --with-tls \
  LDFLAGS="-L/opt/openssl/lib -Wl,-rpath,/opt/openssl/lib" \
  CPPFLAGS="-I/opt/openssl/include -Wl,-rpath,/opt/openssl/include"
$ make clean
$ make depend
$ make
$ make install
$ env PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \
  --with-apxs2=/opt/httpd/bin/apxs \
  --prefix=/opt/php \
  --with-mysqli \
  --with-pdo-mysql \
  --enable-pdo \
  --enable-ftp \
  --with-zlib \
  --enable-zip \
  --enable-mbstring \
  --with-curl=/opt/curl \
  --with-openssl \
  --with-openssl-dir=/opt/openssl  \
  --enable-exif \
  --with-gd \
  --enable-shared \
  --enable-cgi \
  --with-ldap=/opt/openldap \
  LDFLAGS="-Wl,-rpath,/opt/openldap/lib -L/opt/openldap/lib -Wl,-rpath,/opt/openssl/lib -L/opt/openssl/lib" \
  CPPFLAGS="-Wl,-rpath,/opt/openldap/include -I/opt/openldap/include -Wl,-rpath,/opt/openssl/include -I/opt/openssl/include"
$ make clean
$ make
$ make install
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
  /usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
  //usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  make: *** [sapi/cli/php] Error 1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/usr/bin/ld: ext/openssl/.libs/xp_ssl.o: undefined reference to symbol 'SSLv3_server_method@@libssl.so.10'
//usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1