# Unable to compile from Source GCC 10 macOS,

**URL:** <https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630>\
**Category:** support\
**Created:** [August 7, 2020, 1:40pm UTC](https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630 "2020-08-07T13:40:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AliAbdulKareem](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/aliabdulkareem/32/392_2.png) [@AliAbdulKareem](https://discourse.glfw.org/u/AliAbdulKareem)\
**Post date:** [August 7, 2020, 1:40pm UTC](https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630/1 "2020-08-07T13:40:02Z")

</div>

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](https://github.com/Haiderahandali/GLFW_problem_GCC) 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.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [August 7, 2020, 2:13pm UTC](https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630/2 "2020-08-07T14:13:43Z")

</div>

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:

> <https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave>

---

<div class="post-metadata">

**Author:** ![rapfamily4](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rapfamily4/32/437_2.png) [@rapfamily4](https://discourse.glfw.org/u/rapfamily4)\
**Post date:** [December 2, 2020, 6:54pm UTC](https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630/3 "2020-12-02T18:54:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [December 2, 2020, 7:20pm UTC](https://discourse.glfw.org/t/unable-to-compile-from-source-gcc-10-macos/1630/4 "2020-12-02T19:20:59Z")

</div>

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:

> <https://github.com/glfw/glfw/issues/1743>
>
> I switched from clang++ to g++ (gcc version 9.3)
> I noticed I can't compile GLFW from source code using CMake. linking against...
