public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
@ 2014-01-27 21:57 John Dubchak
  2014-01-27 22:20 ` Marc Glisse
  0 siblings, 1 reply; 11+ messages in thread
From: John Dubchak @ 2014-01-27 21:57 UTC (permalink / raw)
  To: gcc-help

Hi,

I apologize if this seems like a cross-post from g++-help, but that 
seems to be the wrong list for my question.

I used the following configure statement to build the latest gcc 4.8.2, 
with C++ 11 support on RedHat 6.4, which came with the default installed 
gcc 4.4.7:

../configure--prefix=/usr/local/gcc-4.8.2 \
          --program-suffix=-48 \
          --enable-bootstrap  \
	--enable-shared  \
	--enable-threads=posix \
	--enable-checking=release \
	--with-system-zlib  \
	--enable-__cxa_atexit \
	--enable-languages=c,c++  \
	--disable-multilib   \
          --with-tune=generic \
          --with-arch_32=i686 \
          --build=x86_64-redhat-linux

However, after installing it with 'make' and 'make install' and
compiling with C++11 support using:

/usr/local/gcc-4.8.2/bin/g++-48 -v -std=c++11 -c -I . -I 
./workspace/http/http-server/src -I ./jsoncpp-src-0.5.0/include -Wall 
main.cpp -o main.o

I get this error:

In file included from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
   extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
                                                      ^

Here is the code that generates the error:

#include <sys/wait.h>

static void sig_handler(int sig) {
      if (sig == SIGINT) {
          int status = 0;
          int savedErrno = errno;
          while (waitpid(-1, &status, WNOHANG) > 0)
              continue;
          errno = savedErrno;
      } else if (sig == SIGHUP) {
          int status = 0;
          int savedErrno = errno;
          while (waitpid(-1, &status, WNOHANG) > 0)
              continue;
          errno = savedErrno;
      }
}

I have spent several days on this issue and can neither identify what
causes it nor what I should to do resolve it.Ideally, I'd like to have
the gcc-4.8.2 be available as an alternative compiler on this RedHat host.

I have included the output of adding both -v and -E arguments to gcc
[1].  Any help is greatly appreciated.

Thanks,
John

[1]
$ make
g++-48 -v -std=c++11 -o ../bin/http_server main.o http_funcs.o
error_utils.o fs/fs_utils.o -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -lpthread
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/libs/libjson.a -Wall
Using built-in specs.
COLLECT_GCC=g++-48
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --program-suffix=-48
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 (GCC)
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-o' '../bin/http_server' '-I' '.'
'-I' '/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src'
'-I' '/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include' '-Wall'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
   /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/collect2 --eh-frame-hdr -m
elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
../bin/http_server
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../.. main.o http_funcs.o
error_utils.o fs/fs_utils.o -lpthread
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/libs/libjson.a -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crtn.o
[ec2-user@ip-10-234-6-159 src]$ rm main.o || true && make
g++-48 -v -std=c++11 -c -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -Wall main.cpp -o main.o
Using built-in specs.
COLLECT_GCC=g++-48
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --program-suffix=-48
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-c' '-I' '.' '-I'
'/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src' '-I'
'/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include' '-Wall' '-o'
'main.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
   /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus -quiet -v -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -D_GNU_SOURCE
main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64
-auxbase-strip main.o -Wall -std=c++11 -version -o /tmp/ccO8lGjC.s
GNU C++ (GCC) version 4.8.2 (x86_64-redhat-linux)
      compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version
2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory
"/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src"
#include "..." search starts here:
#include <...> search starts here:
   .
   /home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2
 
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/x86_64-redhat-linux
 
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/backward
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
   /usr/local/include
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include-fixed
   /usr/include
End of search list.
GNU C++ (GCC) version 4.8.2 (x86_64-redhat-linux)
      compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version
2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1546ef0d67f553d18b0c7aa67816401f
In file included from http_server_signals.hpp:12:0,
                   from http_server.hpp:21,
                   from http_service_traits.hpp:15,
                   from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
   extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
                                                      ^
make: *** [main.o] Error 1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-27 21:57 Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4 John Dubchak
@ 2014-01-27 22:20 ` Marc Glisse
  2014-01-27 22:39   ` John Dubchak
  0 siblings, 1 reply; 11+ messages in thread
From: Marc Glisse @ 2014-01-27 22:20 UTC (permalink / raw)
  To: John Dubchak; +Cc: gcc-help

On Mon, 27 Jan 2014, John Dubchak wrote:

> However, after installing it with 'make' and 'make install' and
> compiling with C++11 support using:
>
> /usr/local/gcc-4.8.2/bin/g++-48 -v -std=c++11 -c -I . -I 
> ./workspace/http/http-server/src -I ./jsoncpp-src-0.5.0/include -Wall 
> main.cpp -o main.o
>
> I get this error:
>
> In file included from main.cpp:14:
> /usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
>  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
>                                                     ^
>
> Here is the code that generates the error:
>
> #include <sys/wait.h>

man waitpid

SYNOPSIS
        #include <sys/types.h>
        #include <sys/wait.h>

Did you try that?

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-27 22:20 ` Marc Glisse
@ 2014-01-27 22:39   ` John Dubchak
  2014-01-27 22:44     ` Jonathan Wakely
  0 siblings, 1 reply; 11+ messages in thread
