Compilation fails with OpenSSL 1.1

Issue #312 resolved
Rodolphe Breard created an issue

Problem

OpenSSL 1.1 changed its API, causing the following compilations errors :

/home/rodolphe/ryzom/ryzomcore/code/ryzom/client/src/http_client_curl.cpp: In function CURLcode sslctx_function(CURL*, void*, void*):
/home/rodolphe/ryzom/ryzomcore/code/ryzom/client/src/http_client_curl.cpp:125:63: error: invalid use of incomplete type X509 {aka struct x509_st}
        nlwarning("Error adding certificate %s: %s", itmp->x509->name, errorBuffer);
                                                               ^~
In file included from /usr/include/openssl/crypto.h:31:0,
                 from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:47,
                 from /home/rodolphe/ryzom/ryzomcore/code/ryzom/client/src/http_client_curl.cpp:22:
/usr/include/openssl/ossl_typ.h:119:16: note: forward declaration of X509 {aka struct x509_st}
 typedef struct x509_st X509;
                ^~~~~~~
/home/rodolphe/ryzom/ryzomcore/code/ryzom/client/src/http_client_curl.cpp:131:48: error: invalid use of incomplete type X509 {aka struct x509_st}
       nlinfo("Added certificate %s", itmp->x509->name);
                                                ^~
In file included from /usr/include/openssl/crypto.h:31:0,
                 from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:47,
                 from /home/rodolphe/ryzom/ryzomcore/code/ryzom/client/src/http_client_curl.cpp:22:
/usr/include/openssl/ossl_typ.h:119:16: note: forward declaration of X509 {aka struct x509_st}
 typedef struct x509_st X509;
                ^~~~~~~
make[3]: *** [ryzom/client/src/CMakeFiles/ryzom_client.dir/build.make:1431: ryzom/client/src/CMakeFiles/ryzom_client.dir/http_client_curl.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/Makefile2:1867: ryzom/client/src/CMakeFiles/ryzom_client.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1879: ryzom/client/src/CMakeFiles/ryzom_client.dir/rule] Error 2
make: *** [Makefile:550: ryzom_client] Error 2

Workaround

Because OpenSSL 1.0 is still maintained until 2019, a workaround is to install it in a different folder (eg: see ArchLinux's openssl and openssl-1.0 packages). It is then possible to force the use of OpenSSL 1.0 with cmake (thanx Glorf ! :p) :

cmake […]
      -DOPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0/"
      -DOPENSSL_SSL_LIBRARY="/usr/lib/openssl-1.0/libssl.so"
      -DOPENSSL_CRYPTO_LIBRARY="/usr/lib/openssl-1.0/libcrypto.so"
      […]

Comments (4)

  1. Log in to comment