Many projects (Buildroot, coreboot, Yocto) require building a toolchain.
Every time it tries to build it (I've checked Buildroot and coreboot) it fails
with the following errors:
In file included from ./bconfig.h:3:0,
from ../../gcc/gengtype-lex.c:4:
./auto-host.h:2396:16: error: declaration does not declare anything
[-fpermissive]
#define rlim_t long
^
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:488:14: error: conflicting declaration of C function ‘void*
sbrk(int)’
extern void *sbrk (int);
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:496:14: error: ambiguating new declaration of ‘char*
strstr(const char*, const char*)’
extern char *strstr (const char *, const char *);
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:540:20: error: conflicting declaration of C function ‘const
char* strsignal(int)’
extern const char *strsignal (int);
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:112:14: error: ambiguating new declaration of
‘char* basename(const char*)’
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL
ATTRIBUTE_NONNULL(1);
Switching gcc versions doesn't help.
One can find a simple way to reproduce in buildroot.txt, build-gcc.log provides
a complete log.
Looking forward for your help. Thanks!
--
Best Regards,
Timofey Komarov
In file included from ./bconfig.h:3:0,
from ../../gcc/gengtype-lex.c:4:
./auto-host.h:2396:16: error: declaration does not declare anything [-fpermissive]
#define rlim_t long
^
/run/current-system/profile/include/bits/resource.h:131:18: note: in expansion of macro ârlim_tâ
typedef __rlim_t rlim_t;
^~~~~~
make[2]: *** [Makefile:2671: build/gengtype-parse.o] Error 1
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:456:15: warning: declaration of âdouble atof(const char*)â has a different exception specifier [-Wpedantic]
extern double atof (const char *);
^~~~
In file included from /run/current-system/profile/include/features.h:450:0,
from /run/current-system/profile/include/bits/libc-header-start.h:33,
from /run/current-system/profile/include/stdio.h:27,
from gengtype-lex.c:20:
/run/current-system/profile/include/bits/stdlib-float.h:25:8: note: from previous declaration âdouble atof(const char*) throw ()â
__NTH (atof (const char *__nptr))
^
/run/current-system/profile/include/sys/cdefs.h:63:35: note: in definition of macro â__NTHâ
# define __NTH(fct) __LEAF_ATTR fct throw ()
^~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:460:13: warning: declaration of âlong int atol(const char*)â has a different exception specifier [-Wpedantic]
extern long atol (const char *);
^~~~
In file included from /run/current-system/profile/include/features.h:450:0,
from /run/current-system/profile/include/bits/libc-header-start.h:33,
from /run/current-system/profile/include/stdio.h:27,
from gengtype-lex.c:20:
/run/current-system/profile/include/stdlib.h:366:8: note: from previous declaration âlong int atol(const char*) throw ()â
__NTH (atol (const char *__nptr))
^
/run/current-system/profile/include/sys/cdefs.h:63:35: note: in definition of macro â__NTHâ
# define __NTH(fct) __LEAF_ATTR fct throw ()
^~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:464:13: warning: declaration of âvoid free(void*)â has a different exception specifier [-Wpedantic]
extern void free (void *);
^~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:563:13: note: from previous declaration âvoid free(void*) throw ()â
extern void free (void *__ptr) __THROW;
^~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:468:14: warning: declaration of âchar* getcwd(char*, size_t)â has a different exception specifier [-Wpedantic]
extern char *getcwd (char *, size_t);
^~~~~~
In file included from ../../gcc/system.h:294:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/unistd.h:511:14: note: from previous declaration âchar* getcwd(char*, size_t) throw ()â
extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:472:14: warning: declaration of âchar* getenv(const char*)â has a different exception specifier [-Wpedantic]
extern char *getenv (const char *);
^~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:631:14: note: from previous declaration âchar* getenv(const char*) throw ()â
extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:476:12: warning: declaration of âint getopt(int, char* const*, const char*)â has a different exception specifier [-Wpedantic]
extern int getopt (int, char * const *, const char *);
^~~~~~
In file included from /run/current-system/profile/include/bits/getopt_posix.h:27:0,
from /run/current-system/profile/include/unistd.h:869,
from ../../gcc/system.h:294,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/bits/getopt_core.h:91:12: note: from previous declaration âint getopt(int, char* const*, const char*) throw ()â
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:480:12: warning: declaration of âint getpagesize()â has a different exception specifier [-Wpedantic]
extern int getpagesize (void);
^~~~~~~~~~~
In file included from ../../gcc/system.h:294:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/unistd.h:976:12: note: from previous declaration âint getpagesize() throw ()â
extern int getpagesize (void) __THROW __attribute__ ((__const__));
^~~~~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:484:14: warning: declaration of âchar* getwd(char*)â has a different exception specifier [-Wpedantic]
extern char *getwd (char *);
^~~~~
In file included from ../../gcc/system.h:294:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/unistd.h:525:14: note: from previous declaration âchar* getwd(char*) throw ()â
extern char *getwd (char *__buf)
^~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:488:14: error: conflicting declaration of C function âvoid* sbrk(int)â
extern void *sbrk (int);
^~~~
In file included from ../../gcc/system.h:294:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/unistd.h:1041:14: note: previous declaration âvoid* sbrk(intptr_t)â
extern void *sbrk (intptr_t __delta) __THROW;
^~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:492:5: warning: declaration of âint setenv(const char*, const char*, int)â has a different exception specifier [-Wpedantic]
int setenv(const char *, const char *, int);
^~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:650:12: note: from previous declaration âint setenv(const char*, const char*, int) throw ()â
extern int setenv (const char *__name, const char *__value, int __replace)
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:496:14: error: ambiguating new declaration of âchar* strstr(const char*, const char*)â
extern char *strstr (const char *, const char *);
^~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:322:1: note: old declaration âconst char* strstr(const char*, const char*)â
strstr (const char *__haystack, const char *__needle) __THROW
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:500:14: warning: declaration of âchar* stpcpy(char*, const char*)â has a different exception specifier [-Wpedantic]
extern char *stpcpy (char *, const char *);
^~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:451:14: note: from previous declaration âchar* stpcpy(char*, const char*) throw ()â
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:504:5: warning: declaration of âint unsetenv(const char*)â has a different exception specifier [-Wpedantic]
int unsetenv(const char *);
^~~~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:654:12: note: from previous declaration âint unsetenv(const char*) throw ()â
extern int unsetenv (const char *__name) __THROW __nonnull ((1));
^~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:508:14: warning: declaration of âvoid* malloc(size_t)â has a different exception specifier [-Wpedantic]
extern void *malloc (size_t);
^~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:539:14: note: from previous declaration âvoid* malloc(size_t) throw ()â
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:512:14: warning: declaration of âvoid* calloc(size_t, size_t)â has a different exception specifier [-Wpedantic]
extern void *calloc (size_t, size_t);
^~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:541:14: note: from previous declaration âvoid* calloc(size_t, size_t) throw ()â
extern void *calloc (size_t __nmemb, size_t __size)
^~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:516:14: warning: declaration of âvoid* realloc(void*, size_t)â has a different exception specifier [-Wpedantic]
extern void *realloc (void *, size_t);
^~~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:549:14: note: from previous declaration âvoid* realloc(void*, size_t) throw ()â
extern void *realloc (void *__ptr, size_t __size)
^~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:540:20: error: conflicting declaration of C function âconst char* strsignal(int)â
extern const char *strsignal (int);
^~~~~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:446:14: note: previous declaration âchar* strsignal(int)â
extern char *strsignal (int __sig) __THROW;
^~~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:548:12: warning: declaration of âint getrlimit(int, rlimit*)â has a different exception specifier [-Wpedantic]
extern int getrlimit (int, struct rlimit *);
^~~~~~~~~
In file included from ../../gcc/system.h:439:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/sys/resource.h:50:12: note: from previous declaration âint getrlimit(__rlimit_resource_t, rlimit*) throw ()â
extern int getrlimit (__rlimit_resource_t __resource,
^~~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:557:12: warning: declaration of âint setrlimit(int, const rlimit*)â has a different exception specifier [-Wpedantic]
extern int setrlimit (int, const struct rlimit *);
^~~~~~~~~
In file included from ../../gcc/system.h:439:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
/run/current-system/profile/include/sys/resource.h:69:12: note: from previous declaration âint setrlimit(__rlimit_resource_t, const rlimit*) throw ()â
extern int setrlimit (__rlimit_resource_t __resource,
^~~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:563:13: warning: declaration of âvoid abort()â has a different exception specifier [-Wpedantic]
extern void abort (void);
^~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:588:13: note: from previous declaration âvoid abort() throw ()â
extern void abort (void) __THROW __attribute__ ((__noreturn__));
^~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:567:12: warning: declaration of âint snprintf(char*, size_t, const char*, ...)â has a different exception specifier [-Wpedantic]
extern int snprintf (char *, size_t, const char *, ...);
^~~~~~~~
In file included from gengtype-lex.c:20:0:
/run/current-system/profile/include/stdio.h:354:12: note: from previous declaration âint snprintf(char*, size_t, const char*, ...) throw ()â
extern int snprintf (char *__restrict __s, size_t __maxlen,
^~~~~~~~
In file included from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:0:
../../gcc/system.h:571:12: warning: declaration of âint vsnprintf(char*, size_t, const char*, __va_list_tag*)â has a different exception specifier [-Wpedantic]
extern int vsnprintf (char *, size_t, const char *, va_list);
^~~~~~~~~
In file included from gengtype-lex.c:20:0:
/run/current-system/profile/include/stdio.h:358:12: note: from previous declaration âint vsnprintf(char*, size_t, const char*, __va_list_tag*) throw ()â
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
^~~~~~~~~
/gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7/bin/sh ../../gcc/../move-if-change tmp-optionlist optionlist
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:112:14: error: ambiguating new declaration of âchar* basename(const char*)â
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^~~~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:483:26: note: old declaration âconst char* basename(const char*)â
extern "C++" const char *basename (const char *__filename)
^~~~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:195:12: warning: declaration of âint ffs(int)â has a different exception specifier [-Wpedantic]
extern int ffs(int);
^~~
In file included from /run/current-system/profile/include/string.h:431:0,
from gengtype-lex.c:21:
/run/current-system/profile/include/strings.h:104:12: note: from previous declaration âint ffs(int) throw ()â
extern int ffs (int __i) __THROW __attribute_const__;
^~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:639:12: warning: declaration of âint asprintf(char**, const char*, ...)â has a different exception specifier [-Wpedantic]
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
^~~~~~~~
In file included from gengtype-lex.c:20:0:
/run/current-system/profile/include/stdio.h:372:12: note: from previous declaration âint asprintf(char**, const char*, ...) throw ()â
extern int asprintf (char **__restrict __ptr,
^~~~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:651:12: warning: declaration of âint vasprintf(char**, const char*, __va_list_tag*)â has a different exception specifier [-Wpedantic]
extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
^~~~~~~~~
In file included from gengtype-lex.c:20:0:
/run/current-system/profile/include/stdio.h:366:12: note: from previous declaration âint vasprintf(char**, const char*, __va_list_tag*) throw ()â
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
^~~~~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:670:15: warning: declaration of âsize_t strnlen(const char*, size_t)â has a different exception specifier [-Wpedantic]
extern size_t strnlen (const char *, size_t);
^~~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:390:15: note: from previous declaration âsize_t strnlen(const char*, size_t) throw ()â
extern size_t strnlen (const char *__string, size_t __maxlen)
^~~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:675:12: warning: declaration of âint strverscmp(const char*, const char*)â has a different exception specifier [-Wpedantic]
extern int strverscmp (const char *, const char *);
^~~~~~~~~~
In file included from gengtype-lex.c:21:0:
/run/current-system/profile/include/string.h:466:12: note: from previous declaration âint strverscmp(const char*, const char*) throw ()â
extern int strverscmp (const char *__s1, const char *__s2)
^~~~~~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:679:17: warning: declaration of âlong int strtol(const char*, char**, int)â has a different exception specifier [-Wpedantic]
extern long int strtol (const char *nptr,
^~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:176:17: note: from previous declaration âlong int strtol(const char*, char**, int) throw ()â
extern long int strtol (const char *__restrict __nptr,
^~~~~~
In file included from ../../gcc/system.h:691:0,
from /d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:30:
../../gcc/../include/libiberty.h:684:26: warning: declaration of âlong unsigned int strtoul(const char*, char**, int)â has a different exception specifier [-Wpedantic]
extern unsigned long int strtoul (const char *nptr,
^~~~~~~
In file included from gengtype-lex.c:23:0:
/run/current-system/profile/include/stdlib.h:180:26: note: from previous declaration âlong unsigned int strtoul(const char*, char**, int) throw ()â
extern unsigned long int strtoul (const char *__restrict __nptr,
^~~~~~~
make[2]: *** [Makefile:2671: build/gengenrtl.o] Error 1
echo timestamp > s-options
/d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l: In function âint yylex(const char**)â:
gengtype-lex.c:365:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
/d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:118:1: note: in expansion of macro âYY_DO_BEFORE_ACTIONâ
/d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:113:1: note: here
gengtype-lex.c:365:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
/d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:135:1: note: in expansion of macro âYY_DO_BEFORE_ACTIONâ
/d/gcc-8.4.0/gcc-8.4.0/gcc/gengtype-lex.l:131:1: note: here
make[2]: *** [Makefile:2671: build/genhooks.o] Error 1
make[2]: *** [Makefile:2671: build/gengtype-lex.o] Error 1
make[2]: *** [Makefile:2671: build/genmodes.o] Error 1
make[2]: *** [Makefile:2671: build/gengtype-state.o] Error 1
make[2]: *** [Makefile:2671: build/gengtype.o] Error 1
rm gcc.pod
make[2]: Leaving directory '/home/user/Downloads/buildroot-2020.02.1/output/build/host-gcc-initial-8.4.0/build/gcc'
make[1]: *** [Makefile:4251: all-gcc] Error 2
make[1]: Leaving directory '/home/user/Downloads/buildroot-2020.02.1/output/build/host-gcc-initial-8.4.0/build'
make: *** [package/pkg-generic.mk:269: /home/user/Downloads/buildroot-2020.02.1/output/build/host-gcc-initial-8.4.0/.stamp_built] Error 2
wget https://buildroot.org/downloads/buildroot-2020.02.1.tar.gz
tar -xf buildroot-2020.02.1.tar.gz
cd buildroot-2020.02.1
make menuconfig # save default
make