From: John Dubchak @ 2014-01-27 22:39 UTC (permalink / raw)
  To: gcc-help

On 1/27/14 2:20 PM, Marc Glisse wrote:
> On Mon, 27 Jan 2014, John Dubchak wrote:
>
>> However, after installing it with 'make' and 'make install' and
>> compiling with C++11 support using:
>>
>> /usr/local/gcc-4.8.2/bin/g++-48 -v -std=c++11 -c -I . -I
>> ./workspace/http/http-server/src -I ./jsoncpp-src-0.5.0/include -Wall
>> main.cpp -o main.o
>>
>> I get this error:
>>
>> In file included from main.cpp:14:
>> /usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
>>  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
>>                                                     ^
>>
>> Here is the code that generates the error:
>>
>> #include <sys/wait.h>
>
> man waitpid
>
> SYNOPSIS
>         #include <sys/types.h>
>         #include <sys/wait.h>
>
> Did you try that?
>

Thanks for your reply, Marc.  Yes, I have tried that as well.  Here are 
the headers I am including:

#include <cerrno>
#include <sys/types.h>
#include <sys/wait.h>

The error persists:

In file included from http_server_signals.hpp:12:0,
                  from http_server.hpp:21,
                  from http_service_traits.hpp:15,
                  from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: ‘siginfo_t’ has not been declared
  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,

Thanks,
John


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-27 22:39   ` John Dubchak
@ 2014-01-27 22:44     ` Jonathan Wakely
       [not found]       ` <52E6E3CB.3050503@johndubchak.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2014-01-27 22:44 UTC (permalink / raw)
  To: John Dubchak; +Cc: gcc-help

On 27 January 2014 22:39, John Dubchak <lists@johndubchak.com> wrote:
> On 1/27/14 2:20 PM, Marc Glisse wrote:
>>
>> On Mon, 27 Jan 2014, John Dubchak wrote:
>>
>>> However, after installing it with 'make' and 'make install' and
>>> compiling with C++11 support using:
>>>
>>> /usr/local/gcc-4.8.2/bin/g++-48 -v -std=c++11 -c -I . -I
>>> ./workspace/http/http-server/src -I ./jsoncpp-src-0.5.0/include -Wall
>>> main.cpp -o main.o
>>>
>>> I get this error:
>>>
>>> In file included from main.cpp:14:
>>> /usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
>>>  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
>>>                                                     ^
>>>
>>> Here is the code that generates the error:
>>>
>>> #include <sys/wait.h>
>>
>>
>> man waitpid
>>
>> SYNOPSIS
>>         #include <sys/types.h>
>>         #include <sys/wait.h>
>>
>> Did you try that?
>>
>
> Thanks for your reply, Marc.  Yes, I have tried that as well.  Here are the
> headers I am including:
>
> #include <cerrno>
> #include <sys/types.h>
> #include <sys/wait.h>
>
> The error persists:
>
>
> In file included from http_server_signals.hpp:12:0,
>                  from http_server.hpp:21,
>                  from http_service_traits.hpp:15,
>                  from main.cpp:14:
> /usr/include/sys/wait.h:155:52: error: ‘siginfo_t’ has not been declared
>  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,

siginfo_t should be declared by <bits/siginfo.h> which is included
from <signal.h>

You probably have another file in your search paths called signal.h
which is being included instead of /usr/include/signal.h

Look through the output of preprocessing (use the -E option to g++)
and see what headers are being included, and if they are the right
ones.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
       [not found]             ` <CAH6eHdQ=QnbjN4VHexhbbZuOK3P4eAeYfXefcC1DqfkDxbUB5w@mail.gmail.com>
