gcc – GCC12: No compila libcpp: cc1: warning: command-line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C

Compilando GCC12, no compila libcpp… Al parecer el problema es que trata a C++ como si fuera C, pero eso sale como warning y no como error.

Desde aquí empiezan los errores:

make(3): se entra en el directorio ‘/gcc12/gcc/build-x86_64-pc-linux-gnu/libcpp’
g++ -std=c++11 -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long -fno-exceptions -fno-rtti -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo ../.././libcpp/charset.c
cc1: warning: command-line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fno-rtti’ is valid for C++/D/ObjC++ but not for C

In file included from ../.././libcpp/include/cpplib.h:27,
                 from ../.././libcpp/charset.c:22:
../.././libcpp/include/line-map.h:330:3: error: expected specifier-qualifier-list before ‘static’
  330 |   static source_range from_location (location_t loc)
      |   ^~~~~~

Registro de lo ya compilado:

/gcc12/gcc make
( -f stage_final ) || echo stage3 > stage_final
make(1): se entra en el directorio '/gcc12/gcc'
make(2): se entra en el directorio '/gcc12/gcc'
make(3): se entra en el directorio '/gcc12/gcc'
rm -f stage_current
make(3): se sale del directorio '/gcc12/gcc'
make(2): se sale del directorio '/gcc12/gcc'
make(2): se entra en el directorio '/gcc12/gcc'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
make  all-recursive
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
Making all in tests
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests'
Making all in .
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests'
make(6): No se hace nada para 'all-am'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests'
Making all in devel
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/devel'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/devel'
Making all in mpn
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpn'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpn'
Making all in mpz
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpz'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpz'
Making all in mpq
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpq'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpq'
Making all in mpf
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpf'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/mpf'
Making all in rand
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/rand'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/rand'
Making all in misc
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/misc'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/misc'
Making all in cxx
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/cxx'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests/cxx'
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tests'
Making all in mpn
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpn'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpn'
Making all in mpz
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpz'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpz'
Making all in mpq
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpq'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpq'
Making all in mpf
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpf'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/mpf'
Making all in printf
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/printf'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/printf'
Making all in scanf
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/scanf'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/scanf'
Making all in rand
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/rand'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/rand'
Making all in cxx
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/cxx'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/cxx'
Making all in demos
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos'
Making all in calc
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/calc'
make  all-am
make(7): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/calc'
make(7): No se hace nada para 'all-am'.
make(7): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/calc'
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/calc'
Making all in expr
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/expr'
make(6): No se hace nada para 'all'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos/expr'
make(6): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos'
make(6): No se hace nada para 'all-am'.
make(6): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos'
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/demos'
Making all in tune
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tune'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/tune'
Making all in doc
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/doc'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp/doc'
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/gmp'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr'
Making all in doc
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/doc'
make(4): No se hace nada para 'all'.
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/doc'
Making all in src
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/src'
make  all-am
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/src'
make(5): No se hace nada para 'all-am'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/src'
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/src'
Making all in tests
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/tests'
make(4): No se hace nada para 'all'.
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/tests'
Making all in tune
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/tune'
make(4): No se hace nada para 'all'.
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr/tune'
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr'
make(4): No se hace nada para 'all-am'.
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpfr'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
make  all-recursive
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
Making all in src
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/src'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/src'
Making all in tests
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/tests'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/tests'
Making all in doc
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/doc'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc/doc'
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/mpc'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
make  all-recursive
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
Making all in .
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
Making all in doc
make(5): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl/doc'
make(5): No se hace nada para 'all'.
make(5): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl/doc'
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/isl'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/libiberty'
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/libiberty/testsuite'
make(4): No se hace nada para 'all'.
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/libiberty/testsuite'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/libiberty'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/lto-plugin'
make  all-am
make(4): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/lto-plugin'
make(4): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/lto-plugin'
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/lto-plugin'
make(3): se entra en el directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/intl'
make(3): No se hace nada para 'all'.
make(3): se sale del directorio '/gcc12/gcc/host-x86_64-pc-linux-gnu/intl'
make(3): se entra en el directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libiberty'
make(4): se entra en el directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libiberty/testsuite'
make(4): No se hace nada para 'all'.
make(4): se sale del directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libiberty/testsuite'
make(3): se sale del directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libiberty'
make(3): se entra en el directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/fixincludes'
make(3): No se hace nada para 'all'.
make(3): se sale del directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/fixincludes'

