zubairhamed / canopus

CoAP Client/Server implementing RFC 7252 for the Go Language
Apache License 2.0
155 stars 41 forks source link

Multiple cgo warnings and undefined references #83

Open stanier opened 7 years ago

stanier commented 7 years ago

When following the instructions supplied in the repository, I am getting numerous errors relating to cgo compilation. I've tried removing individual CFLAGs, yielding the same result each time. This leads me to believe that CFLAGs either do not gag their corresponding warnings or that they are being ignored in compilation altogether.

Past the warnings, I'm getting multiple build errors related to undefined references.

 github.com/zubairhamed/canopus
In file included from $WORK/github.com/zubairhamed/canopus/_obj/_cgo_export.c:3:0:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go: In function ‘psk_callback’:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:145:29: warning: passing argument 2 of ‘go_psk_callback’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  return go_psk_callback(ssl,hint,identity,max_identity_len,(char*)psk,max_psk_len);
                             ^~~~
In file included from $WORK/github.com/zubairhamed/canopus/_obj/_cgo_export.c:3:0:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:104:21: note: expected ‘char *’ but argument is of type ‘const char *’
 extern unsigned int go_psk_callback(SSL *ssl, char *hint, char *identity, unsigned int max_identity_len, char *psk, unsigned int max_psk_len);
                     ^~~~~~~~~~~~~~~
# github.com/zubairhamed/canopus
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go: In function ‘psk_callback’:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:145:29: warning: passing argument 2 of ‘go_psk_callback’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  return go_psk_callback(ssl,hint,identity,max_identity_len,(char*)psk,max_psk_len);
                             ^~~~
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:104:21: note: expected ‘char *’ but argument is of type ‘const char *’
 extern unsigned int go_psk_callback(SSL *ssl, char *hint, char *identity, unsigned int max_identity_len, char *psk, unsigned int max_psk_len);
                     ^~~~~~~~~~~~~~~
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go: In function ‘_cgo_81a35f110302_Cfunc_DTLSv1_2_client_method’:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:340:2: warning: ‘DTLSv1_2_client_method’ is deprecated [-Wdeprecated-declarations]

  ^
In file included from /home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ct.h:13:0,
                 from /home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ssl.h:61,
                 from /home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:10:
/home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ssl.h:1643:45: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) /* DTLSv1.2 */
                                             ^
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go: In function ‘_cgo_81a35f110302_Cfunc_DTLSv1_2_server_method’:
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:356:2: warning: ‘DTLSv1_2_server_method’ is deprecated [-Wdeprecated-declarations]
   return ""
  ^
In file included from /home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ct.h:13:0,
                 from /home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ssl.h:61,
                 from /home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:10:
/home/keyton/go/src/github.com/zubairhamed/canopus/openssl/include/openssl/ssl.h:1642:45: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) /* DTLSv1.2 */
                                             ^
# github.com/zubairhamed/canopus
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/_cgo_main.o:(.data.rel+0x0): undefined reference to `DTLSv1_listen'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `go_bio_create':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:114: undefined reference to `BIO_set_init'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_BIO_get_data':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:201: undefined reference to `BIO_get_data'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_BIO_get_shutdown':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:219: undefined reference to `BIO_get_shutdown'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_DTLSv1_2_client_method':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:340: undefined reference to `DTLSv1_2_client_method'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_DTLSv1_2_server_method':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:356: undefined reference to `DTLSv1_2_server_method'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `init_lib':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:56: undefined reference to `OPENSSL_init_ssl'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `init_session_bio_method':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:62: undefined reference to `BIO_meth_new'
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:63: undefined reference to `BIO_meth_set_write'
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:64: undefined reference to `BIO_meth_set_read'
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:65: undefined reference to `BIO_meth_set_ctrl'
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:66: undefined reference to `BIO_meth_set_create'
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:67: undefined reference to `BIO_meth_set_destroy'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_BIO_set_data':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:283: undefined reference to `BIO_set_data'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `_cgo_81a35f110302_Cfunc_BIO_set_init':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:311: undefined reference to `BIO_set_init'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `init_lib':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:58: undefined reference to `OPENSSL_init_ssl'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `setGoClientId':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:156: undefined reference to `BIO_set_data'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `setGoSessionId':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:97: undefined reference to `BIO_set_data'
/tmp/go-build200340458/github.com/zubairhamed/canopus/_obj/dtls.cgo2.o: In function `set_cookie_option':
/home/keyton/go/src/github.com/zubairhamed/canopus/dtls.go:87: undefined reference to `SSL_set_options'

I'm not sure if this is an issue caused by my negligence or if there is something wrong with the build? My versions are as follow: