bug-gnulib
[Top][All Lists]
Advanced

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

Re: Problem detecting libsigsegv on gawk 4.0.0 on Solaris 9 Sparc w/Sun


From: Bruno Haible
Subject: Re: Problem detecting libsigsegv on gawk 4.0.0 on Solaris 9 Sparc w/Sun Studio 12
Date: Sat, 2 Jul 2011 13:56:47 +0200
User-agent: KMail/1.9.9

[CCing bug-libsigsegv. This is a reply to
<http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00008.html>].

Dagobert Michelsen wrote:
> I am trying to compile gawk 4.0.0 on Solaris 9 Sparc with Sun Studio 12 and
> noticed that the presence of libsigsegv is not properly detected:
> 
> > configure:9825: checking for libsigsegv
> > configure:9847: /opt/SUNWspro/bin/cc -o conftest -xO3 -m32 -xarch=386 -Xc 
> > -I/opt/csw/include -m32 -xarch=386 -L/opt/csw/lib conftest.c 
> > /opt/csw/lib/libsigsegv.so -R/opt/csw/lib -lm  >&5
> > "/usr/include/ia32/sys/reg.h", line 297: syntax error before or at: uint64_t
> 
> 
> This is due to a missing include in the detection code as a definition of 
> uint64_t
> is missing. This could be solved by including inttypes.h in the testcode.
> 
> > | #define HAVE_LIBM 1
> > | /* end confdefs.h.  */
> > | #include <sigsegv.h>
> 
> #include <inttypes.h>   <- adding this works
> 
> > | int
> > | main ()
> > | {
> > | sigsegv_deinstall_handler();
> > |   ;
> > |   return 0;
> > | }
> 
> As this is the expansion of gl_LIBSIGSEGV I cc'ed bug-gnulib.

And the file <sigsegv.h> is installed by GNU libsigsegv, therefore I also CC
bug-libsiggsegv.

I reproduce this on Solaris 9 with cc, both Solaris/SPARC and Solaris/x86,
even without 'gawk' and without the gl_LIBSIGSEGV macro.

On Solaris/SPARC:

$ cat > foo.c
#include <sigsegv.h>
$ cc -O -I$HOME/prefix-solaris9-sparc-cc/include -c foo.c
$ cc -Xc -O -I$HOME/prefix-solaris9-sparc-cc/include -c foo.c    
"/usr/include/sys/ucontext.h", line 68: syntax error before or at: sigset_t
"/usr/include/ucontext.h", line 48: syntax error before or at: *
"/usr/include/ucontext.h", line 49: syntax error before or at: *
"/usr/include/ucontext.h", line 51: syntax error before or at: *
"/usr/include/ucontext.h", line 52: syntax error before or at: *
cc: acomp failed for foo.c

On Solaris/x86:

$ cat > foo.c
#include <sigsegv.h>
$ cc -O -I$HOME/prefix-x86/include -c foo.c
$ cc -Xc -O -I$HOME/prefix-x86/include -c foo.c 
"/usr/include/ia32/sys/reg.h", line 297: syntax error before or at: uint64_t
"/usr/include/sys/ucontext.h", line 67: syntax error before or at: sigset_t
"/usr/include/ucontext.h", line 48: syntax error before or at: *
"/usr/include/ucontext.h", line 49: syntax error before or at: *
"/usr/include/ucontext.h", line 51: syntax error before or at: *
"/usr/include/ucontext.h", line 52: warning: no explicit type given
"/usr/include/ucontext.h", line 52: syntax error before or at: *
cc: acomp failed for foo.c

But this error occurs also when merely including <ucontext.h> instead of
<sigsegv.h>:

On Solaris/SPARC:

$ cat > foo.c
#include <ucontext.h>
$ cc -Xc -O -c foo.c
"/usr/include/sys/ucontext.h", line 68: syntax error before or at: sigset_t
"/usr/include/ucontext.h", line 48: syntax error before or at: *
"/usr/include/ucontext.h", line 49: syntax error before or at: *
"/usr/include/ucontext.h", line 51: syntax error before or at: *
"/usr/include/ucontext.h", line 52: syntax error before or at: *
cc: acomp failed for foo.c

On Solaris/x86:

$ cat > foo.c
#include <ucontext.h>
$ cc -Xc -O -c foo.c
"/usr/include/ia32/sys/reg.h", line 297: syntax error before or at: uint64_t
"/usr/include/sys/ucontext.h", line 67: syntax error before or at: sigset_t
"/usr/include/ucontext.h", line 48: syntax error before or at: *
"/usr/include/ucontext.h", line 49: syntax error before or at: *
"/usr/include/ucontext.h", line 51: syntax error before or at: *
"/usr/include/ucontext.h", line 52: warning: no explicit type given
"/usr/include/ucontext.h", line 52: syntax error before or at: *
cc: acomp failed for foo.c

Also, look at the description of option -Xc in "man cc":

     -X[c|a|t|s]
          Specifies the degree of conformance to the ISO C stan-
          dard.  The value of -xc99 affects which version of the
          ISO C standard the -X option applies.

          c (conformance)
               Strictly conformant ISO C, without K&R C compati-
               bility extensions.  The compiler issues errors and
               warnings for programs that use non-ISO C con-
               structs.  The predefined macro __STDC__ has a
               value of 1 with the -Xc option.

Conclusion: The use of option -Xc effectively removes <ucontext.h> from the
set of available header files. This is expected because in -Xc mode, only ISO C
headers should be available.

But <sigsegv.h> relies on <ucontext.h>, for the definition of some types;
<sigsegv.h> does not include <ucontext.h> for nothing. If <ucontext.h> is
unavailable, <sigsegv.h> is unavailable, and the gl_LIBSIGSEGV macro detected
this correctly.

In summary:
  - It is not a bug in Solaris cc, because <ucontext.h> is assumed to be
    unavailable when compiling with -Xc.
  - It is not a bug in GNU libsigsegv, because you need features of POSIX
    outside ISO C to implement catching SIGSEGV.
  - It is not a bug in gnulib, because the gl_LIBSIGSEGV macro detects that
    <sigsegv.h> is unavailable.
  - If you want that gawk makes use of libsigsegv, simply don't use -Xc.
    If I configure gawk with
       $ ./configure --prefix=$HOME/prefix-solaris9-sparc-cc CC="cc -O 
-D__STDC__"
    then libsigsegv is found and used, and I get a gawk program that is linked
    against libsigsegv:

    $ nm gawk | grep sigsegv
    [1216]  |    437052|      48|FUNC |GLOB |0    |9      
|sigsegv_deinstall_handler
    [1116]  |    438380|    1100|FUNC |GLOB |0    |9      |sigsegv_get_vma
    [659]   |    436320|     380|FUNC |LOCL |0    |9      |sigsegv_handler
    [802]   |    437024|      28|FUNC |GLOB |0    |9      
|sigsegv_install_handler
    [1391]  |    437100|      36|FUNC |GLOB |0    |9      |sigsegv_leave_handler
    [1044]  |    439480|      60|FUNC |GLOB |0    |9      
|sigsegv_reset_onstack_flag

Bruno
-- 
In memoriam Andrés Escobar <http://en.wikipedia.org/wiki/Andrés_Escobar>



reply via email to

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