Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-272

Build failure with OpenSSL 0.9.8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 3.0.2
    • Fix Version/s: N/A
    • Labels:
      None
    • Environment:
      macOS 10.12.6

      Description

      Building against OpenSSL 0.9.8zh, I get the following error:

      Scanning dependencies of target mariadb_obj
      [  1%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/secure/openssl.c.o
      /tmp/mariadb-connector-c-3.0.2-src/libmariadb/secure/openssl.c:247:5: warning: 
            implicit declaration of function 'CRYPTO_THREADID_set_callback' is invalid in C99
            [-Wimplicit-function-declaration]
          CRYPTO_THREADID_set_callback(my_cb_threadid);
          ^
      1 warning generated.
      [ 42%] Built target mariadb_obj
      [ 43%] Linking C static library libmariadbclient.a
      [ 43%] Built target mariadbclient
      [ 44%] Linking C shared library libmariadb.dylib
      Undefined symbols for architecture x86_64:
        "_CRYPTO_THREADID_set_callback", referenced from:
            _ma_tls_start in openssl.c.o
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[2]: *** [libmariadb/libmariadb.3.dylib] Error 1
      make[1]: *** [libmariadb/CMakeFiles/libmariadb.dir/all] Error 2
      make: *** [all] Error 2
      

      From the man page:

      CRYPTO_THREADID and associated functions were introduced in OpenSSL 1.0.0 to replace (actually, deprecate) the previous CRYPTO_set_id_callback(), CRYPTO_get_id_callback(), and CRYPTO_thread_id() functions which assumed thread IDs to always be represented by 'unsigned long'.

      The following patch fixes things:

      --- openssl.c    2017-07-26 15:27:59.000000000 -0400
      +++ openssl.c.fixed     2017-07-26 15:27:27.000000000 -0400
      @@ -244,7 +244,11 @@
               pthread_mutex_init(&LOCK_crypto[i], NULL);
           }
           CRYPTO_set_locking_callback(my_cb_locking);
      +#if OPENSSL_VERSION_NUMBER < 0x10000000L
      +    CRYPTO_set_id_callback(my_cb_threadid);
      +#else
           CRYPTO_THREADID_set_callback(my_cb_threadid);
      +#endif
         }
         return 0;
       }
      

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            emiller999 Evan Miller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: