MariaDB un-buildable on linux64: fails @ "error: ‘ERR_remove_state’ was not declared in this scope" when linking against OpenSSL 1.0.2e


Building mariaDB 10.1.9 on linux/64,

lsb_release -rd
Description: openSUSE Leap 42.1 (x86_64)
Release: 42.1
gcc --version
gcc (SUSE Linux) 5.3.1 20151207 [gcc-5-branch revision 231355]

git log | head
commit 370a2cbe96e026fdb8966d8e58e7c93f75597cb8
Author: Nirbhay Choubey <>
Date: Fri Nov 20 19:49:16 2015 -0500

Fix syntax error in

commit 2fc3dc393d396647a220b286780f31d244ac2c53
Merge: e52c753 1e156e1
Author: Sergei Golubchik <>
Date: Fri Nov 20 09:31:13 2015 +0100

linking to local build of openssl 1.0.2e libs,

openssl version
OpenSSL 1.0.2e 3 Dec 2015
tree -L 1 /usr/local/ssl
├── bin
├── certs
├── include
├── lib64
├── man
├── misc
├── openssl.cnf
└── private

The build FAILs

-L/usr/local/ssl/lib64 -Wl,-rpath,/usr/local/ssl/lib64 -lssl -lcrypto
cmake .. --debug-output \
-DWITH_SSL=/usr/local/ssl \
-DOPENSSL_ROOT_DIR=/usr/local/ssl \
-DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include \
-DOPENSSL_LIBRARIES=/usr/local/ssl/lib64/ \
-DCRYPTO_LIBRARY=/usr/local/ssl/lib64/ \
make -j4 VERBOSE=1
[ 18%] Linking CXX executable my_safe_process
cd /usr/local/src/mariadb/bld/mysql-test/lib/My/SafeProcess && /usr/bin/cmake -E cmake_link_script CMakeFiles/my_safe_process.dir/link.txt --verbose=1
/usr/bin/g++-5 -fno-delete-null-pointer-checks -D_FORTIFY_SOURCE=2 -fmessage-length=0 -fstack-protector -march=x86-64 -mtune=nocona -I/usr/local/include -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -DWITH_INNODB_DISALLOW_WRITES -fno-exceptions -fno-rtti -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1 -L/usr/local/lib64 -Wl,-rpath,/usr/local/lib64 -lpcre -lpcrecpp CMakeFiles/my_safe_process.dir/ -o my_safe_process -lpthread
[ 18%] Linking C static library libwsrep.a
cd /usr/local/src/mariadb/bld/wsrep && /usr/bin/cmake -P CMakeFiles/wsrep.dir/cmake_clean_target.cmake
cd /usr/local/src/mariadb/bld/wsrep && /usr/bin/cmake -E cmake_link_script CMakeFiles/wsrep.dir/link.txt --verbose=1
/usr/bin/ar qc libwsrep.a CMakeFiles/wsrep.dir/wsrep_gtid.c.o CMakeFiles/wsrep.dir/wsrep_uuid.c.o CMakeFiles/wsrep.dir/wsrep_loader.c.o CMakeFiles/wsrep.dir/wsrep_dummy.c.o
/usr/bin/ranlib libwsrep.a
make[2]: Leaving directory '/usr/local/src/mariadb/bld'
[ 18%] Built target wsrep
/usr/local/src/mariadb/mysys_ssl/ In destructor ‘virtual MyCTX::~MyCTX()’:
/usr/local/src/mariadb/mysys_ssl/ error: ‘ERR_remove_state’ was not declared in this scope
virtual ~MyCTX() { EVP_CIPHER_CTX_cleanup(&ctx); ERR_remove_state(0); }
mysys_ssl/CMakeFiles/mysys_ssl.dir/build.make:158: recipe for target 'mysys_ssl/CMakeFiles/mysys_ssl.dir/' failed
make[2]: *** [mysys_ssl/CMakeFiles/mysys_ssl.dir/] Error 1
make[2]: Leaving directory '/usr/local/src/mariadb/bld'
CMakeFiles/Makefile2:4566: recipe for target 'mysys_ssl/CMakeFiles/mysys_ssl.dir/all' failed
make[1]: *** [mysys_ssl/CMakeFiles/mysys_ssl.dir/all] Error 2
make[2]: Leaving directory '/usr/local/src/mariadb/bld'
[ 18%] Built target my_safe_process
make[1]: Leaving directory '/usr/local/src/mariadb/bld'
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Per openSSL docs, ERR_remove_state() appears to be deprecated

ERR_remove_state() was deprecated in OpenSSL 1.0.0 when ERR_remove_thread_state() was introduced and thread IDs were introduced to identify threads instead of 'unsigned long'.


MariaDB 10.1.9 on linux/64 + OpenSSL 1.0.2e


Sergei Golubchik





Fix versions

Affects versions