https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113792

            Bug ID: 113792
           Summary: error: '__size_t' was not declared in this scope
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

I enabled building rust on hppa64-hp-hpux11.11 and hit this error:

/home/dave/gnu/gcc/objdir64/./prev-gcc/x
g++ -B/home/dave/gnu/gcc/objdir64/./prev-gcc/
-B/opt/gnu64/gcc/gcc-14/hppa64-hp-
hpux11.11/bin/ -nostdinc++
-B/home/dave/gnu/gcc/objdir64/prev-hppa64-hp-hpux11.1
1/libstdc++-v3/src/.libs
-B/home/dave/gnu/gcc/objdir64/prev-hppa64-hp-hpux11.11/
libstdc++-v3/libsupc++/.libs  -isystem
/home/dave/gnu/gcc/objdir64/prev-hppa64-h
p-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11  -isystem
/home/dave/gnu/gc
c/objdir64/prev-hppa64-hp-hpux11.11/libstdc++-v3/include  -isystem
/home/dave/gn
u/gcc/gcc/libstdc++-v3/libsupc++
-L/home/dave/gnu/gcc/objdir64/prev-hppa64-hp-hp
ux11.11/libstdc++-v3/src/.libs
-L/home/dave/gnu/gcc/objdir64/prev-hppa64-hp-hpux
11.11/libstdc++-v3/libsupc++/.libs -g -O2 -fno-checking   -c -o punct.o
../../..
/gcc/libgrust/libproc_macro_internal/punct.cc
In file included from
/home/dave/gnu/gcc/gcc-trunk/libstdc++-v3/include/c_global
/cstdlib:79,
                 from ../../../gcc/libgrust/libproc_macro_internal/punct.cc:24:
/usr/include/stdlib.h:349:25: error: '__size_t' was not declared in this scope;
did you mean '__site_t'?
  349 |     extern void *valloc(__size_t);
      |                         ^~~~~~~~
      |                         __site_t
make[4]: *** [<builtin>: punct.o] Error 1
make[4]: Leaving directory
'/home/dave/gnu/gcc/objdir64/libgrust/libproc_macro_internal'
make[3]: *** [Makefile:421: all-recursive] Error 1

This is an #include_next problem.  We have the following in cstdlib:
// Need to ensure this finds the C library's <stdlib.h> not a libstdc++
// wrapper that might already be installed later in the include search path.
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS

stdlib.h is fixed on this target.  The #include_next pulled stdlib.h
from /usr/include instead of ./prev-gcc/include-fixed/stdlib.h.

Maybe the fix is to just use #include but I'm not sure.

There are a couple of other places which define
_GLIBCXX_INCLUDE_NEXT_C_HEADERS.

Reply via email to