https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98506
Bug ID: 98506
Summary: ../../gcc/libcody/resolver.cc:178:43: error:
'O_CLOEXEC' was not declared in thi s scope
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: danglin at gcc dot gnu.org
Target Milestone: ---
Host: hppa*-*-hpux11.11
Target: hppa*-*-hpux11.11
Build: hppa*-*-hpux11.11
g++ -std=c++11 -g -fno-enforce-eh-specs -fno-stack-protector
-fno-threadsafe-sta
tics -fno-exceptions -fno-rtti -fdebug-prefix-map=../../gcc/libcody/= -W -Wall
-
include config.h -I../../gcc/libcody \
-MMD -MP -MF resolver.d -c -o resolver.o ../../gcc/libcody/resolver.cc
../../gcc/libcody/resolver.cc: In member function 'virtual int
Cody::Resolver::I
ncludeTranslateRequest(Cody::Server*, Cody::Flags, std::__cxx11::string&)':
../../gcc/libcody/resolver.cc:178:43: error: 'O_CLOEXEC' was not declared in
thi
s scope
int fd_dir = open (REPO_DIR, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
^~~~~~~~~
../../gcc/libcody/resolver.cc:178:43: note: suggested alternative: 'FD_CLOEXEC'
int fd_dir = open (REPO_DIR, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
^~~~~~~~~
FD_CLOEXEC
../../gcc/libcody/resolver.cc:178:55: error: 'O_DIRECTORY' was not declared in
t
his scope
int fd_dir = open (REPO_DIR, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
^~~~~~~~~~~
../../gcc/libcody/resolver.cc:178:55: note: suggested alternative: 'O_DIRECT'
int fd_dir = open (REPO_DIR, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
^~~~~~~~~~~
O_DIRECT
../../gcc/libcody/resolver.cc:180:10: error: 'fstatat' was not declared in this
scope
&& fstatat (fd_dir, cmi.c_str (), &statbuf, 0) == 0
^~~~~~~
../../gcc/libcody/resolver.cc:180:10: note: suggested alternative: 'fstat64'
&& fstatat (fd_dir, cmi.c_str (), &statbuf, 0) == 0
^~~~~~~
fstat64
make[3]: *** [Makefile:127: resolver.o] Error 1
make[3]: Leaving directory '/test/gnu/gcc/objdir/libcody'
make[2]: *** [Makefile:10195: all-stage1-libcody] Error 2
Possible fix is here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562508.html
Another alternative would be autoconf check?
#if (defined (__unix__) \
|| (defined (__Apple__) \
&& defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \
&& __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101000))
// Autoconf test?
#define HAVE_FSTATAT 1
#else
#define HAVE_FSTATAT 0
#endif