[CDRIVER-2787] build failure on Gentoo when LibreSSL is available Created: 03/Aug/18  Updated: 28/Oct/23  Resolved: 28/Aug/18

Status: Closed
Project: C Driver
Component/s: libmongoc, tls
Affects Version/s: None
Fix Version/s: 1.13.0

Type: Bug Priority: Major - P3
Reporter: hydrapolic Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Cannot compile mongo-c-driver-1.12.0 with libressl 2.6.5 (downstream bug https://bugs.gentoo.org/662654)

cmake -DENABLE_SSL=LIBRESSL .
-- The C compiler identification is ;GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
  -- Using bundled libbson
libbson version (from VERSION_CURRENT file): 1.12.0
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for reallocf
-- Looking for reallocf - not found
-- Performing Test BSON_HAVE_TIMESPEC
-- Performing Test BSON_HAVE_TIMESPEC - Success
--     struct timespec found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for rand_r
-- Looking for rand_r - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for SYS_gettid
-- Looking for SYS_gettid - found
-- Looking for syscall
-- Looking for syscall - found
-- Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH
-- Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH - Success
-- Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH
-- Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
libmongoc version (from VERSION_CURRENT file): 1.12.0
-- Searching for zlib CMake packages
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.11") 
--   zlib found version "1.2.11"
--   zlib include path "/usr/include"
--   zlib libraries "/usr/lib/libz.so"
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file stdarg.h
-- Looking for include file stdarg.h - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Searching for LibreSSL/libtls
-- Checking for module 'libtls'
--   Found libtls, version 2.6.5
--   Found tls
CMake Error at src/libmongoc/CMakeLists.txt:112 (include_directories):
  include_directories given empty-string as include directory.
-- Searching for sasl/sasl.h
--   Not found (specify -DCMAKE_INCLUDE_PATH=/path/to/sasl/include for SASL support)
-- Searching for libsasl2
--   Not found (specify -DCMAKE_LIBRARY_PATH=/path/to/sasl/lib for SASL support)
-- Check size of socklen_t
-- Check size of socklen_t - done
-- Looking for res_nsearch
-- Looking for res_nsearch - found
-- Looking for res_ndestroy
-- Looking for res_ndestroy - not found
-- Looking for res_nclose
-- Looking for res_nclose - found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- Detected parameters: accept (int, struct sockaddr *, socklen_t *)
-- Searching for compression library header snappy-c.h
--   Found in /usr/include
-- Searching for libsnappy
--   Found /usr/lib/libsnappy.so
-- No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.
-- If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.
-- Compiling against LibreSSL
-- SASL disabled
-- Configuring incomplete, errors occurred!
See also "/tmp/mongo-c-driver/mongo-c-driver-1.12.0/CMakeFiles/CMakeOutput.log".
See also "/tmp/mongo-c-driver/mongo-c-driver-1.12.0/CMakeFiles/CMakeError.log".

Using the following patch it works

diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index d09d706..5d84225 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -109,7 +109,9 @@ if (NOT ENABLE_SSL STREQUAL OFF)
       if (LIBRESSL_FOUND)
          message ("--   Found ${LIBRESSL_LIBRARIES}")
          set (SSL_LIBRARIES ${LIBRESSL_LIBRARIES})
-         include_directories ("${LIBRESSL_INCLUDE_DIRS}")
+         if (${LIBRESSL_INCLUDE_DIRS})
+           include_directories ("${LIBRESSL_INCLUDE_DIRS}")
+         endif ()
          link_directories ("${LIBRESSL_LIBRARY_DIRS}")
          set (LIBRESSL 1)
       else ()



 Comments   
Comment by Githook User [ 28/Aug/18 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: CDRIVER-2787 fix building with empty LIBRESSL_INCLUDE_DIRS, 2
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/d91c87db429e9808582c2a466eb302735de2ed03

Comment by Githook User [ 28/Aug/18 ]

Author:

{'name': 'Tomas Mozes', 'email': 'hydrapolic@gmail.com', 'username': 'hydrapolic'}

Message: CDRIVER-2787 fix building with empty LIBRESSL_INCLUDE_DIRS
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6c8593fb1d7361367ee2eafca4a8cd32ff4bf6e5

Comment by hydrapolic [ 28/Aug/18 ]

Yes, sure, here it is: https://github.com/mongodb/mongo-c-driver/pull/533

Comment by A. Jesse Jiryu Davis [ 10/Aug/18 ]

Thanks for the report! Would you like to submit a pull request at https://github.com/mongodb/mongo-c-driver ?

Generated at Wed Feb 07 21:16:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.