Bug #75622 cmake/ssl.cmake fails to get OpenSSL version for OpenSSL 1.0.2 - bugfix given he
Submitted: 25 Jan 2015 3:15 Modified: 1 Apr 2015 4:29
Reporter: Joel Bion Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.22, 5.6.23 OS:Linux (Build from source)
Assigned to: CPU Architecture:Any
Tags: openssl

[25 Jan 2015 3:15] Joel Bion
Description:
The definition line for OPENSSL_VERSION_NUMBER in openssl/opensslv.h has changed slightly. In 1.0.2, the line is:
 
# define  OPENSSL_VERSION_NUMBER ...

NOTE the "space" between the pound-sign and the word define. This is allowed in c pre-processor syntax.

The cmake/ssl.cmake file tries to parse this as follows on line 170:

     REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"

This will fail as it insists the "define" comes immediately after the "#". Changing this to the more flexible makes it work:

     REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"

How to repeat:
Just try to cmake mysql with the following line. Really all that's important is the WITH_SSL parameter

cmake -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=true

Suggested fix:
The suggested fix is in the description box.
[26 Jan 2015 10:43] MySQL Verification Team
Hello Joel Bion,

Thank you for the report.
Observed this behavior with 5.6.23.

Thanks,
Umesh
[26 Jan 2015 10:43] MySQL Verification Team
// ENV details

//OpenSSL details

[root@ol6 mysql-5.6.23]# openssl
OpenSSL> version
OpenSSL 1.0.2 22 Jan 2015
OpenSSL> quit

// Cmake details

[root@ol6 mysql-5.6.23]# cmake --version
cmake version 2.8.12.2
[root@ol6 mysql-5.6.23]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

// OS details
[root@ol6 mysql-5.6.23]# cat /etc/*release
Oracle Linux Server release 6.0
Red Hat Enterprise Linux Server release 6.0 (Santiago)
Oracle Linux Server release 6.0
[root@ol6 mysql-5.6.23]# 

// Source build details
[root@ol6 Downloads]# md5sum mysql-5.6.23.tar.gz 
60344f26eae136a267a0277407926e79  mysql-5.6.23.tar.gz

[ushastry@ol6 mysql-5.6.23]$ cmake -DCMAKE_INSTALL_PREFIX=/home/ushastry/Downloads/mysql-5.6.23 -DWITH_SSL=system
..
.
-- OPENSSL_INCLUDE_DIR = /usr/local/include
-- OPENSSL_LIBRARY = /usr/local/lib64/libssl.a
-- CRYPTO_LIBRARY = /usr/local/lib64/libcrypto.a
-- OPENSSL_MAJOR_VERSION = 
-- Looking for SHA512_DIGEST_LENGTH
-- Looking for SHA512_DIGEST_LENGTH - found
CMake Error at cmake/ssl.cmake:234 (MESSAGE):
  Cannot find appropriate system libraries for SSL.  Use WITH_SSL=bundled to
  enable SSL support
Call Stack (most recent call first):
  CMakeLists.txt:407 (MYSQL_CHECK_SSL)
[25 Mar 2015 10:10] Srinivasarao Ravuri
This issue also applies with the recently released OpenSSL 1.0.1m .
[30 Mar 2015 8:27] Tor Didriksen
Posted by developer:
 
Duplicate of internal bug
Bug #20756770 MYSQL SERVER DOESN'T COMPILE AGAINST OPENSSL 1.0.1M
[1 Apr 2015 4:29] Erlend Dahl
[25 Mar 2015 8:22] Paul Dubois

Noted in 5.6.25, 5.7.8, 5.8.0 changelogs.

CMake failed to detect the OpenSSL version properly for recent
versions of OpenSSL (the format of the version string changed).
[27 Apr 2015 12:58] Laurynas Biveinis
commit 26e00258fd2dda3b4c9198c59e40819433ffa56a
Author: Tor Didriksen <tor.didriksen@oracle.com>
Date:   Tue Mar 24 10:37:54 2015 +0100

    Bug#20756770 MYSQL SERVER DOESN'T COMPILE AGAINST OPENSSL 1.0.1M
    
    The #define in openssl/opensslv.h contains an extra space in 1.0.1M
    Fix the regexp that is used for parsing the version number.
    
    (cherry picked from commit e5f6940dfc10580117249fefaee511e44df55326)