php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77392 ./configure fails on OpenSSL library searches
Submitted: 2018-12-31 22:11 UTC Modified: 2021-07-15 16:59 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: john dot iliffe at iliffe dot ca Assigned: cmb (profile)
Status: Closed Package: *Configuration Issues
PHP Version: 7.3.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john dot iliffe at iliffe dot ca
New email:
PHP Version: OS:

 

 [2018-12-31 22:11 UTC] john dot iliffe at iliffe dot ca
Description:
------------
This report contains elements of bug reports 72363 (PHP 7.0 and 7.1 and 75726 (PHP 7.1.12).  Note the non-standard location of OpenSSL on my server.  It appears that the with-openssl= configuration variable is not being picked up.

./configure prefix=/usr/php-7.3.0 --enable-fpm --with-fpm-user=phpfpm --with-libdir=lib64 --with-fpm-group=phpfpm --with-fpm-systemd --disable-short-tags --with-openssl=/usr/openssl-1.1.0i --with-pcre-regex --with-imap=/usr/lib64 --with-imap-ssl=/usr/openssl-1.1.0i/include/openssl --with-pgsql=/usr/postgres-9.6.2/bin --enable-zip --with-pear

Fails with one of several errors:
configure: error: Cannot find OpenSSL's libraries
 - can sometimes be resolved by changing to with-openssl=/usr/openssl-1.1.0i/lib 
but this leads to 
configure: error: Cannot find OpenSSL's <evp.h> 
 - can resolve this by coding the FULL path to the include libraries:
    OPENSSL_INCDIR=/usr/openssl-1.1.0i/include/openssl in line 19052 and several 
   other places where it occurs.  Unfortunately, this messes up libs again.

There is a typo in lines 3843 and 45626 of the configure file, "-qversion" should be "--version".  It gives a configure fatal error when encountered but the configuration continues anyway, at least to the errors above.

Test script:
---------------
The ./configure shown in the previous section

Expected result:
----------------
I would expect a valid make file for the compile step. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-10 15:05 UTC] bugs dot php dot net at mundpropaganda dot net
"-qversion" should be perfectly fine. It caters to older versions of gcc.

I think you need to provide the directory _prefix_ to "--with-openssl", not the actual openssl directory. 

So if your openssl install really lives in "/usr/openssl-1.1.0i", you need to create a symlink à la "/usr/openssl -> /usr/openssl-1.1.0i" and run configure with "--with-openssl=/usr"

See also: http://php.net/manual/en/openssl.installation.php#115909
 [2019-01-10 17:44 UTC] john dot iliffe at iliffe dot ca
Thank you for the response.

I tried as suggested, set a link from /usr/openssl -> /usr/openssl-1.1.0i and changed the configuration as follows:

./configure prefix=/usr/php-7.3.0 --enable-fpm --with-fpm-user=phpfpm --with-libdir=lib64 --with-fpm-group=phpfpm --with-fpm-systemd --disable-short-tags --with-openssl=/usr/openssl --with-pcre-regex --with-imap=/usr/lib64 --with-imap-ssl=/usr/openssl --with-pgsql=/usr/postgres-9.6.2 --enable-zip --with-pear

which results in error "Cannot find OpenSSl's libraries".  I also tried changing the locations of OpenSSL to just /usr (ie --with-openssl=/usr) and that results in error "Cannot find OpenSSL's <evp.h>".  

Since there are two different places in the config where the openssl path is required, I tried various combinations of the above but all ended with "Cannot find OpenSSL's libraries"

Yes, I have several versions of OpenSSL on this server, each installed as noted under "/usr/<openssl version number>" and unfortunately they are included in various compiles (like Apache).

Thanks again.
 [2019-01-10 21:11 UTC] bugs dot php dot net at mundpropaganda dot net
Check this out: https://github.com/php/php-src/blob/PHP-7.3/acinclude.m4#L2327

The header files are supposed to be at "{prefix}/includes/openssl/". So your symlinks needs to be "/usr/includes/openssl -> /usr/openssl-1.1.0i", then run configure with "--with-openssl=/usr".
 [2019-01-19 02:06 UTC] john dot iliffe at iliffe dot ca
I have been playing with this for a while and I'm still stuck in a loop.  I set up a link as suggested:
  /usr/openssl->/usr/openssl-1.1.0i 
and a quick check shows that this resolves correctly:
  cd /usr/openssl; ls gives the expected result.  (I put a dummy file name on the correct directory to ensure the link was going to the right place)