@ 2014-01-28  0:20               ` John Dubchak
  2014-01-28  1:51                 ` Jonathan Wakely
  0 siblings, 1 reply; 11+ messages in thread
From: John Dubchak @ 2014-01-28  0:20 UTC (permalink / raw)
  To: gcc-help

On 1/27/14 3:45 PM, Jonathan Wakely wrote:
>
> You're adding -E to the link command, that's not going to work. To get
> the preprocessed output you need to preprocess the source file that's
> failing to compile, not the object files.
>

I have preprocessed my main.cpp, which is the only cpp file listed in 
the original error:

In file included from http_server_signals.hpp:12:0,
                  from http_server.hpp:21,
                  from http_service_traits.hpp:15,
                  from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: ‘siginfo_t’ has not been declared
  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,

Here is the preprocessed output for the http_server_signals.hpp file:

# 20 "http_server.hpp" 2

# 1 "http_server_signals.hpp" 1
# 10 "http_server_signals.hpp"
# 1 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 1 3
# 39 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 3

# 40 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 3

# 1 "/usr/include/errno.h" 1 3 4
# 42 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 2 3
# 11 "http_server_signals.hpp" 2

# 1 "/usr/include/sys/wait.h" 1 3 4
# 29 "/usr/include/sys/wait.h" 3 4
extern "C" {
# 102 "/usr/include/sys/wait.h" 3 4
typedef enum
{
   P_ALL,
   P_PID,
   P_PGID
} idtype_t;
# 116 "/usr/include/sys/wait.h" 3 4
extern __pid_t wait (void * __stat_loc);
# 139 "/usr/include/sys/wait.h" 3 4
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);


# 1 "/usr/include/bits/siginfo.h" 1 3 4
# 25 "/usr/include/bits/siginfo.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 26 "/usr/include/bits/siginfo.h" 2 3 4
# 144 "/usr/include/sys/wait.h" 2 3 4
# 155 "/usr/include/sys/wait.h" 3 4
extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
      int __options);

struct rusage;

extern __pid_t wait3 (void * __stat_loc, int __options,
         struct rusage * __usage) throw ();

extern __pid_t wait4 (__pid_t __pid, void * __stat_loc, int __options,
         struct rusage *__usage) throw ();

}
# 13 "http_server_signals.hpp" 2


static void sig_handler(int sig) {
  if (sig == 2) {
   int status = 0;
   int savedErrno = (*__errno_location ());
   while (waitpid(-1, &status, 1) > 0)
    continue;
   (*__errno_location ()) = savedErrno;
  } else if (sig == 1) {
   int status = 0;
   int savedErrno = (*__errno_location ());
   while (waitpid(-1, &status, 1) > 0)
    continue;
   (*__errno_location ()) = savedErrno;
  } else if (sig == 15) {
   int status = 0;
   int savedErrno = (*__errno_location ());
   while (waitpid(-1, &status, 1) > 0)
    continue;
   (*__errno_location ()) = savedErrno;
  } else if (sig == 17) {
   int status = 0;
   int savedErrno = (*__errno_location ());
   while (waitpid(-1, &status, 1) > 0)
    continue;
   (*__errno_location ()) = savedErrno;
  }
}

If I am reading this correctly, the siginfo_t definition is available 
when preprocessed.

Is there anything obvious that I might be missing?

