Unable to compile from Source GCC 10 macOS,

As the title says, I am unable to build it from Source, with the GCC, I am perfectly building it with clang11 and perfectly works with Both linking shared-libs or static-libs,

–Software versions
-GCC (version 10.2),
-macOS (10.15.6)
-CMake 3.18.1
-Ninja-build 1.10
-Xcode 11.6 (all of those are the latest versions for each one as of the today)

t am building the example on the docs, so I am not using any other things with it
(the repo is on GitHub if you want to build it yourself with CMake and the example.cpp)

if I try to invoke cmake using
cmake -GNinja -B build -DCMAKE_C_COMPILER=GCC-10 -DCMAKE_CXX_COMPILER=G++-10 .
and then cmake --build .
it won’t build and generate so many errors that I uploaded in the github repo as well, named output_GCC.txt. and used ninja -t commands to generate the commands and named it gccCommands.txt
As mentioned just changing the compiler from gcc to clang will solve this (by removing
-DCAMKE_C_COMPILER and -DCMAKE_CXX_COMPILER this will invoke clang by default)
and I also uploaded clangCommands.txt, which is what commands clang executed so if anyone wants to compare both commands (I tasted for Make generators and the result was the same so I know it is not Ninja’s fault)

I couldn’t find anything under the Release note page, that I should use clang on macOS.

Hi @AliAbdulKareem, welcome to the GLFW forums!

All the errors are related to Mac OS X SDK files, so this is a GCC / Mac OS X issue rather than a GLFW one.

Doing a quick search online shows there are some issues with GCC which may require you to upgrade your toolchain - I’m not a Mac OS X GCC expert and these issues relate to a version of MaC OS X which I don’t have, so your best bet would be to do a search and see what you can find.

I’m not sure if this is the issue, but here’s one link I found:

I’m having the same issues. It compiles with clang, giving errors with gcc.

It also appears to me that the errors come from Xcode’s toolchain.

I followed the steps from the link, upgrading the command line tools, without getting any positive result.

Is there official support for glfw on Mac through gcc? Thanks.

Hi @rapfamily4, welcome to the GLFW forum!

The errors listed in the first post (on Github) are in compiling the Mac OS X frameworks, not GLFW code itself.

There is an issue tracking this here: