[MDEV-5463] cmake with default parameters fails if there is no SSL library in the system Created: 2013-12-18  Updated: 2019-01-22  Resolved: 2019-01-22

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 10.0.6
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: compile
Environment:

Linux



 Description   

The default value for WITH_SSL on non-Windows in 10.0 is "yes", which is supposed to prefer the system library if there is one, and retreat to the bundled otherwise. But it doesn't work this way:

cmake .
 
...
-- Looking for deflateBound - found
-- suffixes <.so;.a>
CMake Error at cmake/ssl.cmake:162 (FILE):
  file STRINGS file
  "/home/elenst/bzr/10.0-release/OPENSSL_INCLUDE_DIR-NOTFOUND/openssl/opensslv.h"
  cannot be read.
Call Stack (most recent call first):
  CMakeLists.txt:271 (MYSQL_CHECK_SSL)
 
 
-- OPENSSL_INCLUDE_DIR = OPENSSL_INCLUDE_DIR-NOTFOUND
-- OPENSSL_LIBRARIES = OPENSSL_LIBRARIES-NOTFOUND
-- CRYPTO_LIBRARY = CRYPTO_LIBRARY-NOTFOUND
-- OPENSSL_MAJOR_VERSION = 
-- Looking for SHA512_DIGEST_LENGTH
-- Looking for SHA512_DIGEST_LENGTH - not found.
-- Check size of mbstate_t
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of mbstate_t - failed
-- Performing Test HAVE_LANGINFO_CODESET
 
...
 
-- Looking for iswctype - found
-- Check size of wchar_t
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of wchar_t - failed
-- Check size of wctype_t
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of wctype_t - failed
-- Check size of wint_t
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of wint_t - failed
-- Found Curses: /usr/lib/x86_64-linux-gnu/libcurses.so  
 
 
...
 
-- Looking for asprintf - found
-- Check size of pthread_t
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of pthread_t - failed
-- Configuring OQGraph
 
...
 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
   used as include directory in directory /home/elenst/bzr/10.0-release/CMakeFiles/CMakeTmp
 
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check size of unsigned long long - failed

This is what seemingly makes it work, although I'm not quite sure it's the right way (specifically, I doubt about moving INCLUDE(CheckSymbolExists) as I don't know what it is supposed to do, exactly).

=== modified file 'cmake/ssl.cmake'
--- cmake/ssl.cmake	2013-11-20 11:05:39 +0000
+++ cmake/ssl.cmake	2013-12-18 12:26:54 +0000
@@ -156,23 +156,26 @@
       LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
     ENDIF()
 
-    # Verify version number. Version information looks like:
-    #   #define OPENSSL_VERSION_NUMBER 0x1000103fL
-    # Encoded as MNNFFPPS: major minor fix patch status
-    FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
-      OPENSSL_VERSION_NUMBER
-      REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
-    )
-    STRING(REGEX REPLACE
-      "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
-      OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
-    )
-
     IF(OPENSSL_INCLUDE_DIR AND
        OPENSSL_LIBRARIES   AND
        CRYPTO_LIBRARY
       )
       SET(OPENSSL_FOUND TRUE)
+      # Verify version number. Version information looks like:
+      #   #define OPENSSL_VERSION_NUMBER 0x1000103fL
+      # Encoded as MNNFFPPS: major minor fix patch status
+      FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
+        OPENSSL_VERSION_NUMBER
+        REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
+      )
+      STRING(REGEX REPLACE
+        "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
+        OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
+      INCLUDE(CheckSymbolExists)
+      SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+      CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" 
+                          HAVE_SHA512_DIGEST_LENGTH)
+      )
     ELSE()
       SET(OPENSSL_FOUND FALSE)
     ENDIF()
@@ -182,10 +185,6 @@
     MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
     MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
 
-    INCLUDE(CheckSymbolExists)
-    SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
-    CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" 
-                        HAVE_SHA512_DIGEST_LENGTH)
     IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH)
       SET(SSL_SOURCES "")
       SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
 



 Comments   
Comment by Sergei Golubchik [ 2014-05-05 ]

Where can I see it? I tried to use few of buildbot VMs and remove openssl there, but that removed half of the system, including yum, cmake, and bzr. I failed to create a usable system without openssl

Comment by Elena Stepanova [ 2019-01-22 ]

I don't think anybody is going to bother about this, so closing.

Generated at Thu Feb 08 07:04:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.