Problem with int types persists on nettle 2.4 and gnutls 3.0.19 on Solaris 9 Sparc

Niels Möller nisse at lysator.liu.se
Fri Apr 27 14:54:48 CEST 2012


Dagobert Michelsen <dam at opencsw.org> writes:

> I just verified that the problem persists with nettle 2.4 and gnutls-3.0.19. As you seem to have
> access to the Solaris buildfarm it would be cool if you could finally fix this as it blocks
> new releases of gnutls for the OpenCSW distribution.

It's some time since I looked in to this. My understaning of the problem
is that

1. This Solaris version lack both <stdint.h> and <inttypes.h>. (A
   comment in AX_CREATE_STDINT_H seems to imply that it does have a
   <sys/inttypes.h>, should we use that?)

2. Nettle defines uint32_t and friends using the AX_CREATE_STDINT_H
   autoconf macro.

3. gnulib defines them in a different way.

4. The multiple definitions of, e.g., uint32_t, agree and are no
   problem.

5. The definitions of some other (unused) types are incompatible, e.g.,
   int_fast8_t, and cause the compilation errors.

6. The definitions from AX_CREATE_STDINT_H is compatible with the
   definitions of these types in Solaris 10. gnulib's definitions
   aren't, so any code using them can potentially break if linked
   together with code compiled on Solaris 10.

Hence I think it ought to be fixed in gnulib. Simon (and any other
gnulib people on these lists), do you agree?

To address (1), maybe you can try

diff --git a/configure.ac b/configure.ac
index 6bf2b8b..77bb9b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -518,7 +518,7 @@ LSH_GCC_ATTRIBUTES
 
 # According to Simon Josefsson, looking for uint32_t and friends in
 # sys/types.h is needed on some systems, in particular cygwin.
-AX_CREATE_STDINT_H([nettle-stdint.h], [sys/types.h])
+AX_CREATE_STDINT_H([nettle-stdint.h], [sys/types.h], [sys/inttypes.h])
 
 # Check for file locking. We (AC_PROG_CC?) have already checked for
 # sys/types.h and unistd.h.

but I suspect you would still get compilation errors due to incompatible
definitions in gnulib and sys/inttypes.h.

Maybe the easiest nettle workaround would be to somehow disable the
definitions of the problematic types, which we don't use anyway.

Could you try something like the following?

diff --git a/nettle-types.h b/nettle-types.h
index b694332..d0aa332 100644
--- a/nettle-types.h
+++ b/nettle-types.h
@@ -23,6 +23,9 @@
 #ifndef NETTLE_TYPES_H
 #define NETTLE_TYPES_H
 
+/* Pretend this type always exists. Nettle doesn't use it. */
+#define _STDINT_HAVE_INT_FAST32_T 1
+
 #include "nettle-stdint.h"
 
 #ifdef __cplusplus

Have a look into the generated nettle-stdint.h (or the template in
aclocal.m4) for other potentially useful defines.

The closest Solaris 5.8 box I used to have acccess to
(hanna.lysator.liu.se) seems to have been decomissioned.

Regardss,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




More information about the Gnutls-devel mailing list