Thanks,
John

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-28  0:20               ` John Dubchak
@ 2014-01-28  1:51                 ` Jonathan Wakely
  2014-01-28 18:10                   ` John Dubchak
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2014-01-28  1:51 UTC (permalink / raw)
  To: John Dubchak; +Cc: gcc-help

On 28 January 2014 00:20, John Dubchak wrote:
> On 1/27/14 3:45 PM, Jonathan Wakely wrote:
>>
>>
>> You're adding -E to the link command, that's not going to work. To get
>> the preprocessed output you need to preprocess the source file that's
>> failing to compile, not the object files.
>>
>
> I have preprocessed my main.cpp, which is the only cpp file listed in the
> original error:
>
> In file included from http_server_signals.hpp:12:0,
>                  from http_server.hpp:21,
>                  from http_service_traits.hpp:15,
>                  from main.cpp:14:
> /usr/include/sys/wait.h:155:52: error: ‘siginfo_t’ has not been declared
>  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
>
> Here is the preprocessed output for the http_server_signals.hpp file:
>
> # 20 "http_server.hpp" 2
>
> # 1 "http_server_signals.hpp" 1
> # 10 "http_server_signals.hpp"
> # 1 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 1 3
> # 39 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 3
>
> # 40 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 3
>
> # 1 "/usr/include/errno.h" 1 3 4
> # 42 "/usr/local/gcc-4.8.2/include/c++/4.8.2/cerrno" 2 3
> # 11 "http_server_signals.hpp" 2
>
> # 1 "/usr/include/sys/wait.h" 1 3 4
> # 29 "/usr/include/sys/wait.h" 3 4
> extern "C" {
> # 102 "/usr/include/sys/wait.h" 3 4
> typedef enum
> {
>   P_ALL,
>   P_PID,
>   P_PGID
> } idtype_t;
> # 116 "/usr/include/sys/wait.h" 3 4
> extern __pid_t wait (void * __stat_loc);
> # 139 "/usr/include/sys/wait.h" 3 4
> extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
>
>
> # 1 "/usr/include/bits/siginfo.h" 1 3 4
> # 25 "/usr/include/bits/siginfo.h" 3 4
> # 1 "/usr/include/bits/wordsize.h" 1 3 4
> # 26 "/usr/include/bits/siginfo.h" 2 3 4
> # 144 "/usr/include/sys/wait.h" 2 3 4
> # 155 "/usr/include/sys/wait.h" 3 4
> extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
>      int __options);
>
> struct rusage;
>
> extern __pid_t wait3 (void * __stat_loc, int __options,
>         struct rusage * __usage) throw ();
>
> extern __pid_t wait4 (__pid_t __pid, void * __stat_loc, int __options,
>         struct rusage *__usage) throw ();
>
> }
> # 13 "http_server_signals.hpp" 2
>
>
> static void sig_handler(int sig) {
>  if (sig == 2) {
>   int status = 0;
>   int savedErrno = (*__errno_location ());
>   while (waitpid(-1, &status, 1) > 0)
>    continue;
>   (*__errno_location ()) = savedErrno;
>  } else if (sig == 1) {
>   int status = 0;
>   int savedErrno = (*__errno_location ());
>   while (waitpid(-1, &status, 1) > 0)
>    continue;
>   (*__errno_location ()) = savedErrno;
>  } else if (sig == 15) {
>   int status = 0;
>   int savedErrno = (*__errno_location ());
>   while (waitpid(-1, &status, 1) > 0)
>    continue;
>   (*__errno_location ()) = savedErrno;
>  } else if (sig == 17) {
>   int status = 0;
>   int savedErrno = (*__errno_location ());
>   while (waitpid(-1, &status, 1) > 0)
>    continue;
>   (*__errno_location ()) = savedErrno;
>  }
> }
>
> If I am reading this correctly, the siginfo_t definition is available when
> preprocessed.
>
> Is there anything obvious that I might be missing?

I still think you're not including <signal.h> when you should be. That
could be because some other header defines _SIGNAL_H, which would
prevent <signal.h> from defining anything, including __need_siginfo_t,
so that <bits/siginfo.h> doesn't define it.

Does one of your headers use _SIGNAL_H as an include guard?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-28  1:51                 ` Jonathan Wakely
@ 2014-01-28 18:10                   ` John Dubchak
  2014-01-28 18:22                     ` John Dubchak
  2014-01-28 18:42                     ` Jonathan Wakely
  0 siblings, 2 replies; 11+ messages in thread
From: John Dubchak @ 2014-01-28 18:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

On 1/27/14 5:51 PM, Jonathan Wakely wrote:
> On 28 January 2014 00:20, John Dubchak wrote:
>
> Does one of your headers use _SIGNAL_H as an include guard?

No, it does not.  I just spent 30 minutes reviewing all of the headers 
and ordering of includes, including searching to see if _SIGNAL_H_ 
include guard is used anywhere inside my codebase and it's not.

That's what brings me to the list, I am verifying if I have built gcc 
incorrectly or trying to determine other potential causes of this error.

Also, in the preprocessed output from yesterday, I verified that 
siginfo_t is being defined:

typedef __sig_atomic_t sig_atomic_t;

# 58 "/usr/include/signal.h" 3 4
# 1 "/usr/include/bits/signum.h" 1 3 4
# 59 "/usr/include/signal.h" 2 3 4
# 79 "/usr/include/signal.h" 3 4
# 1 "/usr/include/bits/siginfo.h" 1 3 4
# 25 "/usr/include/bits/siginfo.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 26 "/usr/include/bits/siginfo.h" 2 3 4

typedef union sigval
   {
     int sival_int;
     void *sival_ptr;
   } sigval_t;
# 51 "/usr/include/bits/siginfo.h" 3 4
typedef struct siginfo
   {
     int si_signo;
     int si_errno;

     int si_code;

     union
       {
  int _pad[((128 / sizeof (int)) - 4)];

  struct
    {
      __pid_t si_pid;
      __uid_t si_uid;
    } _kill;

  struct
    {
      int si_tid;
      int si_overrun;
      sigval_t si_sigval;
    } _timer;

  struct
    {
      __pid_t si_pid;
      __uid_t si_uid;
      sigval_t si_sigval;
    } _rt;

  struct
    {
      __pid_t si_pid;
      __uid_t si_uid;
      int si_status;
      __clock_t si_utime;
      __clock_t si_stime;
    } _sigchld;

  struct
    {
      void *si_addr;
    } _sigfault;

  struct
    {
      long int si_band;
      int si_fd;
    } _sigpoll;
       } _sifields;
   } siginfo_t;

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-28 18:10                   ` John Dubchak
@ 2014-01-28 18:22                     ` John Dubchak
  2014-01-28 18:47                       ` Jonathan Wakely
  2014-01-28 18:42                     ` Jonathan Wakely
  1 sibling, 1 reply; 11+ messages in thread
From: John Dubchak @ 2014-01-28 18:22 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

On 1/28/14 10:09 AM, John Dubchak wrote:
> On 1/27/14 5:51 PM, Jonathan Wakely wrote:
>> On 28 January 2014 00:20, John Dubchak wrote:
>>
>> Does one of your headers use _SIGNAL_H as an include guard?
>
> No, it does not.  I just spent 30 minutes reviewing all of the headers
> and ordering of includes, including searching to see if _SIGNAL_H_
> include guard is used anywhere inside my codebase and it's not.
>
> That's what brings me to the list, I am verifying if I have built gcc
> incorrectly or trying to determine other potential causes of this error.
>
> Also, in the preprocessed output from yesterday, I verified that
> siginfo_t is being defined:
>
> typedef __sig_atomic_t sig_atomic_t;
>
> # 58 "/usr/include/signal.h" 3 4
> # 1 "/usr/include/bits/signum.h" 1 3 4
> # 59 "/usr/include/signal.h" 2 3 4
> # 79 "/usr/include/signal.h" 3 4
> # 1 "/usr/include/bits/siginfo.h" 1 3 4
> # 25 "/usr/include/bits/siginfo.h" 3 4
> # 1 "/usr/include/bits/wordsize.h" 1 3 4
> # 26 "/usr/include/bits/siginfo.h" 2 3 4
>
> typedef union sigval
>    {
>      int sival_int;
>      void *sival_ptr;
>    } sigval_t;
> # 51 "/usr/include/bits/siginfo.h" 3 4
> typedef struct siginfo
>    {
>      int si_signo;
>      int si_errno;
>
>      int si_code;
>
>      union
>        {
>   int _pad[((128 / sizeof (int)) - 4)];
>
>   struct
>     {
>       __pid_t si_pid;
>       __uid_t si_uid;
>     } _kill;
>
>   struct
>     {
>       int si_tid;
>       int si_overrun;
>       sigval_t si_sigval;
>     } _timer;
>
>   struct
>     {
>       __pid_t si_pid;
>       __uid_t si_uid;
>       sigval_t si_sigval;
>     } _rt;
>
>   struct
>     {
>       __pid_t si_pid;
>       __uid_t si_uid;
>       int si_status;
>       __clock_t si_utime;
>       __clock_t si_stime;
>     } _sigchld;
>
>   struct
>     {
>       void *si_addr;
>     } _sigfault;
>
>   struct
>     {
>       long int si_band;
>       int si_fd;
>     } _sigpoll;
>        } _sifields;
>    } siginfo_t;
>

I've resolved this issue.  Jonathan's point about the include guards 
made me review the ordering I was using and I discovered and removed a 
cyclic dependency, which corrected the issue by addressing the compiler 
error.

Thank you Jonathan for your help.

JohnD

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-28 18:10                   ` John Dubchak
  2014-01-28 18:22                     ` John Dubchak
@ 2014-01-28 18:42                     ` Jonathan Wakely
  1 sibling, 0 replies; 11+ messages in thread