The should resolve (in line 2335 of the config script) to /usr/openssl/include/openssl/ and it does, evp.h is present and the configure test in line 2344 passes here.

BUT, my reading of the script is that line 2339 should set OPENSSL_LIBDIR to:
 /usr/openssl-1.1.0i/lib  (PHP_LIBDIR is set to "lib") so that should be the result of:
$i=/usr/openssl-1.1.0i
$LIB_DIR=lib

This errors out with the message "Cannot find OpenSSL's libraries, which arises from line 2349.  A quick check using ls -l shows that the expected files are in the expected places.

What am I missing?  

For completeness, here is the configuration:
./configure prefix=/usr/php-7.3.0 --enable-fpm --with-fpm-user=phpfpm --with-libdir=lib64 --with-fpm-group=phpfpm --with-fpm-systemd --disable-short-tags --with-openssl=/usr/openssl --with-pcre-regex --with-imap=/usr/lib64 --with-imap-ssl=/usr/openssl --with-pgsql=/usr/postgres-9.6.2 --enable-zip --with-pear

with this link present:
lrwxrwxrwx. 1 root root 14 Jan 18 13:09 /usr/openssl -> openssl-1.1.0i

and:
ls -l /usr/openssl/lib
total 9104
drwxr-xr-x. 2 root root      55 Aug 29 23:13 engines-1.1
-rw-r--r--. 1 root root 5030226 Aug 29 23:13 libcrypto.a
lrwxrwxrwx. 1 root root      16 Aug 29 23:13 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x. 1 root root 2974920 Aug 29 23:13 libcrypto.so.1.1
-rw-r--r--. 1 root root  775792 Aug 29 23:13 libssl.a
lrwxrwxrwx. 1 root root      13 Aug 29 23:13 libssl.so -> libssl.so.1.1
-rwxr-xr-x. 1 root root  529648 Aug 29 23:13 libssl.so.1.1
drwxr-xr-x. 2 root root      61 Aug 29 23:13 pkgconfig
 [2019-01-22 17:33 UTC] john dot iliffe at iliffe dot ca
I have been playing with this over the last few days and I now have more information, but I still don't understand why it fails.

Configure error is :  configure:19063: error: Cannot find OpenSSL's libraries

In configure script, this is in the block starting in line 19062:
 
  if test -z "$OPENSSL_LIBDIR"; then
      as_fn_error $? "Cannot find OpenSSL's libraries" "$LINENO" 5
    fi

So, $OPENSSL_LIBDIR is null.  This is set in line 19053

 if test -r $i/$PHP_LIBDIR/libssl.a -o -r 
   $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then
        OPENSSL_LIBDIR=$i/$PHP_LIBDIR
   fi

I assume that the "test -r $i/PHP_LIBDIR/libssl.a" failed since the directory wasn't set.  But we know that $PHP_LIBDIR points to libssl.a because $i/lib:
(/usr/openssl is a link from /usr/openssl-1.1.0i)

ls -l /usr/openssl/lib/libssl.a
-rw-r--r--. 1 root root 775792 Aug 29 23:13 /usr/openssl/lib/libssl.a

We also know that $PHP_LIBDIR is set correctly because the test:

   if test -z "$OPENSSL_INCDIR"; then
      as_fn_error $? "Cannot find OpenSSL's <evp.h>" "$LINENO" 5
    fi

passed in the previous block and $OPENSSL_INCDIR is defined as:
       OPENSSL_INCDIR=$i/include 

which validates the $i/include path, and by inference $i.  

OPENSSL_LIBDIR is defined as:
	OPENSSL_LIBDIR=$i/$PHP_LIBDIR

and $PHP_LIBDIR is defined in line 4973 as "lib"

So, it looks like the test that failed should have passed because it seems probable that $OPENSSL_LIBDIR exists and is correct (?).
 [2021-07-15 14:53 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-15 14:53 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?  Note that as of PHP 7.4 pkg-config is used to detect
the location of OpenSSL.

[1] <https://www.php.net/supported-versions.php>
 [2021-07-15 16:33 UTC] john dot iliffe at iliffe dot ca
-Status: Feedback +Status: Assigned
 [2021-07-15 16:33 UTC] john dot iliffe at iliffe dot ca
I haven't tried any of the newer versions but since 7.3 is obsolete and my next move would probably be to a much newer version I think this problem report should be closed.  

Thanks for looking at it.
 [2021-07-15 16:59 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2021-07-15 16:59 UTC] cmb@php.net
Okay, closing then.  And sorry for our late response!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC