From: Martin Storsjo Date: Mon, 21 Jan 2013 14:00:10 +0000 (+0200) Subject: Define _gnutls_file_mutex in gnutls_global.c instead of in verify-tofu.c X-Git-Tag: gnutls_3_1_7~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61a3d27b118db4d6f97085eeaaa54f56caa2e9cd;p=thirdparty%2Fgnutls.git Define _gnutls_file_mutex in gnutls_global.c instead of in verify-tofu.c This fixes issues with linking the tools on OS X if not building shared libraries. Currently, if building with --disable-shared on OS X, the build fails with: CCLD gnutls-serv Undefined symbols for architecture x86_64: "__gnutls_file_mutex", referenced from: _gnutls_global_deinit in libgnutls.a(gnutls_global.o) _gnutls_global_init in libgnutls.a(gnutls_global.o) ld: symbol(s) not found for architecture x86_64 It seems that the linker fails to pull in verify-tofu.o to satisfy the undefined reference to _gnutls_file_mutex.o in gnutls_global.o unless gnutls_global.o (or any other object file in the link) also calls functions that pulls in verify-tofu.o. Since gnutls_global.o always is linked in, but verify-tofu.o can be left out unless someone calls the functions in it, defining the mutex in gnutls_global.c makes sense and simplifies the dependencies. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index 295e6201d1..1959bd315a 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -42,7 +42,7 @@ /* created by asn1c */ extern const ASN1_ARRAY_TYPE gnutls_asn1_tab[]; extern const ASN1_ARRAY_TYPE pkix_asn1_tab[]; -extern void *_gnutls_file_mutex; +void *_gnutls_file_mutex; ASN1_TYPE _gnutls_pkix1_asn; ASN1_TYPE _gnutls_gnutls_asn; diff --git a/lib/verify-tofu.c b/lib/verify-tofu.c index 3592395803..4c19c90bc7 100644 --- a/lib/verify-tofu.c +++ b/lib/verify-tofu.c @@ -60,7 +60,7 @@ int store_pubkey(const char* db_name, const char* host, static int find_config_file(char* file, size_t max_size); #define MAX_FILENAME 512 -void *_gnutls_file_mutex; +extern void *_gnutls_file_mutex; struct gnutls_tdb_int default_tdb = { store_pubkey,