From: Jonathan Wakely @ 2014-01-28 18:42 UTC (permalink / raw)
  To: John Dubchak; +Cc: gcc-help

On 28 January 2014 18:09, John Dubchak wrote:
> That's what brings me to the list, I am verifying if I have built gcc
> incorrectly or trying to determine other potential causes of this error.

It's far more likely to be user error rather than a problem with your
GCC build (although I have to wonder why you passed so many redundant
options to the GCC configure script, including specifying
--with-arch_32 at the same time as --disable-multilib).

> Also, in the preprocessed output from yesterday, I verified that siginfo_t
> is being defined:

In  that case one possibility is that you haven't closed a namespace
properly. e.g. if you #include <signal.h> inside a namespace block,
then #include <sys/wait.h> outside the block, it won't be able to find
siginfo_t, because it was declared as something like foo::siginfo_t.

Trying to debug your code from incomplete snippets is impossible.
Please reduce your code to the smallest example that reproduces the
problem, and then show us that.  If you can't reproduce the problem
with a reduced example, examine what's different between it and your
real code.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
  2014-01-28 18:22                     ` John Dubchak
@ 2014-01-28 18:47                       ` Jonathan Wakely
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Wakely @ 2014-01-28 18:47 UTC (permalink / raw)
  To: John Dubchak; +Cc: gcc-help

