[MacPorts] #72403: GCC can't compile simple C++ programs

MacPorts noreply at macports.org
Fri Apr 25 15:50:30 UTC 2025


#72403: GCC can't compile simple C++ programs
----------------------+--------------------
 Reporter:  szhorvat  |      Owner:  (none)
     Type:  defect    |     Status:  new
 Priority:  Normal    |  Milestone:
Component:  ports     |    Version:
 Keywords:            |       Port:  gcc14
----------------------+--------------------
 For quite some time now, GCC 14 wasn't able to compile simple programs
 without errors. For example, `#include <iostream>` already triggers
 errors. Is this a known issue? Is it specific to my setup (I don't see how
 it would be)?

 Example:

 {{{
 // prog.cpp

 #include <iostream>

 int main() {
     std::cout << "Hello world!" << std::endl;
     return 0;
 }
 }}}

 Errors:

 {{{
 g++-mp-14 prog.cpp
 In file included from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/machine/_structs.h:35,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/arm/_mcontext.h:36,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/machine/_mcontext.h:34,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/sys/signal.h:146,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/sys/wait.h:109,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdlib.h:70,
                  from
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdlib.h:58,
                  from /opt/local/include/gcc14/c++/cstdlib:79,
                  from
 /opt/local/include/gcc14/c++/ext/string_conversions.h:43,
                  from
 /opt/local/include/gcc14/c++/bits/basic_string.h:4154,
                  from /opt/local/include/gcc14/c++/string:54,
                  from
 /opt/local/include/gcc14/c++/bits/locale_classes.h:40,
                  from /opt/local/include/gcc14/c++/bits/ios_base.h:41,
                  from /opt/local/include/gcc14/c++/ios:44,
                  from /opt/local/include/gcc14/c++/ostream:40,
                  from /opt/local/include/gcc14/c++/iostream:41,
                  from prog.cpp:3:
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:627:35:
 error: expected primary-expression before 'unsigned'
   627 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                                   ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:627:26:
 error: '_Alignof' was not declared in this scope
   627 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                          ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:633:35:
 error: expected primary-expression before 'unsigned'
   633 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                                   ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:633:26:
 error: '_Alignof' was not declared in this scope
   633 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                          ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:639:35:
 error: expected primary-expression before 'unsigned'
   639 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                                   ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:639:26:
 error: '_Alignof' was not declared in this scope
   639 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                          ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:645:35:
 error: expected primary-expression before 'unsigned'
   645 | } __attribute__((aligned(_Alignof(unsigned int))));
       |                                   ^~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h:645:26:
 error: '_Alignof' was not declared in this scope
   645 | } __attribute__((aligned(_Alignof(unsigned int))));
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/72403>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list