I have been looking for this issue on the internet, but can't find a solution. What I'm trying to achieve is to build a CGI-application with both dependencies of OpenSSL
and MySQLClient
.
When I compile my program, with the following command:
g++ -Wall -o test.cgi test.cpp -I/usr/include/mysql -lcgicc -lmysqlcppconn -lmysqlclient -lcurl -lnghttp2 -lssl -lcrypto -lpthread -ldl -DCURL_STATICLIB -std=c++11 -lz -static
I get the following error:
//usr/local/lib/libcrypto.a(err.o): In function `ERR_remove_thread_state':
err.c:(.text+0xe40): multiple definition of `ERR_remove_thread_state'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libmysqlclient.a(ssl.cpp.o):(.text+0x1df0): first defined here
I have tried multiple solutions, such as both down- and upgrade to other versions of OpenSSL, as opposed here. However, I still get this error when compiling with any of the following OpenSSL versions:
- OpenSSL 0.9.8
- OpenSSL 1.1.0g
- OpenSSL 1.1.1
What should I do to overcome this error and be able to compile my program statically?