On 28 January 2014 18:21, John Dubchak <lists@johndubchak.com> wrote:
> On 1/28/14 10:09 AM, John Dubchak wrote:
> I've resolved this issue.  Jonathan's point about the include guards made me
> review the ordering I was using and I discovered and removed a cyclic
> dependency, which corrected the issue by addressing the compiler error.

Ah, I didn't see this message when sending my last reply - glad you've
solved the problem.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4
@ 2014-01-27 21:57 John Dubchak
  0 siblings, 0 replies; 11+ messages in thread
From: John Dubchak @ 2014-01-27 21:57 UTC (permalink / raw)
  To: gcc-help

Hi,

I apologize if this seems like a cross-post from g++-help, but that 
seems to be the wrong list for my question.

I used the following configure statement to build the latest gcc 4.8.2, 
with C++ 11 support on RedHat 6.4, which came with the default installed 
gcc 4.4.7:

../configure--prefix=/usr/local/gcc-4.8.2 \
          --program-suffix=-48 \
          --enable-bootstrap  \
	--enable-shared  \
	--enable-threads=posix \
	--enable-checking=release \
	--with-system-zlib  \
	--enable-__cxa_atexit \
	--enable-languages=c,c++  \
	--disable-multilib   \
          --with-tune=generic \
          --with-arch_32=i686 \
          --build=x86_64-redhat-linux

However, after installing it with 'make' and 'make install' and
compiling with C++11 support using:

/usr/local/gcc-4.8.2/bin/g++-48 -v -std=c++11 -c -I . -I 
./workspace/http/http-server/src -I ./jsoncpp-src-0.5.0/include -Wall 
main.cpp -o main.o

I get this error:

In file included from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
   extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
                                                      ^

