On 03/11/16 16:14, Olga Krishtal wrote:
In case when we use any crypt library and gnutls make returns
compilation errors.
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/libvirt.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 52462e3..77365d1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -269,7 +269,7 @@ virWinsockInit(void)
}
#endif
-
+#ifdef WITH_GNUTLS
#ifdef WITH_GNUTLS_GCRYPT
static int
virTLSMutexInit(void **priv)
@@ -332,6 +332,7 @@ static struct gcry_thread_cbs virTLSThreadImpl = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
#endif /* WITH_GNUTLS_GCRYPT */
+#endif /* WITH_GNUTLS */
static bool virGlobalError;
@@ -357,6 +358,7 @@ virGlobalInit(void)
}
#endif
+#ifdef WITH_GNUTLS
#ifdef WITH_GNUTLS_GCRYPT
/*
* This sequence of API calls it copied exactly from
@@ -371,13 +373,10 @@ virGlobalInit(void)
gcry_control(GCRYCTL_DISABLE_SECMEM, NULL, 0);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
-#endif
-
- virLogSetFromEnv();
-
-#ifdef WITH_GNUTLS
+#endif /* End of WITH_GNUTLS_GCRYPT*/
virNetTLSInit();
-#endif
+#endif /* End of WITH_GNUTLS*/
+ virLogSetFromEnv();
#if WITH_CURL
curl_global_init(CURL_GLOBAL_DEFAULT);
Error message:
libvirt.c:320:15: error: variable 'virTLSThreadImpl' has initializer but
incomplete type
static struct gcry_thread_cbs virTLSThreadImpl = {
^
libvirt.c:325:5: error: 'GCRY_THREAD_OPTION_PTHREAD' undeclared here
(not in a function)
GCRY_THREAD_OPTION_PTHREAD,
^
libvirt.c:325:5: error: excess elements in struct initializer [-Werror]
libvirt.c:325:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:327:5: error: excess elements in struct initializer [-Werror]
NULL,
^
libvirt.c:327:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:328:5: error: excess elements in struct initializer [-Werror]
virTLSMutexInit,
^
libvirt.c:328:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:329:5: error: excess elements in struct initializer [-Werror]
virTLSMutexDestroy,
^
libvirt.c:329:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:330:5: error: excess elements in struct initializer [-Werror]
virTLSMutexLock,
^
libvirt.c:330:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:331:5: error: excess elements in struct initializer [-Werror]
virTLSMutexUnlock,
^
libvirt.c:331:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
^
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:332:5: error: excess elements in struct initializer [-Werror]
libvirt.c:332:5: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c:333:1: error: excess elements in struct initializer [-Werror]
};
^
libvirt.c:333:1: error: (near initialization for 'virTLSThreadImpl')
[-Werror]
libvirt.c: In function 'virGlobalInit':
libvirt.c:367:5: error: implicit declaration of function 'gcry_control'
[-Werror=implicit-function-declaration]
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) {
^
libvirt.c:367:5: error: nested extern declaration of 'gcry_control'
[-Werror=nested-externs]
libvirt.c:367:22: error: 'GCRYCTL_ANY_INITIALIZATION_P' undeclared
(first use in this function)
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) {
^
libvirt.c:367:22: note: each undeclared identifier is reported only once
for each function it appears in
libvirt.c:368:22: error: 'GCRYCTL_SET_THREAD_CBS' undeclared (first use
in this function)
gcry_control(GCRYCTL_SET_THREAD_CBS, &virTLSThreadImpl);
^
libvirt.c:369:9: error: implicit declaration of function
'gcry_check_version' [-Werror=implicit-function-declaration]
gcry_check_version(NULL);
^
libvirt.c:369:9: error: nested extern declaration of
'gcry_check_version' [-Werror=nested-externs]
libvirt.c:371:22: error: 'GCRYCTL_DISABLE_SECMEM' undeclared (first use
in this function)
gcry_control(GCRYCTL_DISABLE_SECMEM, NULL, 0);
^
libvirt.c:372:22: error: 'GCRYCTL_INITIALIZATION_FINISHED' undeclared
(first use in this function)
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
--
Best regards,
Olga