Errores:

make(3): se entra en el directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libcpp'
g++ -std=c++11  -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include  -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include    -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo ../.././libcpp/charset.c
cc1: warning: command-line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fno-rtti’ is valid for C++/D/ObjC++ but not for C
In file included from ../.././libcpp/include/cpplib.h:27,
                 from ../.././libcpp/charset.c:22:
../.././libcpp/include/line-map.h:330:3: error: expected specifier-qualifier-list before ‘static’
  330 |   static source_range from_location (location_t loc)
      |   ^~~~~~
../.././libcpp/include/line-map.h:403:43: error: expected identifier or ‘(’ before ‘:’ token
  403 | struct GTY((tag ("1"))) line_map_ordinary : public line_map {
      |                                           ^
../.././libcpp/include/line-map.h:448:2: warning: ISO C does not allow extra ‘;’ outside of a function (-Wpedantic)
  448 | };
      |  ^
../.././libcpp/include/line-map.h:461:40: error: expected identifier or ‘(’ before ‘:’ token
  461 | struct GTY((tag ("2"))) line_map_macro : public line_map {
      |                                        ^
../.././libcpp/include/line-map.h:539:2: warning: ISO C does not allow extra ‘;’ outside of a function (-Wpedantic)
  539 | };
      |  ^
../.././libcpp/include/line-map.h:585:23: error: unknown type name ‘line_map’
  585 | MAP_ORDINARY_P (const line_map *map)
      |                       ^~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MAP_ORDINARY_P’:
../.././libcpp/include/line-map.h:587:30: error: request for member ‘start_location’ in something not a structure or union
  587 |   return IS_ORDINARY_LOC (map->start_location);
      |                              ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:593:38: error: unknown type name ‘line_map’
  593 | linemap_macro_expansion_map_p (const line_map *);
      |                                      ^~~~~~~~
../.././libcpp/include/line-map.h:599:8: error: unknown type name ‘line_map_ordinary’
  599 | inline line_map_ordinary *
      |        ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:600:25: error: unknown type name ‘line_map’
  600 | linemap_check_ordinary (line_map *map)
      |                         ^~~~~~~~
../.././libcpp/include/line-map.h:610:14: error: unknown type name ‘line_map_ordinary’
  610 | inline const line_map_ordinary *
      |              ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:611:31: error: unknown type name ‘line_map’
  611 | linemap_check_ordinary (const line_map *map)
      |                               ^~~~~~~~
In file included from ../.././libcpp/charset.c:21:
../.././libcpp/include/line-map.h: In function ‘linemap_check_ordinary’:
../.././libcpp/system.h:404:50: warning: ISO C does not support ‘__FUNCTION__’ predefined identifier (-Wpedantic)
  404 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
      |                                                  ^~~~~~~~~~~~
../.././libcpp/include/line-map.h:547:7: note: in expansion of macro ‘abort’
  547 |       abort ();                                       
      |       ^~~~~
../.././libcpp/include/line-map.h:613:3: note: in expansion of macro ‘linemap_assert’
  613 |   linemap_assert (MAP_ORDINARY_P (map));
      |   ^~~~~~~~~~~~~~
In file included from ../.././libcpp/include/cpplib.h:27,
                 from ../.././libcpp/charset.c:22:
../.././libcpp/include/line-map.h:614:17: error: unknown type name ‘line_map_ordinary’
  614 |   return (const line_map_ordinary *)map;
      |                 ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:620:8: error: unknown type name ‘line_map_macro’
  620 | inline line_map_macro *linemap_check_macro (line_map *map)
      |        ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:620:45: error: unknown type name ‘line_map’
  620 | inline line_map_macro *linemap_check_macro (line_map *map)
      |                                             ^~~~~~~~
../.././libcpp/include/line-map.h:629:14: error: unknown type name ‘line_map_macro’
  629 | inline const line_map_macro *
      |              ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:630:28: error: unknown type name ‘line_map’
  630 | linemap_check_macro (const line_map *map)
      |                            ^~~~~~~~
In file included from ../.././libcpp/charset.c:21:
../.././libcpp/include/line-map.h: In function ‘linemap_check_macro’:
../.././libcpp/system.h:404:50: warning: ISO C does not support ‘__FUNCTION__’ predefined identifier (-Wpedantic)
  404 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
      |                                                  ^~~~~~~~~~~~
../.././libcpp/include/line-map.h:547:7: note: in expansion of macro ‘abort’
  547 |       abort ();                                       
      |       ^~~~~
../.././libcpp/include/line-map.h:632:3: note: in expansion of macro ‘linemap_assert’
  632 |   linemap_assert (!MAP_ORDINARY_P (map));
      |   ^~~~~~~~~~~~~~
In file included from ../.././libcpp/include/cpplib.h:27,
                 from ../.././libcpp/charset.c:22:
../.././libcpp/include/line-map.h:633:17: error: unknown type name ‘line_map_macro’
  633 |   return (const line_map_macro *)map;
      |                 ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:639:27: error: unknown type name ‘line_map’
  639 | MAP_START_LOCATION (const line_map *map)
      |                           ^~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MAP_START_LOCATION’:
../.././libcpp/include/line-map.h:641:13: error: request for member ‘start_location’ in something not a structure or union
  641 |   return map->start_location;
      |             ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:647:42: error: unknown type name ‘line_map_ordinary’
  647 | ORDINARY_MAP_STARTING_LINE_NUMBER (const line_map_ordinary *ord_map)
      |                                          ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘ORDINARY_MAP_STARTING_LINE_NUMBER’:
../.././libcpp/include/line-map.h:649:17: error: request for member ‘to_line’ in something not a structure or union
  649 |   return ord_map->to_line;
      |                 ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:658:40: error: unknown type name ‘line_map_ordinary’
  658 | ORDINARY_MAP_IN_SYSTEM_HEADER_P (const line_map_ordinary *ord_map)
      |                                        ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘ORDINARY_MAP_IN_SYSTEM_HEADER_P’:
../.././libcpp/include/line-map.h:660:17: error: request for member ‘sysp’ in something not a structure or union
  660 |   return ord_map->sysp;
      |                 ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:666:21: error: unknown type name ‘line_map’
  666 | MAP_MODULE_P (const line_map *map)
      |                     ^~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MAP_MODULE_P’:
../.././libcpp/include/line-map.h:669:42: error: request for member ‘reason’ in something not a structure or union
  669 |           && linemap_check_ordinary (map)->reason == LC_MODULE);
      |                                          ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:675:31: error: unknown type name ‘line_map_ordinary’
  675 | ORDINARY_MAP_FILE_NAME (const line_map_ordinary *ord_map)
      |                               ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘ORDINARY_MAP_FILE_NAME’:
../.././libcpp/include/line-map.h:677:17: error: request for member ‘to_file’ in something not a structure or union
  677 |   return ord_map->to_file;
      |                 ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:682:8: error: unknown type name ‘cpp_hashnode’
  682 | inline cpp_hashnode *
      |        ^~~~~~~~~~~~
../.././libcpp/include/line-map.h:683:24: error: unknown type name ‘line_map_macro’
  683 | MACRO_MAP_MACRO (const line_map_macro *macro_map)
      |                        ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MACRO_MAP_MACRO’:
../.././libcpp/include/line-map.h:685:19: error: request for member ‘macro’ in something not a structure or union
  685 |   return macro_map->macro;
      |                   ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:692:35: error: unknown type name ‘line_map_macro’
  692 | MACRO_MAP_NUM_MACRO_TOKENS (const line_map_macro *macro_map)
      |                                   ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MACRO_MAP_NUM_MACRO_TOKENS’:
../.././libcpp/include/line-map.h:694:19: error: request for member ‘n_tokens’ in something not a structure or union
  694 |   return macro_map->n_tokens;
      |                   ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:701:28: error: unknown type name ‘line_map_macro’
  701 | MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
      |                            ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MACRO_MAP_LOCATIONS’:
../.././libcpp/include/line-map.h:703:19: error: request for member ‘macro_locations’ in something not a structure or union
  703 |   return macro_map->macro_locations;
      |                   ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:709:43: error: unknown type name ‘line_map_macro’
  709 | MACRO_MAP_EXPANSION_POINT_LOCATION (const line_map_macro *macro_map)
      |                                           ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘MACRO_MAP_EXPANSION_POINT_LOCATION’:
../.././libcpp/include/line-map.h:711:19: error: request for member ‘expansion’ in something not a structure or union
  711 |   return macro_map->expansion;
      |                   ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:725:3: error: unknown type name ‘line_map_ordinary’
  725 |   line_map_ordinary * GTY ((length ("%h.used"))) maps;
      |   ^~~~~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:734:3: error: expected specifier-qualifier-list before ‘mutable’
  734 |   mutable unsigned int cache;
      |   ^~~~~~~
../.././libcpp/include/line-map.h:740:3: error: unknown type name ‘line_map_macro’
  740 |   line_map_macro * GTY ((length ("%h.used"))) maps;
      |   ^~~~~~~~~~~~~~
../.././libcpp/include/line-map.h:749:3: error: expected specifier-qualifier-list before ‘mutable’
  749 |   mutable unsigned int cache;
      |   ^~~~~~~
../.././libcpp/include/line-map.h:756:3: error: unknown type name ‘source_range’
  756 |   source_range src_range;
      |   ^~~~~~~~~~~~
../.././libcpp/include/line-map.h:780:1: error: unknown type name ‘class’
  780 | class GTY(()) line_maps {
      | ^~~~~
../.././libcpp/include/line-map.h:780:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  780 | class GTY(()) line_maps {
      |                         ^
../.././libcpp/include/line-map.h:826:2: warning: ISO C does not allow extra ‘;’ outside of a function (-Wpedantic)
  826 | };
      |  ^
../.././libcpp/include/line-map.h:831:27: error: unknown type name ‘line_maps’
  831 | LINEMAPS_ALLOCATED (const line_maps *set, bool map_kind)
      |                           ^~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘LINEMAPS_ALLOCATED’:
../.././libcpp/include/line-map.h:834:15: error: request for member ‘info_macro’ in something not a structure or union
  834 |     return set->info_macro.allocated;
      |               ^~
../.././libcpp/include/line-map.h:836:15: error: request for member ‘info_ordinary’ in something not a structure or union
  836 |     return set->info_ordinary.allocated;
      |               ^~
../.././libcpp/include/line-map.h: At top level:
../.././libcpp/include/line-map.h:841:21: error: expected identifier or ‘(’ before ‘&’ token
  841 | inline unsigned int &
      |                     ^
../.././libcpp/include/line-map.h:853:22: error: unknown type name ‘line_maps’
  853 | LINEMAPS_USED (const line_maps *set, bool map_kind)
      |                      ^~~~~~~~~
../.././libcpp/include/line-map.h: In function ‘LINEMAPS_USED’:
../.././libcpp/include/line-map.h:856:15: error: request for member ‘info_macro’ in something not a structure or union
  856 |     return set->info_macro.used;
      |               ^~
../.././libcpp/include/line-map.h:858:15: error: request for member ‘info_ordinary’ in something not a structure or union
  858 |     return set->info_ordinary.used;

Final:

make(3): *** (Makefile:226: charset.o) Error 1
make(3): se sale del directorio '/gcc12/gcc/build-x86_64-pc-linux-gnu/libcpp'
make(2): *** (Makefile:2955: all-build-libcpp) Error 2
make(2): se sale del directorio '/gcc12/gcc'
make(1): *** (Makefile:29328: stage1-bubble) Error 2
make(1): se sale del directorio '/gcc12/gcc'
make: *** (Makefile:1008: all) Error 2

¿Esto cómo se soluciona? De no poderse solucionar los 500 errores (aquí se muestran aproximadamente 100), al menos, ¿Cómo soluciono el primer error, o alguno de ellos?

compilar – GCC 12 – gmp/mpn: libtool: error: ‘fib_table.lo’ is not a valid libtool object

compilar – GCC 12 – gmp/mpn: libtool: error: ‘fib_table.lo’ is not a valid libtool object – Stack Overflow en español

c – Cannot expand and concatenate GCC macros into one

I have a set of #defines like that:

#define PORTA port_a
#define PORTB port_b
#define PORTC port_c

And some re-definitions of these into:

#define MY_PORT1 PORTA
#define MY_PORT2 PORTB
#define MY_PORT3 PORTC

And also a series of xxx_set(param1, param2) functions where xxx belongs to each PORTx, so:

PORTA_set(param1, param2)
PORTB_set(param1, param2)
PORTC_set(param1, param2) 

I need to call these functions but using a single one, with my “custom port name” as the first parameter, so example:

set(MY_PORT1, param1, param2) must expand to PORTA_set(param1, param2), and so on.

I tried after reading several similar questions, related to expansion of macros into concatenations:

#define CAT_I( x, y ) x ## y
#define CAT( x, y ) CAT_I( x, y )
#define set( port, param1, param2 ) CAT( port, _set )(param1, param2)

But this throws me error

expected ';' before '_set'
pasting ")" and "_set" does not give a valid preprocessing token

What am I missing?

package management – Not able to install gcc

When running sudo apt install gcc give following output:

Err:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc-dev-bin amd64 2.27-3ubuntu1.4               
  Could not resolve 'in.archive.ubuntu.com'
Ign:2 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-142.146
Err:3 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dev amd64 2.27-3ubuntu1.4
  Could not resolve 'in.archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-142.146
  Could not resolve 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc-dev-bin_2.27-3ubuntu1.4_amd64.deb  Could not resolve 'in.archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-142.146_amd64.deb  Could not resolve 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dev_2.27-3ubuntu1.4_amd64.deb  Could not resolve 'in.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

digital signature – gnu gcc source archives signed with expired GPG key?

The pedantic answer to your question is: when gcc-9.3.0 was released, the key was not yet expired:

$ gpg --verify gcc-9.3.0.tar.gz.sig gcc-9.3.0.tar.gz
gpg: Signature made Thu 12 Mar 2020 07:32:47 AM EDT
gpg:                using DSA key A328C3A2C3C45C06 

The signature was made in March 2020, but the key expired in September 2020:

gpg --list-keys A328C3A2C3C45C06
pub   dsa1024/A328C3A2C3C45C06 2004-04-21 [SC] [expired: 2020-09-10]
      33C235A34C46AA3FFB293709A328C3A2C3C45C06

So, the fact that it’s expired now is not a cause for concern.

What is the cause for concern is that it’s a 1024/DSA key, which is probably not considered sufficiently strong these days. However, I can also see that the author has a newer key created in May, 2020:

pub   rsa4096/6C35B99309B5FA62 2020-05-28 [SC]
      D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62

So, perhaps the next release of gcc will be signed with this key instead.

string – O que torna este programa em C inutilizado quando compilado em diferentes versões do GCC ou Clang?

Este programa em linguagem C é compilado em todas as versões do GCC sem nenhuma mensagem de erro, mas especificamente no GCC 6.3 e 8.3, o executável produz resultados totalmente incoerentes. No GCC 8.1 e 10.2 (os que eu uso na minha máquina) ele funciona perfeitamente. Qual pode ser a explicação?

/*
    Crie uma função do zero para determinar se uma string é palíndromo ou não
    (ignoring case and blank spaces). A utilização da biblioteca <string.h> não 
    é permitida.
*/

/*libraries*/
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
/*libraries*/

/*Fixed string max size*/
#define SIZE 100
/*Fixed string max size*/

/*strlen from scratch*/
size_t strlength(char *str) {
    size_t size = 0;
    while (str(++size) != '');
    return size;
}
/*strlen from scratch*/

/*Take off 'n' from fgets input*/
void takeOffNewLine(char *str) {
    str(strlength(str) - 1) = ('');
}
/*Take off 'n' from fgets input*/

/*strcpy from scratch*/
void strcopy(char *strDest, char *strSource) {
    size_t sourceSize = strlength(strSource);

    for (size_t i = 0; i <= sourceSize; i++) {
        strDest(i) = strSource(i);
    }
}
/*strcpy from scratch*/

/*Take off ' ' whitespaces from a string*/
void takeOffBlankChars(char *str) {
    size_t size = strlength(str);
    
    for (size_t i = 0; str(i) != ''; i++) {
        if (str(i) == ' ') {
            for (size_t j = i; j <= size; j++) {
                str(j) = str(j + 1); 
            }
            i--; 
            /*
             * O decremento do iterador "i" 
             * mantém o array de caracteres na 
             * mesma posição onde o caractere 
             * em branco foi encontrado, com o 
             * intuito de checar se há outro 
             * whitespace em "str(i + 1)", que 
             * foi reposicionado para "str(i)".
             */  
        }
    }
}
/*Take off ' ' whitespaces from a string*/

/*entire string to lowercase*/
void strToLower(char *str) {
    size_t size = strlength(str);

    for (size_t i = 0; i < size; i++) {
        str(i) = tolower(str(i));
    }
    str(size) = '';
}
/*entire string to lowercase*/

/*invert string*/
void invertStr(char *strSource, char *strInverted) {
    size_t size = strlength(strSource);
    
    for (size_t i = 0; i < size; i++) {
        strInverted(i) = strSource(size - i - 1);
    }
    strInverted(size) = ('');
}
/*invert string*/

/*check if they're palindromes*/
bool strccmp (char *str1, char *str2) {
    size_t sizeStr1 = strlength(str1);
    size_t sizeStr2 = strlength(str2);

    if(sizeStr1 != sizeStr2) {
        return false;
    }

    size_t size = sizeStr1;

    char *str1LwrCase = malloc(sizeof(char) * (size + 1));
    char *str2LwrCase = malloc(sizeof(char) * (size + 1));
    if (str1LwrCase == 0 || str2LwrCase == 0)
    {
        printf("Memory Allocation error in <<strccmp()>>n");
        return false;
    }
    
    strcopy(str1LwrCase, str1);
    strcopy(str2LwrCase, str2);

    takeOffBlankChars(str1LwrCase);
    takeOffBlankChars(str2LwrCase);

    strToLower(str1LwrCase);
    strToLower(str2LwrCase);

    bool isEqual = true;
    for (size_t i = 0; str1LwrCase(i) != ''; i++) {
        if(str1LwrCase(i) != str2LwrCase(i)) {
            isEqual = false;
            free(str1LwrCase);
            free(str2LwrCase);
            return isEqual;
        }
    }
    free(str1LwrCase);
    free(str2LwrCase);
    return isEqual;
}
/*check if they're palindromes*/

int main(void) {
    char s1(SIZE) = {''};
    char s2(SIZE) = {''};

    fgets(s1, SIZE, stdin);
    takeOffNewLine(s1);
    
    invertStr(s1, s2);

    if (strccmp(s1, s2)) {
        printf("It's a palindrome.n");
    } 
    else {
        printf("It's not a palindrome.n");
    }
    
    return EXIT_SUCCESS;
}

String input (que É um palídromo) testado por mim: L I V R E do poder vil

Resultado incorreto em:

  • ideone (GCC 8.3)
  • codechef (GCC 6.3)

Resultado correto em:

  • onlinegdb
  • programiz
  • tutorialspoint
  • repl.it (Clang 7.0)
  • jdoodle (GCC 5.3, 7.2, 8.1 e 9.1)
  • Na minha máquina Windows 10 com MinGW64 e GCC 10.2

command line – MacOS Big Sur : impossible to compile with a C++ code with Intel compiler and GCC

I was initially on the wrong forum for this question, so I ask here and going to delete the old one.

I have just migrated from Catalina to Big Sur and I have issues when compiling a simple C++ code.

Both gcc4.9 and icpc don’t work whereas there we no problems with Catalina.

For intel, I thought that installing CTL (Command Tools line) version 11 would be sufficient but this is not the case : indeed, it is misssing the package Headers .pkg in CTL version 11 : how can I do without these Headers now ?

For the instant, I get these errors :

icpc -std=c++11 -O3 -xHost -qopenmp -Wall -c -I/opt/intel/compilers_and_libraries_2020.4.301/mac/mkl/include -I/Library/Developer/CommandLineTools/usr/include/c++/v1 -mkl=parallel main.cpp -o main.o
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/math.h(311),
                 from /opt/intel/compilers_and_libraries_2020.4.301/mac/compiler/include/math.h(177),
                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath(304),
                 from TSAF.h(1),
                 from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits(903): error: type name is not allowed
      __is_function(_Tp)
                    ^

In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/math.h(311),
                 from /opt/intel/compilers_and_libraries_2020.4.301/mac/compiler/include/math.h(177),
                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath(304),
                 from TSAF.h(1),
                 from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits(903): error: identifier "__is_function" is undefined
      __is_function(_Tp)
      ^

In file included from TSAF.h(2),
                 from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits(903): error: type name is not allowed
      __is_function(_Tp)
                    ^
          detected during:
            instantiation of class "std::__1::is_function<_Tp> (with _Tp=long long ****************************************************************************************************)" at line 1360
            instantiation of class "std::__1::__decay<_Up, true> (with _Up=long long ****************************************************************************************************)" at line 1373
            instantiation of class "std::__1::decay<_Tp> (with _Tp=long long ****************************************************************************************************)" at line 2119
            instantiation of class "std::__1::common_type<_Tp, _Up> (with _Tp=long long ****************************************************************************************************, _Up=long long ****************************************************************************************************)" at line 2118
            instantiation of class "std::__1::common_type<_Tp, _Up> (with _Tp=long long ***************************************************************************************************, _Up=long long ***************************************************************************************************)" at line 2118
            ( 97 instantiation contexts not shown )
            instantiation of class "std::__1::common_type<_Tp, _Up> (with _Tp=long long *, _Up=long long *)" at line 2118
            instantiation of class "std::__1::common_type<_Tp, _Up> (with _Tp=long long, _Up=long long)" at line 874 of "/Library/Developer/CommandLineTools/usr/include/c++/v1/chrono"
            instantiation of class "std::__1::common_type<std::__1::chrono::duration<_Rep1, _Period1>, std::__1::chrono::duration<_Rep2, _Period2>> (with _Rep1=long long, _Period1=std::__1::micro, _Rep2=long long, _Period2=std::__1::micro)" at line 2112
            instantiation of class "std::__1::common_type<_Tp> (with _Tp=std::__1::chrono::duration<long long, std::__1::micro>)" at line 1101 of "/Library/Developer/CommandLineTools/usr/include/c++/v1/chrono"
            instantiation of class "std::__1::chrono::duration<_Rep, _Period> (with _Rep=long long, _Period=std::__1::micro)" at line 1575 of "/Library/Developer/CommandLineTools/usr/include/c++/v1/chrono"

In file included from TSAF.h(2),
                 from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits(903): error: type name is not allowed
      __is_function(_Tp)
...

For gcc4.9, I get the following error :

/var/folders/1n/6wz8wzkn63n8y1zc2xjcm6640000gn/T//cchw3bHI.s:51804:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/1n/6wz8wzkn63n8y1zc2xjcm6640000gn/T//cchw3bHI.s:51804:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
g++-4.9 -std=c++11 -O3 -fopenmp  main.o TSAF_gnu.o -o main_gnu.exe
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make: *** (Makefile:10: main_gnu.exe) Error 1

It seems not be able to find the library System, I don’t understand anything.

If someone could help me in these 2 issues.

UPDATE 1 :

For gcc, I have the following flags :

CXX = g++-4.9 -std=c++11 -O3 -fopenmp
CXXFLAGS = -Wall -c -I/Library/Developer/CommandLineTools/usr/include/c++/v1/
LDFLAGS = -march=native
LDFLAGS =
SOURCES = main.cpp TSAF_gnu.cpp
EXECUTABLE = main_gnu.exe

but same errors than above : ld: library not found for -lSystem

raspberry pi – Running gcc c code does not work/ can’t import python.h

I’m running some c code on a raspberry pi. The gcc compiler is having trouble with this:

#include "Python.h"

It says:

/home/pi/AIY-voice-kit-python/src/examples/voice/speack.c:4:10: fatal error: Python.h: No such file or directory
 #include "Python.h"
          ^~~~~~~~~~
compilation terminated.

I tried what was said on this site but it did not work.
https://blog.ducthinh.net/gcc-no-such-file-python-h/

Can anyone help me fix this?

gcc – conflicting libraries in usage

I am trying to compile a binary which links to libcrypto.so.1.1 and my binary also links against another library (Let us call this library libblah.so)

This libblah.so links against libcrypto.so.1.0. During the compilation, I get a warning saying that there is a conflicting linking of library for libcrypto.

Though, I am not directly linking libcrypto 1.0 and 1.1 in my 1st level of linking, I am seeing this error. I am interested in understanding what issues might this cause during the runtime.

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies