ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
333 stars 90 forks source link

Compilation fails with OpenSSL 1.1 #312

Closed ryzom-pipeline closed 6 years ago

ryzom-pipeline commented 7 years ago

Original report by Rodolphe Breard (Bitbucket: rodolphe_breard, ).


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"
      […]
ryzom-pipeline commented 7 years ago

Original comment by Guillaume DUPUY (Bitbucket: [Guillaume DUPUY](https://bitbucket.org/Guillaume DUPUY), ).


You can also workaround the issue on debian (&debian-like) by installing libssl1.0.0 and downgrading libssl-dev to jessie's version (1.0.1t-1+deb8u6). Her's openSSL page about the migration : https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes

ryzom-pipeline commented 6 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Fixed in efa3ac83949d