freetds 1.00.27,1 fails with In file included from tls.c:56: ../../include/freetds/alloca.h:5:10: warning: 'alloca' macro redefined # define alloca __builtin_alloca ^ /usr/include/stdlib.h:247:9: note: previous definition is here #define alloca(sz) __builtin_alloca(sz) ^ tls.c:107:33: warning: implicit declaration of function 'BIO_get_data' is invalid in C99 [-Wimplicit-function-declaration] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:101:17: note: expanded from macro 'SSL_PTR' #define SSL_PTR BIO_get_data(bio) ^ tls.c:107:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:138:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:150:24: warning: cast to 'TDSCONNECTION *' (aka 'struct tds_connection *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; ^ tls.c:173:24: warning: cast to 'TDSCONNECTION *' (aka 'struct tds_connection *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; ^ tls.c:575:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) BIO_get_data(b); ^ tls.c:635:28: warning: implicit declaration of function 'BIO_meth_new' is invalid in C99 [-Wimplicit-function-declaration] tds_method_login = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ tls.c:635:26: warning: incompatible integer to pointer conversion assigning to 'BIO_METHOD *' (aka 'struct bio_method_st *') from 'int' [-Wint-conversion] tds_method_login = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:636:2: warning: implicit declaration of function 'BIO_meth_set_write' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_write(meth, tds_push_func_login); ^ tls.c:637:2: warning: implicit declaration of function 'BIO_meth_set_read' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_read(meth, tds_pull_func_login); ^ tls.c:638:2: warning: implicit declaration of function 'BIO_meth_set_ctrl' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_ctrl(meth, tds_ssl_ctrl_login); ^ tls.c:639:2: warning: implicit declaration of function 'BIO_meth_set_destroy' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_destroy(meth, tds_ssl_free); ^ tls.c:641:20: warning: incompatible integer to pointer conversion assigning to 'BIO_METHOD *' (aka 'struct bio_method_st *') from 'int' [-Wint-conversion] tds_method = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:651:2: warning: implicit declaration of function 'BIO_meth_free' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_free(tds_method_login); ^ tls.c:923:2: warning: implicit declaration of function 'BIO_set_init' is invalid in C99 [-Wimplicit-function-declaration] BIO_set_init(b, 1); ^ tls.c:924:2: warning: implicit declaration of function 'BIO_set_data' is invalid in C99 [-Wimplicit-function-declaration] BIO_set_data(b, tds); ^ tls.c:946:55: error: use of undeclared identifier 'TLS_ST_OK' ret = SSL_connect(con) != 1 || SS
I tried to change src/tds/tlc.c /* some compatibility layer */ -#if OPENSSL_VERSION_NUMBER < 0x1010000FL +#if OPENSSL_VERSION_NUMBER < 0x1010000FL || LIBRESSL_VERSION_NUMBER static inline void BIO_set_init(BIO *b, int init) { @@ -590,7 +594,7 @@ tds_ssl_free(BIO *a) return 1; } -#if OPENSSL_VERSION_NUMBER < 0x1010000FL +#if OPENSSL_VERSION_NUMBER < 0x1010000FL || LIBRESSL_VERSION_NUMBER static BIO_METHOD tds_method_login[1] = { { BIO_TYPE_MEM, but this throws: ./.libs/libtdssrv.a(sec_negotiate.o): In function `tds5_negotiate_handle_next': sec_negotiate.c:(.text+0x218): undefined reference to `RSA_get0_key' cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[4]: *** [Makefile:433: tdssrv] Error 1 gmake[4]: Leaving directory '/ram/usr/ports/databases/freetds/work/freetds-1.00.27/src/server' gmake[3]: *** [Makefile:420: all-recursive] Error 1 gmake[3]: Leaving directory '/ram/usr/ports/databases/freetds/work/freetds-1.00.27/src' gmake[2]: *** [Makefile:461: all-recursive] Error 1 gmake[2]: Leaving directory '/ram/usr/ports/databases/freetds/work/freetds-1.00.27' ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1
It is the include of in src/tds/sec_negotiate.c: 42 #ifdef HAVE_GNUTLS 43 # include "sec_negotiate_gnutls.h" 44 #elif defined(HAVE_OPENSSL) 45 # include "sec_negotiate_openssl.h" 46 #endif (but I don't find the right condition).
Created attachment 180521 [details] proposed-svn-diff_freetds
I found a related issue here: http://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/201958.html where libressl defines a version of openssl that it does not support. Using their solution with the redefining OPENSSL_VERSION seems to work and also fixing for the lower version of OpenSSL see: https://github.com/PowerDNS/pdns/issues/4338 No testing done here, just a successful build with the patches.
Created attachment 180568 [details] Redefine OPENSSL version in tls.c See http://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/201958.html https://github.com/PowerDNS/pdns/issues/4338
Created attachment 180569 [details] Redefine OPENSSL_VERSION in header file
This is working, thanks.
is this going to be fixed / committed?
Ping
@Rob, it would be great if you could combine the individual patches into a single patch (diff) against the port itself (rather than just the sources). You can do this using the instructions (make makepatch) found here: https://www.freebsd.org/doc/en/books/porters-handbook/slow-patch.html This will create the appropriate files/patch-* files in the port directory Additionally, this issue should have been assigned to the maintainer, but wasn't, though I can't immediately see why not.
A commit references this bug: Author: bofh Date: Sat Apr 8 22:23:20 UTC 2017 New revision: 438072 URL: https://svnweb.freebsd.org/changeset/ports/438072 Log: databases/freetds: Fix build with libressl PR: 217549 Submitted by: w.schwarzenfeld@utanet.at Changes: head/databases/freetds/Makefile head/databases/freetds/files/patch-src_tds_sec_negotiate_openssl.h head/databases/freetds/files/patch-src_tds_tls.c
Fixed? I don't think so. libtool: compile: cc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/local/include -DLIBICONV_PLUG -DUNIXODBC -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/local/include -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wpointer-arith -D_THREAD_SAFE -O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include -Wdeclaration-after-statement -MT tls.lo -MD -MP -MF .deps/tls.Tpo -c tls.c -fPIC -DPIC -o .libs/tls.o In file included from tls.c:60: ../../include/freetds/alloca.h:5:10: warning: 'alloca' macro redefined # define alloca __builtin_alloca ^ /usr/include/stdlib.h:247:9: note: previous definition is here #define alloca(sz) __builtin_alloca(sz) ^ tls.c:111:33: warning: implicit declaration of function 'BIO_get_data' is invalid in C99 [-Wimplicit-function-declaration] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:105:17: note: expanded from macro 'SSL_PTR' #define SSL_PTR BIO_get_data(bio) ^ tls.c:111:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:142:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; ^ tls.c:154:24: warning: cast to 'TDSCONNECTION *' (aka 'struct tds_connection *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; ^ tls.c:177:24: warning: cast to 'TDSCONNECTION *' (aka 'struct tds_connection *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; ^ tls.c:579:19: warning: cast to 'TDSSOCKET *' (aka 'struct tds_socket *') from smaller integer type 'int' [-Wint-to-pointer-cast] TDSSOCKET *tds = (TDSSOCKET *) BIO_get_data(b); ^ tls.c:639:28: warning: implicit declaration of function 'BIO_meth_new' is invalid in C99 [-Wimplicit-function-declaration] tds_method_login = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ tls.c:639:26: warning: incompatible integer to pointer conversion assigning to 'BIO_METHOD *' (aka 'struct bio_method_st *') from 'int' [-Wint-conversion] tds_method_login = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:640:2: warning: implicit declaration of function 'BIO_meth_set_write' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_write(meth, tds_push_func_login); ^ tls.c:641:2: warning: implicit declaration of function 'BIO_meth_set_read' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_read(meth, tds_pull_func_login); ^ tls.c:642:2: warning: implicit declaration of function 'BIO_meth_set_ctrl' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_ctrl(meth, tds_ssl_ctrl_login); ^ tls.c:643:2: warning: implicit declaration of function 'BIO_meth_set_destroy' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_set_destroy(meth, tds_ssl_free); ^ tls.c:645:20: warning: incompatible integer to pointer conversion assigning to 'BIO_METHOD *' (aka 'struct bio_method_st *') from 'int' [-Wint-conversion] tds_method = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:655:2: warning: implicit declaration of function 'BIO_meth_free' is invalid in C99 [-Wimplicit-function-declaration] BIO_meth_free(tds_method_login); ^ tls.c:927:2: warning: implicit declaration of function 'BIO_set_init' is invalid in C99 [-Wimplicit-function-declaration] BIO_set_init(b, 1); ^ tls.c:928:2: warning: implicit declaration of function 'BIO_set_data' is invalid in C99 [-Wimplicit-function-declaration] BIO_set_data(b, tds); ^ tls.c:950:55: error: use of undeclared identifier 'TLS_ST_OK' ret = SSL_connect(con) != 1 || SSL_get_state(con) != TLS_ST_OK; ^ 17 warnings and 1 error generated. gmake[5]: *** [Makefile:551: tls.lo] Error 1 gmake[5]: Leaving directory '/wrkdirs/usr/ports/databases/freetds/work/freetds-1.00.27/src/tds' gmake[4]: *** [Makefile:571: all-recursive] Error 1 gmake[4]: Leaving directory '/wrkdirs/usr/ports/databases/freetds/work/freetds-1.00.27/src/tds' gmake[3]: *** [Makefile:445: all] Error 2 gmake[3]: Leaving directory '/wrkdirs/usr/ports/databases/freetds/work/freetds-1.00.27/src/tds' gmake[2]: *** [Makefile:420: all-recursive] Error 1 gmake[2]: Leaving directory '/wrkdirs/usr/ports/databases/freetds/work/freetds-1.00.27/src' gmake[1]: *** [Makefile:461: all-recursive] Error 1 gmake[1]: Leaving directory '/wrkdirs/usr/ports/databases/freetds/work/freetds-1.00.27' *** Error code 1 Stop. make: stopped in /usr/ports/databases/freetds