compile error 'siginfo_t' is not declared with gcc 4.8.2 on RedHat 6.4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

compile error 'siginfo_t' is not declared with gcc 4.8.2 on RedHat 6.4

johnd
Hi,

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, when I use the following compile command:

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

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,
                                                    ^

The offending code looks like this:

#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 a couple of days on this issue and can't really resolve it other than creating a typedef to workaround it,
which I don't think is correct:

typedef siginfo_t int;

Is there a "proper" way to correct the error?  I have included the output of adding both -v and -E arguments to gcc [1].

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

_______________________________________________
help-gplusplus mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-gplusplus