~sircmpwn/gmni-discuss

2 2

compiling gmnisrv w/ gcc 5.4 -> implicit declarations and int casting errors

Details
Message ID
<20201130021150.GI3045938@tilde.club>
DKIM signature
pass
Download raw message
Hello!

I was recently attempting to compile gmnisrv and gmni
(d8f0870446c471a42612d6a8e853ad9b723a6d39 and
cb2c84b0ad9aadd4c92d8ef978c2bfca578cd3c4), and I'm continually
getting errors regarding the implicit declaration of functions
and casting of integers. Below is the build log for gmnisrv and
gmni, respectively. (make clean && make):

CC src/config.o
CC src/escape.o
CC src/ini.o
CC src/log.o
CC src/main.o
CC src/mime.o
CC src/regexp.o
CC src/serve.o
CC src/server.o
CC src/tls.o
src/tls.c: In function ‘tls_host_init’:
src/tls.c:136:30: error: implicit declaration of function ‘X509_get0_notAfter’ [-Werror=implicit-function-declaration]
  const ASN1_TIME *notAfter = X509_get0_notAfter(x509);
                              ^
src/tls.c:136:30: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
src/tls.c: In function ‘tls_init’:
src/tls.c:159:34: error: implicit declaration of function ‘TLS_server_method’ [-Werror=implicit-function-declaration]
  conf->tls.ssl_ctx = SSL_CTX_new(TLS_server_method());
                                  ^
src/tls.c:159:34: error: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Werror=int-conversion]
In file included from src/tls.c:7:0:
/usr/include/openssl/ssl.h:2131:10: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
 SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
          ^
src/tls.c:162:10: error: implicit declaration of function ‘SSL_CTX_set_min_proto_version’ [-Werror=implicit-function-declaration]
  int r = SSL_CTX_set_min_proto_version(conf->tls.ssl_ctx, TLS1_2_VERSION);
          ^
cc1: all warnings being treated as errors
Makefile:17: recipe for target 'src/tls.o' failed
make: *** [src/tls.o] Error 1

--

CC src/client.o
src/client.c: In function ‘gemini_request’:
src/client.c:133:3: error: implicit declaration of function ‘SSL_CTX_up_ref’ [-Werror=implicit-function-declaration]
   SSL_CTX_up_ref(options->ssl_ctx);
   ^
src/client.c:135:31: error: implicit declaration of function ‘TLS_method’ [-Werror=implicit-function-declaration]
   resp->ssl_ctx = SSL_CTX_new(TLS_method());
                               ^
src/client.c:135:31: error: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Werror=int-conversion]
In file included from src/client.c:6:0:
/usr/include/openssl/ssl.h:2131:10: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
 SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
          ^
src/client.c:151:11: error: implicit declaration of function ‘SSL_set1_host’ [-Werror=implicit-function-declaration]
  if ((r = SSL_set1_host(resp->ssl, host)) != 1) {
           ^
cc1: all warnings being treated as errors
Makefile:39: recipe for target 'src/client.o' failed
make: *** [src/client.o] Error 1

On my system, I'm compiling with gcc 5.4 on Ubuntu 16.04
with OpenSSL 1.0.2g. When asking about this in
#gemini@tilde.chat, one person reported the possibility
that my compiler was to blame.

Does anyone have an idea as to why these errors might
occur, and how I can go about fixing them?

Thank you,
-- 
randomuser | randomuser@tilde.club | tilde.club/~randomuser
Details
Message ID
<C7G8FZUSPS3U.3IJ254RMYLYTG@taiga>
In-Reply-To
<20201130021150.GI3045938@tilde.club> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Are you really running OpenSSL or are you running one of the several
libraries which pretends to be OpenSSL, like LibreSSL or GNUTLS?
Details
Message ID
<20201130024236.GA2046396@tilde.club>
In-Reply-To
<C7G8FZUSPS3U.3IJ254RMYLYTG@taiga> (view parent)
DKIM signature
pass
Download raw message
> Are you really running OpenSSL or are you running one of the several
> libraries which pretends to be OpenSSL, like LibreSSL or GNUTLS?

Taking this into account, I compiled and installed OpenSSL 1.1.1h.
I now ge less scary messages:

CCLD  gmni
src/client.o: In function `gemini_request':
/home/usr/gmni/src/client.c:133: undefined reference to `SSL_CTX_up_ref'
/home/usr/gmni/src/client.c:135: undefined reference to `TLS_method'
/home/usr/gmni/src/client.c:151: undefined reference to `SSL_set1_host'
src/gmni.o: In function `main':
/home/usr/gmni/src/gmni.c:225: undefined reference to `OPENSSL_init_ssl'
/home/usr/gmni/src/gmni.c:226: undefined reference to `OPENSSL_init_crypto'
/home/usr/gmni/src/gmni.c:227: undefined reference to `TLS_method'
src/tofu.o: In function `verify_callback':
/home/usr/gmni/src/tofu.c:33: undefined reference to `X509_STORE_CTX_get0_cert'
/home/usr/gmni/src/tofu.c:38: undefined reference to `X509_get0_notBefore'
/home/usr/gmni/src/tofu.c:39: undefined reference to `X509_get0_notAfter'
/home/usr/gmni/src/tofu.c:125: undefined reference to `ASN1_TIME_to_tm'
collect2: error: ld returned 1 exit status
Makefile:9: recipe for target 'gmni' failed
make: *** [gmni] Error 1

Notice that the errors refer to undefined references to the functions
mentioned previously. Not sure if this has to do with anything,
but might be helpful.

Regards,
-- 
randomuser | randomuser@tilde.club | tilde.club/~randomuser
Reply to thread Export thread (mbox)