Details
Description
When I compile MariaDB using a recent clang on MacOSX against the homebrew version of openssl I get compile errors (see the attached full log). e.g.
[build] In file included from /Users/gkodinov/dev/server-10.11/libmariadb/plugins/auth/sha256_pw.c:47:
|
[build] In file included from /opt/homebrew/Cellar/openssl@4/4.1.0/include/openssl/rsa.h:21:
|
[build] In file included from /opt/homebrew/Cellar/openssl@4/4.1.0/include/openssl/asn1.h:32:
|
[build] In file included from /opt/homebrew/Cellar/openssl@4/4.1.0/include/openssl/bio.h:32:
|
[build] In file included from /opt/homebrew/Cellar/openssl@4/4.1.0/include/openssl/crypto.h:36:
|
[build] /opt/homebrew/Cellar/openssl@4/4.1.0/include/openssl/safestack.h:280:1: error: cast from 'OPENSSL_sk_freefunc' (aka 'void (*)(void *)') to 'sk_OPENSSL_STRING_freefunc' (aka 'void (*)(char *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
|
[build] 280 | SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_STRING, char, char)
|
[build] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
This, according to my grok, is because of an unrelated clang/openssl compilation issue:
The error is a strict function-pointer cast inside OpenSSL's stack macros. This is not a bug in sha256_pw.c. Clang is rejecting a cast inside an OpenSSL header, and MariaDB's maintainer build turns that warning into an error.
|
While we could try and fix openssl code to compile well under clang, the easiest way is to make the OpenSSL (and other 3d party libraries) headers compile as 3d party (system) headers, so that the warning doesn't get promoted to error.