You are not logged in.

#1 2024-06-29 08:59:55

vanyarch
Member
Registered: 2024-06-29
Posts: 8

[SOLVED] System can't compile C++ anymore

I can't build C++ programs anymore, I don't really have a clue what happened to my system. Even the simplest hello world compiled with g++ gives me:

In file included from /usr/include/c++/14.1.1/bits/basic_string.h:4154,
                 from /usr/include/c++/14.1.1/string:54,
                 from /usr/include/c++/14.1.1/bits/locale_classes.h:40,
                 from /usr/include/c++/14.1.1/bits/ios_base.h:41,
                 from /usr/include/c++/14.1.1/ios:44,
                 from /usr/include/c++/14.1.1/ostream:40,
                 from /usr/include/c++/14.1.1/iostream:41,
                 from main.cpp:3:
/usr/include/c++/14.1.1/ext/string_conversions.h: In function '_Ret __gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)':
/usr/include/c++/14.1.1/ext/string_conversions.h:86:25: error: 'ERANGE' was not declared in this scope
   86 |       else if (errno == ERANGE
      |                         ^~~~~~
In file included from /usr/include/c++/14.1.1/system_error:41,
                 from /usr/include/c++/14.1.1/bits/ios_base.h:46:
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h: At global scope:
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:42:49: error: 'EAFNOSUPPORT' was not declared in this scope
   42 |       address_family_not_supported =            EAFNOSUPPORT,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:43:49: error: 'EADDRINUSE' was not declared in this scope
   43 |       address_in_use =                          EADDRINUSE,
      |                                                 ^~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:44:49: error: 'EADDRNOTAVAIL' was not declared in this scope
   44 |       address_not_available =                   EADDRNOTAVAIL,
      |                                                 ^~~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:45:49: error: 'EISCONN' was not declared in this scope
   45 |       already_connected =                       EISCONN,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:46:49: error: 'E2BIG' was not declared in this scope
   46 |       argument_list_too_long =                  E2BIG,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:47:49: error: 'EDOM' was not declared in this scope
   47 |       argument_out_of_domain =                  EDOM,
      |                                                 ^~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:48:49: error: 'EFAULT' was not declared in this scope
   48 |       bad_address =                             EFAULT,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:49:49: error: 'EBADF' was not declared in this scope
   49 |       bad_file_descriptor =                     EBADF,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:55:49: error: 'EPIPE' was not declared in this scope
   55 |       broken_pipe =                             EPIPE,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:56:49: error: 'ECONNABORTED' was not declared in this scope
   56 |       connection_aborted =                      ECONNABORTED,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:57:49: error: 'EALREADY' was not declared in this scope
   57 |       connection_already_in_progress =          EALREADY,
      |                                                 ^~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:58:49: error: 'ECONNREFUSED' was not declared in this scope
   58 |       connection_refused =                      ECONNREFUSED,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:59:49: error: 'ECONNRESET' was not declared in this scope
   59 |       connection_reset =                        ECONNRESET,
      |                                                 ^~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:60:49: error: 'EXDEV' was not declared in this scope
   60 |       cross_device_link =                       EXDEV,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:61:49: error: 'EDESTADDRREQ' was not declared in this scope
   61 |       destination_address_required =            EDESTADDRREQ,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:62:49: error: 'EBUSY' was not declared in this scope
   62 |       device_or_resource_busy =                 EBUSY,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:63:49: error: 'ENOTEMPTY' was not declared in this scope
   63 |       directory_not_empty =                     ENOTEMPTY,
      |                                                 ^~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:64:49: error: 'ENOEXEC' was not declared in this scope
   64 |       executable_format_error =                 ENOEXEC,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:65:49: error: 'EEXIST' was not declared in this scope
   65 |       file_exists =                             EEXIST,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:66:49: error: 'EFBIG' was not declared in this scope
   66 |       file_too_large =                          EFBIG,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:67:49: error: 'ENAMETOOLONG' was not declared in this scope
   67 |       filename_too_long =                       ENAMETOOLONG,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:68:49: error: 'ENOSYS' was not declared in this scope
   68 |       function_not_supported =                  ENOSYS,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:69:49: error: 'EHOSTUNREACH' was not declared in this scope
   69 |       host_unreachable =                        EHOSTUNREACH,
      |                                                 ^~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:75:49: error: 'EILSEQ' was not declared in this scope
   75 |       illegal_byte_sequence =                   EILSEQ,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:76:49: error: 'ENOTTY' was not declared in this scope
   76 |       inappropriate_io_control_operation =      ENOTTY,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:77:49: error: 'EINTR' was not declared in this scope
   77 |       interrupted =                             EINTR,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:78:49: error: 'EINVAL' was not declared in this scope
   78 |       invalid_argument =                        EINVAL,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:79:49: error: 'ESPIPE' was not declared in this scope
   79 |       invalid_seek =                            ESPIPE,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:80:49: error: 'EIO' was not declared in this scope
   80 |       io_error =                                EIO,
      |                                                 ^~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:81:49: error: 'EISDIR' was not declared in this scope
   81 |       is_a_directory =                          EISDIR,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:82:49: error: 'EMSGSIZE' was not declared in this scope
   82 |       message_size =                            EMSGSIZE,
      |                                                 ^~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:83:49: error: 'ENETDOWN' was not declared in this scope
   83 |       network_down =                            ENETDOWN,
      |                                                 ^~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:84:49: error: 'ENETRESET' was not declared in this scope
   84 |       network_reset =                           ENETRESET,
      |                                                 ^~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:85:49: error: 'ENETUNREACH' was not declared in this scope
   85 |       network_unreachable =                     ENETUNREACH,
      |                                                 ^~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:86:49: error: 'ENOBUFS' was not declared in this scope
   86 |       no_buffer_space =                         ENOBUFS,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:87:49: error: 'ECHILD' was not declared in this scope
   87 |       no_child_process =                        ECHILD,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:93:49: error: 'ENOLCK' was not declared in this scope
   93 |       no_lock_available =                       ENOLCK,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:99:49: error: 'ENOMSG' was not declared in this scope
   99 |       no_message =                              ENOMSG,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:100:49: error: 'ENOPROTOOPT' was not declared in this scope
  100 |       no_protocol_option =                      ENOPROTOOPT,
      |                                                 ^~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:101:49: error: 'ENOSPC' was not declared in this scope
  101 |       no_space_on_device =                      ENOSPC,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:107:49: error: 'ENXIO' was not declared in this scope
  107 |       no_such_device_or_address =               ENXIO,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:108:49: error: 'ENODEV' was not declared in this scope
  108 |       no_such_device =                          ENODEV,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:109:49: error: 'ENOENT' was not declared in this scope
  109 |       no_such_file_or_directory =               ENOENT,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:110:49: error: 'ESRCH' was not declared in this scope
  110 |       no_such_process =                         ESRCH,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:111:49: error: 'ENOTDIR' was not declared in this scope
  111 |       not_a_directory =                         ENOTDIR,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:112:49: error: 'ENOTSOCK' was not declared in this scope
  112 |       not_a_socket =                            ENOTSOCK,
      |                                                 ^~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:118:49: error: 'ENOTCONN' was not declared in this scope
  118 |       not_connected =                           ENOTCONN,
      |                                                 ^~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:119:49: error: 'ENOMEM' was not declared in this scope
  119 |       not_enough_memory =                       ENOMEM,
      |                                                 ^~~~~~
In file included from /usr/include/errno.h:28,
                 from /usr/include/c++/14.1.1/cerrno:42,
                 from /usr/include/c++/14.1.1/ext/string_conversions.h:46:
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:122:49: error: 'EOPNOTSUPP' was not declared in this scope; did you mean 'ENOTSUP'?
  122 |       not_supported =                           ENOTSUP,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:129:49: error: 'EINPROGRESS' was not declared in this scope
  129 |       operation_in_progress =                   EINPROGRESS,
      |                                                 ^~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:130:49: error: 'EPERM' was not declared in this scope
  130 |       operation_not_permitted =                 EPERM,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:131:49: error: 'EOPNOTSUPP' was not declared in this scope; did you mean 'ENOTSUP'?
  131 |       operation_not_supported =                 EOPNOTSUPP,
      |                                                 ^~~~~~~~~~
      |                                                 ENOTSUP
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:132:49: error: 'EWOULDBLOCK' was not declared in this scope
  132 |       operation_would_block =                   EWOULDBLOCK,
      |                                                 ^~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:138:49: error: 'EACCES' was not declared in this scope
  138 |       permission_denied =                       EACCES,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:144:49: error: 'EPROTONOSUPPORT' was not declared in this scope
  144 |       protocol_not_supported =                  EPROTONOSUPPORT,
      |                                                 ^~~~~~~~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:145:49: error: 'EROFS' was not declared in this scope; did you mean 'EOF'?
  145 |       read_only_file_system =                   EROFS,
      |                                                 ^~~~~
      |                                                 EOF
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:146:49: error: 'EDEADLK' was not declared in this scope
  146 |       resource_deadlock_would_occur =           EDEADLK,
      |                                                 ^~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:147:49: error: 'EAGAIN' was not declared in this scope
  147 |       resource_unavailable_try_again =          EAGAIN,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:148:49: error: 'ERANGE' was not declared in this scope
  148 |       result_out_of_range =                     ERANGE,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:162:49: error: 'ETIMEDOUT' was not declared in this scope
  162 |       timed_out =                               ETIMEDOUT,
      |                                                 ^~~~~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:163:49: error: 'ENFILE' was not declared in this scope; did you mean 'FILE'?
  163 |       too_many_files_open_in_system =           ENFILE,
      |                                                 ^~~~~~
      |                                                 FILE
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:164:49: error: 'EMFILE' was not declared in this scope; did you mean 'FILE'?
  164 |       too_many_files_open =                     EMFILE,
      |                                                 ^~~~~~
      |                                                 FILE
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:165:49: error: 'EMLINK' was not declared in this scope
  165 |       too_many_links =                          EMLINK,
      |                                                 ^~~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:166:49: error: 'ELOOP' was not declared in this scope
  166 |       too_many_symbolic_link_levels =           ELOOP,
      |                                                 ^~~~~
/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/error_constants.h:174:49: error: 'EPROTOTYPE' was not declared in this scope
  174 |       wrong_protocol_type =                     EPROTOTYPE
      |                                                 ^~~~~~~~~~

Same errors appear with clang:

$ LANG=C clang++ -Wall main.cpp -o test

In file included from main.cpp:3:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/iostream:41:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/ostream:40:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/ios:44:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ios_base.h:41:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/locale_classes.h:40:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/string:54:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/basic_string.h:4154:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/ext/string_conversions.h:86:25: error: use of undeclared identifier 'ERANGE'
   86 |       else if (errno == ERANGE
      |

I also tried to execute g++ in a clean environment (env -i g++ main.cpp) and reinstalling some packages (gcc gcc-libs glibc) but I get the same output.

"pacman -Qkk glibc" returns "glibc: 1611 total files, 0 altered files"

Any ideas?

Last edited by vanyarch (2024-07-04 20:28:10)

Offline

#2 2024-06-29 11:45:00

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

Re: [SOLVED] System can't compile C++ anymore

You may be mssing some includes or have corrupted header files.

https://stackoverflow.com/questions/682 … ry-headers may be helpful .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-06-29 12:36:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] System can't compile C++ anymore

More specifically this is due to errno.h or an equivalent not being included.  I'm not much for c++ standards, but c++11 (and later I'd assume) define equivalents to this.  So I'd wager it's really just missing a compiler flag like -std=c++11


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2024-07-03 18:57:25

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

I'm not sure that is a problem of source code, as it happens even with a hello world:

#include <iostream>
using namespace std;

int main()
{
        cout << "Hello World";

        return 0;
}

Last edited by vanyarch (2024-07-03 18:58:21)

Offline

#5 2024-07-03 19:15:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] System can't compile C++ anymore

How about `pacman -Qkk gcc`?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2024-07-03 20:15:07

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

It seems good:

$ pacman -Qkk gcc

gcc: 2647 total files, 0 altered files

Offline

#7 2024-07-03 22:42:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] System can't compile C++ anymore

Okay, long-shot, but how about the following with the minimal example code above:

env -i PATH=/usr/bin /usr/bin/g++ helloworld.cpp

Last edited by Trilby (2024-07-04 14:12:23)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2024-07-04 14:08:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED] System can't compile C++ anymore