Here is the code that generates the error:

#include <sys/wait.h>

static void sig_handler(int sig) {
      if (sig == SIGINT) {
          int status = 0;
          int savedErrno = errno;
          while (waitpid(-1, &status, WNOHANG) > 0)
              continue;
          errno = savedErrno;
      } else if (sig == SIGHUP) {
          int status = 0;
          int savedErrno = errno;
          while (waitpid(-1, &status, WNOHANG) > 0)
              continue;
          errno = savedErrno;
      }
}

I have spent several days on this issue and can neither identify what
causes it nor what I should to do resolve it.Ideally, I'd like to have
the gcc-4.8.2 be available as an alternative compiler on this RedHat host.

I have included the output of adding both -v and -E arguments to gcc
[1].  Any help is greatly appreciated.

Thanks,
John

[1]
$ make
g++-48 -v -std=c++11 -o ../bin/http_server main.o http_funcs.o
error_utils.o fs/fs_utils.o -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -lpthread
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/libs/libjson.a -Wall
Using built-in specs.
COLLECT_GCC=g++-48
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --program-suffix=-48
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 (GCC)
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-o' '../bin/http_server' '-I' '.'
'-I' '/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src'
'-I' '/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include' '-Wall'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
   /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/collect2 --eh-frame-hdr -m
elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
../bin/http_server
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../.. main.o http_funcs.o
error_utils.o fs/fs_utils.o -lpthread
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/libs/libjson.a -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crtn.o
[ec2-user@ip-10-234-6-159 src]$ rm main.o || true && make
g++-48 -v -std=c++11 -c -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -Wall main.cpp -o main.o
Using built-in specs.
COLLECT_GCC=g++-48
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --program-suffix=-48
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-c' '-I' '.' '-I'
'/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src' '-I'
'/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include' '-Wall' '-o'
'main.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
   /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus -quiet -v -I . -I
/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src -I
/home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include -D_GNU_SOURCE
main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64
-auxbase-strip main.o -Wall -std=c++11 -version -o /tmp/ccO8lGjC.s
GNU C++ (GCC) version 4.8.2 (x86_64-redhat-linux)
      compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version
2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory
"/home/ec2-user/devel/cpp/projects-workspace/http/http-server/src"
#include "..." search starts here:
#include <...> search starts here:
   .
   /home/ec2-user/devel/cpp/jsoncpp-src-0.5.0/include
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2
 
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/x86_64-redhat-linux
 
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/backward
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
   /usr/local/include
   /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include-fixed
   /usr/include
End of search list.
GNU C++ (GCC) version 4.8.2 (x86_64-redhat-linux)
      compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version
2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1546ef0d67f553d18b0c7aa67816401f
In file included from http_server_signals.hpp:12:0,
                   from http_server.hpp:21,
                   from http_service_traits.hpp:15,
                   from main.cpp:14:
/usr/include/sys/wait.h:155:52: error: 'siginfo_t' has not been declared
   extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
                                                      ^
make: *** [main.o] Error 1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-28 18:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-27 21:57 Compile error: 'siginfo_t' is not declared using gcc-4.8.2 on RedHat, 6.4 John Dubchak
2014-01-27 22:20 ` Marc Glisse
2014-01-27 22:39   ` John Dubchak
2014-01-27 22:44     ` Jonathan Wakely
     [not found]       ` <52E6E3CB.3050503@johndubchak.com>
     [not found]         ` <CAH6eHdSnAaFvtopT_UsLfStWPaVqfLX8vei4OO8H=a=XC=1OLg@mail.gmail.com>
     [not found]           ` <52E6EE2E.5040909@johndubchak.com>
     [not found]             ` <CAH6eHdQ=QnbjN4VHexhbbZuOK3P4eAeYfXefcC1DqfkDxbUB5w@mail.gmail.com>
2014-01-28  0:20               ` John Dubchak
2014-01-28  1:51                 ` Jonathan Wakely
2014-01-28 18:10                   ` John Dubchak
2014-01-28 18:22                     ` John Dubchak
2014-01-28 18:47                       ` Jonathan Wakely
2014-01-28 18:42                     ` Jonathan Wakely
2014-01-27 21:57 John Dubchak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).