help-gnutls
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gnutls] Re: duplicate symbols complaint on Mac OS X 10.5.2


From: Ludovic Courtès
Subject: [Help-gnutls] Re: duplicate symbols complaint on Mac OS X 10.5.2
Date: Wed, 19 Mar 2008 16:55:16 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi,

Simon Josefsson <address@hidden> writes:

> I have some vague memory about reading that the semantics of 'inline'
> has changed recently.  If you don't mark inline functions static, they
> will be exported as well, because they may be needed in other files.
> That would explain this problem.  I may be remembering incorrectly, but
> it may be that this new behaviour is actually correct.

GMP must be using "extern inline", whose C99 semantics may be different
from the original GCC semantics (though I don't recall the details).

Anyway, I see that GnuTLS is now compiled with `-std=c99', which may be
the reason for the semantic change.  In particular, for libguile, I see
a number of inline-related warnings, which did not show up earlier:

  .../libguile/inline.h:80: warning: C99 inline functions are not supported; 
using GNU89

This would suggest that GCC was able to automagically detect that
libguile isn't C99-aware, which it failed to do for GMP.

> I can't find this symbol in the GnuTLS sources, so I would suspect it is
> used in Guile?

It's from GMP, the GNU Multiple Precision arithmetic library
(http://gmplib.org), a dependency of Guile.

This should probably be reported as a GMP issue.  GMP should add some
C99 feature tests to adjust its use of "inline"---the easiest solution
being to use the `gnu_inline' attribute, but that won't fix things for
non-GCC C99 compilers.  Same for Guile.

> This reminds me, there is a bunch of warnings about use of inline
> functions in the gnutls-guile code, such as:
>
> core.c:1335: warning: function ‘set_certificate_file’ can never be inlined 
> because it uses alloca (override using the always_inline attribute)
> core.c:1335: warning: inlining failed in call to ‘set_certificate_file’: 
> function not inlinable

That's a mistake on my side: it shouldn't be inline since it uses
`alloca ()'.

I just pushed the two attached patches to `master' (I'll let you apply
them to whatever other branch may need it :-)).  The first one addresses
your warning, while the second one add `-fgnu89-inline' which should fix
both the warnings I'm seeing here (shown above) and David's compilation
problem.

David: can you confirm?  (You don't even have to apply the patch, you
can just try compiling the `guile' directory with
"make CFLAGS=-fgnu89-inline" I think.)

Thanks,
Ludovic.

>From a795ac92df35e5bf43ad53e422b2435b457ffdca Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
Date: Wed, 19 Mar 2008 16:44:38 +0100
Subject: [PATCH] guile: Don't declare `inline' functions that use `alloca ()'.

* guile/src/core.c (set_certificate_file): Remove `inline' keyword.
---
 guile/src/core.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/guile/src/core.c b/guile/src/core.c
index 217cced..ca544d4 100644
--- a/guile/src/core.c
+++ b/guile/src/core.c
@@ -1,5 +1,5 @@
 /* GNUTLS --- Guile bindings for GnuTLS.
-   Copyright (C) 2007  Free Software Foundation
+   Copyright (C) 2007, 2008  Free Software Foundation
 
    GNUTLS is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
    License along with GNUTLS; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA  */
 
-/* Written by Ludovic Courtès <address@hidden>.  */
+/* Written by Ludovic Courtès <address@hidden>.  */
 
 #include <stdio.h>
 #include <string.h>
@@ -1327,7 +1327,7 @@ typedef int (* certificate_set_data_function_t) 
(gnutls_certificate_credentials_
                                                 gnutls_x509_crt_fmt_t);
 
 /* Helper function to implement the `set-file!' functions.  */
-static inline unsigned int
+static unsigned int
 set_certificate_file (certificate_set_file_function_t set_file,
                      SCM cred, SCM file, SCM format,
                      const char *func_name)
-- 
1.5.4.4

>From 0617580c7ee165ec3a5dbe8fb00df316efc3cee9 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
Date: Wed, 19 Mar 2008 16:50:20 +0100
Subject: [PATCH] guile: Compile with `-fgnu89-inline'.

* guile/src/Makefile.am (AM_CFLAGS): Add `-fgnu89-inline' when
  `HAVE_GCC' is true.  This works around the fact that GnuTLS is
  compiled with `-std=c99', while Guile and GMP expect GNU inline
  semantics, which defer from C99 inline semantics.
---
 guile/src/Makefile.am |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/guile/src/Makefile.am b/guile/src/Makefile.am
index c3b6d8a..f50b5c2 100644
--- a/guile/src/Makefile.am
+++ b/guile/src/Makefile.am
@@ -68,6 +68,9 @@ if HAVE_GCC
 # after `-Ws-p'.
 AM_CFLAGS += -Wno-strict-prototypes
 
+# Guile and GMP currently rely on GNU inline semantics, not C99 inline.
+AM_CFLAGS += -fgnu89-inline
+
 endif
 
 enums.h: $(srcdir)/make-enum-header.scm
-- 
1.5.4.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]