pkgsrc-Bugs archive

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

Re: pkg/38364: Patches to allow gmp to build on IRIX



The following reply was made to PR pkg/38364; it has been noted by GNATS.

From: Stuart Shelton <srcshelton%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: pkg-manager%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/38364: Patches to allow gmp to build on IRIX
Date: Sat, 5 Apr 2008 01:51:58 +0100

 > On Fri, Apr 04, 2008 at 05:05:01PM +0000, srcshelton%gmail.com@localhost 
 > wrote:
 >> /* gmp_uint_least32_t is an unsigned integer type with at least 32  
 >> bits. */
 >> #if HAVE_UINT_LEAST32_T
 >> +#ifdef __sgi
 >> +typedef unsigned int            uint_least32_t;
 >> +#endif
 >> typedef uint_least32_t      gmp_uint_least32_t;
 >> #else
 >> #if SIZEOF_UNSIGNED_SHORT >= 4
 >
 > This looks just wrong. Why does the else part not work? Or is the type
 > used somewhere else unconditionally?
 
 'configure' checks what prototypes and symbols are defined using the  
 $CC compiler.  It then uses these results to compile code with $CXX -  
 which on IRIX is not correct.
 
 (Or, more specifically, if $CC is set to "c99" or "cc -c99" it's not  
 correct.  I'm not sure what happens if "c89" or "cc" without '-c99' in  
 CFLAGS are used...)
 
 What is happening is that configure is checking whether uint_least32_t  
 is defined for C99 code, which it is.  Then when the above code is  
 built with CC and the symbol isn't available, the build breaks.
 
 (The other alternative would be setting the variable to force  
 configure to assume that HAVE_UINT_LEAST32_T=no)
 
 Without patch, the output is:
 
 cc-1020 CC: ERROR File = ../gmp-impl.h, Line = 192
    The identifier "uint_least32_t" is undefined.
 
    typedef uint_least32_t      gmp_uint_least32_t;
            ^
 
 cc-1107 CC: WARNING File = ../gmp-impl.h, Line = 2880
    A signed bit field has a length of 1 bit.
 
          gmp_uint_least32_t sig:1;
                             ^
 
 
 >> +#ifdef __sgi
 >> +typedef char *va_list;
 >> +#endif
 >> #ifdef va_start
 >> #define _GMP_H_HAVE_VA_LIST 1
 >> #endif
 >
 > This looks wrong as well.
 
 I can't explain this one, and it's not limited to GMP.  This change  
 does solve the problem, however.  See below.
 
 
 >> @@ -516,9 +519,11 @@
 >>
 >> #if defined (__cplusplus)
 >> extern "C" {
 >> +#ifndef __sgi
 >> #ifdef _GMP_H_HAVE_FILE
 >> using std::FILE;
 >> #endif
 >> +#endif
 >> #endif
 >
 > Sounds like a miss detection, whatever sets _GMP_H_HAVE_FILE should be
 > fixed instead, I bet.
 
 If it helps, the error without the patch is:
 
 cc-1132 CC: ERROR File = ../gmp.h, Line = 520
    The namespace "std" has no member "FILE".
 
    using std::FILE;
               ^
 
 
 >> uint_least32_t is defined in <stdint.h> (which is C(99) only) but not
 >> any C++ headers.
 >
 > Your system compiler disallows including stdint.h (or inttypes.h for
 > that matter) for C++?
 
 The following headers #error out if not building C99 code (which C++  
 doesn't conform to):
 
 complex.h
 fenv.h
 stdbool.h
 stdint.h
 tgmath.h
 
 inttypes.h is valid, but doesn't define uint_least32_t.
 
 
 >> I have no idea at all why va_list has to be defined: If you don't
 >> define it, the build fails saying that va_list is an unknown
 >> identifier... but if you do define it (as above) you get a warning  
 >> that
 >> you're redefining an existing value!
 >
 > Can you check stdarg.h for conditional includes on C99 or C++?
 
 <stdarg.h> does nothing but #include <internal/stdarg_core.h>.   This  
 in turn #includes <sgidefs.h> and <internal/sgimacros.h>, before:
 
 #define _INT 0
 #define _FP  1
 #define _STRUCT 2
 
 /* Define the va_list type: */
 __SGI_LIBC_BEGIN_NAMESPACE_STD
 #ifndef _VA_LIST_
 #define _VA_LIST_
 typedef char *va_list;
 #endif /* !_VA_LIST_ */
 
 __SGI_LIBC_END_NAMESPACE_STD
 
 ... the two previous included headers do define some symbols based on  
 C99 or C++, but they're all self-contained.  I guess that means the  
 problem is related to the NAMESPACE_STD lines - but I don't fully  
 understand what these do.
 
 sgimacros.h says:
 
 
 /*   __SGI_LIBC_BEGIN_NAMESPACE_STD
   *       Begin namespace std. Does nothing unless this is C++ and we're
   *       putting the C library into std.
   */
 #if defined(__cplusplus) && defined(_LIBC_IN_NAMESPACE_STD_)
 #  define  __SGI_LIBC_BEGIN_NAMESPACE_STD namespace std {
 #  define  __SGI_LIBC_END_NAMESPACE_STD }
 #else /* defined(__cplusplus) && defined(_LIBC_IN_NAMESPACE_STD_) */
 #  define  __SGI_LIBC_BEGIN_NAMESPACE_STD
 #  define  __SGI_LIBC_END_NAMESPACE_STD
 #endif /* defined(__cplusplus) && defined(_LIBC_IN_NAMESPACE_STD_) */
 
 What I don't understand, as I mentioned, is that either va_list seems  
 undefined if not explicitly declared, but if it is declared then a  
 warning about redefinition is output.  Is this a namespace issue?
 


Home | Main Index | Thread Index | Old Index