Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Issue with Latest Commands Lines Tools 16.3 Update

After the Update of Latest Command Line Tools 16.3 I am facing issue to compile C++ programs. Like it is giving some kind of library error in the MACOSX15.sdk file and this is the error.

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/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/cstdlib:79,
                 from /opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/stdlib.h:36,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/assert.h:44,
                 from /opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/cassert:44,
                 from /opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/aarch64-apple-darwin24/bits/stdc++.h:33,
                 from 1.cpp:1:
/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))));

But after downgrading the version to 16.2 it works fine. I can't understand that it's their any issue with Command Line Tools 16.3??

Answered by DTS Engineer in 833853022

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I use gcc for compilation.

Are you using actual GCC? Or the gcc that’s actually an alias for Clang.

If you’re just using the gcc command to run Clang, that’s something I can help you with.

OTOH, actual GCC isn’t available from Apple, so it’s not something DTS supports. If you have problems with it, I recommend that you seek help via the support channel for that tool.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have a standard process for testing whether the command-line tools are working. See Investigating Third-Party IDE Integration Problems. Please try that out and let me know how you get along.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I use gcc for compilation.

Are you using actual GCC? Or the gcc that’s actually an alias for Clang.

If you’re just using the gcc command to run Clang, that’s something I can help you with.

OTOH, actual GCC isn’t available from Apple, so it’s not something DTS supports. If you have problems with it, I recommend that you seek help via the support channel for that tool.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have installed GCC from brew and then linked it and using it in that way. Let me see if I can fix this or not but currently I am using 16.2 command line tools which is not giving me any issue I will upgrade as soon as I get the fix. Thanks

I have installed GCC from brew

OK.

That’s not something I do, so I don’t have specific advice on that front. However, my experience is that most problems like this are caused by a tools / SDK mismatch. Apple’s tool and SDKs are revlocked. When you install the Command Line Tools package, you get a set of tools and a macOS SDK that all work together. If your third-party tools rely on the macOS SDK, they either have to handle different SDK versions or they have to give you instructions on what SDK to use and how to configure that. In the latter case, if things go wrong you can run into problems like this, where you’re using tools you’re using don’t support the SDK you have installed.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

What i am trying to say is this that the problem which I am having is mainly causing after the after of the SDK tools by apple. In 16.2 it is working perfectly fine. I don't think this is the problem of GCC because many mac users use GCC installed from brew only and it is convenient to use. The main issue is what I have figured out in the latest update in one of the header file their is a keyword _Alignof. For C++ this keyword should be like _alignof but it is in the form _Align we use capital A for C not C++ which I got while reading from official GNU C++ site.

I fixed this problem by editing the system file

Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/mach/arm/_structs.h

and replacing all instances of _Alignof with __alignof. Everything worked. This is obviously a hack, but didn't require downgrading the SDK.

My version of g++ :

(bash) % g++ --version
g++ (MacPorts gcc14 14.2.0_3+stdlib_flag) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Issue with Latest Commands Lines Tools 16.3 Update
 
 
Q