"g++ -v" might shed some light

Online

#9 2024-07-04 15:42:17

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

Trilby wrote:

Okay, long-shot, but how about the following with the minimal example code above:

env -i PATH=/usr/bin /usr/bin/g++ helloworld.cpp

Still the same result unfortunately:

$ env -i PATH=/usr/bin /usr/bin/g++ helloworld.cpp
In file included from /usr/include/c++/14.1.1/bits/basic_string.h:4154,
                 from /usr/include/c++/14.1.1/string:54,
                 from /usr/include/c++/14.1.1/bits/locale_classes.h:40,
                 from /usr/include/c++/14.1.1/bits/ios_base.h:41,
                 from /usr/include/c++/14.1.1/ios:44,
                 from /usr/include/c++/14.1.1/ostream:40,
                 from /usr/include/c++/14.1.1/iostream:41,
                 from cpp.cpp:3:
/usr/include/c++/14.1.1/ext/string_conversions.h: In function '_Ret __gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)':
/usr/include/c++/14.1.1/ext/string_conversions.h:86:25: error: 'ERANGE' was not declared in this scope
   86 |       else if (errno == ERANGE
      |                         ^~~~~~
...
seth wrote:

"g++ -v" might shed some light

Hope it helps!

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240522 (GCC

Offline

#10 2024-07-04 15:49:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED] System can't compile C++ anymore

Err… passing the -v to the building g++ call wink

Online

#11 2024-07-04 15:53:04

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

Oops, sorry smile

$ g++ -v helloworld.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240522 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/cc1plus -quiet -v -D_GNU_SOURCE helloworld.cpp -quiet -dumpdir a- -dumpbase helloworld.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -o /tmp/ccpllkMG.s
GNU C++17 (GCC) version 14.1.1 20240522 (x86_64-pc-linux-gnu)
	compiled by GNU C version 14.1.1 20240522, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include-fixed
 /usr/include
End of search list.
Compiler executable checksum: 29a4cbac9a82c8094a8662004ee682d4
In file included from /usr/include/c++/14.1.1/bits/basic_string.h:4154,
                 from /usr/include/c++/14.1.1/string:54,
                 from /usr/include/c++/14.1.1/bits/locale_classes.h:40,
                 from /usr/include/c++/14.1.1/bits/ios_base.h:41,
                 from /usr/include/c++/14.1.1/ios:44,
                 from /usr/include/c++/14.1.1/ostream:40,
                 from /usr/include/c++/14.1.1/iostream:41,
                 from helloworld.cpp:3:
/usr/include/c++/14.1.1/ext/string_conversions.h: In function '_Ret __gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)':
/usr/include/c++/14.1.1/ext/string_conversions.h:86:25: error: 'ERANGE' was not declared in this scope
   86 |       else if (errno == ERANGE
      |                         ^~~~~~

(edit: fixed my copy paste)

Last edited by vanyarch (2024-07-04 16:29:14)

Offline

#12 2024-07-04 16:21:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] System can't compile C++ anymore

On line #9 yours has "-dumpbase cpp.cpp" where it should be "-dumpbase helloworld.cpp" and then later the "backtrace" of includes ends in cpp.cpp, not the actual source file helloworld.cpp.  By any chance is your file *actually* called cpp.cpp and you just edited the command line to represent it as helloworld.cpp?

Other than that everything looks normal right up to the error.

Last edited by Trilby (2024-07-04 16:22:58)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2024-07-04 16:26:05

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

Yes, I copy-pasted multiple times in my message by mistake but I've got 2 or 3 files with the same content haha, sorry about that

Offline

#14 2024-07-04 19:43:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED] System can't compile C++ anymore

cerrnotest.cpp

#include <cerrno>
gcc -E cerrnotest.cpp

Online

#15 2024-07-04 20:05:38

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

If the file have to contain only the include, here is the result:

# 0 "cerrnotest.cpp"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "cerrnotest.cpp"
# 1 "/usr/include/c++/14.1.1/cerrno" 1 3
# 39 "/usr/include/c++/14.1.1/cerrno" 3

# 40 "/usr/include/c++/14.1.1/cerrno" 3

# 1 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 1 3
# 33 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3

# 34 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
# 308 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3

# 308 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace std
{
  typedef long unsigned int size_t;
  typedef long int ptrdiff_t;


  typedef decltype(nullptr) nullptr_t;


#pragma GCC visibility push(default)


  extern "C++" __attribute__ ((__noreturn__, __always_inline__))
  inline void __terminate() noexcept
  {
    void terminate() noexcept __attribute__ ((__noreturn__,__cold__));
    terminate();
  }
#pragma GCC visibility pop
}
# 341 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace std
{
  inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
namespace __gnu_cxx
{
  inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
# 534 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace std
{
#pragma GCC visibility push(default)




  __attribute__((__always_inline__))
  constexpr inline bool
  __is_constant_evaluated() noexcept
  {





    return __builtin_is_constant_evaluated();



  }
#pragma GCC visibility pop
}
# 573 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace std
{
#pragma GCC visibility push(default)

  extern "C++" __attribute__ ((__noreturn__))
  void
  __glibcxx_assert_fail
    (const char* __file, int __line, const char* __function,
     const char* __condition)
  noexcept;
#pragma GCC visibility pop
}
# 601 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace std
{
  __attribute__((__always_inline__,__visibility__("default")))
  inline void
  __glibcxx_assert_fail()
  { }
}
# 680 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
# 1 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/os_defines.h" 1 3
# 39 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/os_defines.h" 3
# 1 "/usr/include/features.h" 1 3 4
# 394 "/usr/include/features.h" 3 4
# 1 "/usr/include/features-time64.h" 1 3 4
# 20 "/usr/include/features-time64.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 21 "/usr/include/features-time64.h" 2 3 4
# 1 "/usr/include/bits/timesize.h" 1 3 4
# 19 "/usr/include/bits/timesize.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 20 "/usr/include/bits/timesize.h" 2 3 4
# 22 "/usr/include/features-time64.h" 2 3 4
# 395 "/usr/include/features.h" 2 3 4
# 503 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 576 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 577 "/usr/include/sys/cdefs.h" 2 3 4
# 1 "/usr/include/bits/long-double.h" 1 3 4
# 578 "/usr/include/sys/cdefs.h" 2 3 4
# 504 "/usr/include/features.h" 2 3 4
# 527 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 10 "/usr/include/gnu/stubs.h" 3 4
# 1 "/usr/include/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/gnu/stubs.h" 2 3 4
# 528 "/usr/include/features.h" 2 3 4
# 40 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/os_defines.h" 2 3
# 681 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 2 3


# 1 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/cpu_defines.h" 1 3
# 684 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 2 3
# 825 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
namespace __gnu_cxx
{
  typedef __decltype(0.0bf16) __bfloat16_t;
}
# 887 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 3
# 1 "/usr/include/c++/14.1.1/pstl/pstl_config.h" 1 3
# 888 "/usr/include/c++/14.1.1/x86_64-pc-linux-gnu/bits/c++config.h" 2 3
# 42 "/usr/include/c++/14.1.1/cerrno" 2 3
# 1 "/usr/include/errno.h" 1 3 4
# 28 "/usr/include/errno.h" 3 4
# 1 "/usr/include/bits/errno.h" 1 3 4
# 26 "/usr/include/bits/errno.h" 3 4
# 1 "/usr/include/linux/errno.h" 1 3 4
# 27 "/usr/include/bits/errno.h" 2 3 4
# 29 "/usr/include/errno.h" 2 3 4





extern "C" {


extern int *__errno_location (void) noexcept (true) __attribute__ ((__const__));







extern char *program_invocation_name;
extern char *program_invocation_short_name;

# 1 "/usr/include/bits/types/error_t.h" 1 3 4
# 22 "/usr/include/bits/types/error_t.h" 3 4
typedef int error_t;
# 49 "/usr/include/errno.h" 2 3 4



}
# 43 "/usr/include/c++/14.1.1/cerrno" 2 3
# 2 "cerrnotest.cpp" 2

Offline

#16 2024-07-04 20:19:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED] System can't compile C++ anymore

pacman -Qikk linux-api-headers

Online

#17 2024-07-04 20:26:57

vanyarch
Member
Registered: 2024-06-29
Posts: 8

Re: [SOLVED] System can't compile C++ anymore

Name            : linux-api-headers
Version         : 6.8-1
Description     : None
Architecture    : None
URL             : None
Licenses        : None
Groups          : None
Provides        : None
Depends On      : None
Optional Deps   : None
Required By     : glibc  libbpf
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 0.00 B
Packager        : None
Build Date      : Thu Jan 1 01:00:00 1970
Install Date    : Thu Jan 1 01:00:00 1970
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Unknown

error: error while reading file /var/lib/pacman/local/linux-api-headers-6.8-1/mtree: Unrecognized archive format
linux-api-headers: no mtree file

Thank you so much! I reinstalled the package and it works now smile

Offline

Board footer

Powered by FluxBB