Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3813

CMake project with static OpenSSL does not link

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.18.0, 1.18.0-alpha
    • Affects Version/s: 1.17.2
    • Component/s: Build
    • None
    • Environment:
      Ubuntu 20.04
      CMake 3.16.0
      GCC 9.3.0

      I created a very simple CMake project (see attached files) to test static linkage of OpenSSL but I go the following error message:

      /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
      /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
      collect2: error: ld returned 1 exit status

       

      Steps to reproduce:

       

      mkdir build
      cd build
      
      cmake -DBUILD_SHARED_LIBS=OFF -DOPENSSL_USE_STATIC_LIBS=ON ..
      
      make -j 6
      

       

      N.B.: If OPENSSL_USE_STATIC_LIBS is unset (or set to OFF), .so are used and compilation works.

       

        1. add_mongo.cmake
          2 kB
        2. CMakeLists.txt
          1 kB
        3. main.cpp
          0.4 kB
        4. mongocxxdriver.patch
          1 kB

            Assignee:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Reporter:
            thomas.jego@dice-engineering.com Thomas Jego
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: