# Building GLFW from source on Mac 12.6 w/ Premake

**URL:** <https://discourse.glfw.org/t/building-glfw-from-source-on-mac-12-6-w-premake/2176>\
**Category:** support\
**Created:** [October 12, 2022, 6:12am UTC](https://discourse.glfw.org/t/building-glfw-from-source-on-mac-12-6-w-premake/2176 "2022-10-12T06:12:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wowthatsmath](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/wowthatsmath/32/681_2.png) [@wowthatsmath](https://discourse.glfw.org/u/wowthatsmath)\
**Post date:** [October 12, 2022, 6:12am UTC](https://discourse.glfw.org/t/building-glfw-from-source-on-mac-12-6-w-premake/2176/1 "2022-10-12T06:12:57Z")

</div>

I have a shared library project that I am trying to incorporate GLFW into. I have added GLFW as a submodule and created a premake file within to build it as a separate static library project and link it to my shared library. I have linked the necessary frameworks for Mac to use GLFW (Cocoa, OpenGL, and IOKit). I have also linked the “glfw” library for Mac. Here is the linker error:

```auto
Undefined symbols for architecture arm64:
  "Based::CreateApplication()", referenced from:
      _main in MacWindow.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

Are there any ideas on how to fix this? MacWindow is within the shared library so it shouldn’t require a main function. I have scoured the internet and these forums but have been unsuccessful. I have found a user with the same exact problem as mine under the issues of the GLFW GitHub, [here](https://github.com/glfw/glfw/issues/2181), without an answer. If necessary, I will add the premake files for both the shared library and the static library (GLFW).

---

<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:** [October 12, 2022, 9:36am UTC](https://discourse.glfw.org/t/building-glfw-from-source-on-mac-12-6-w-premake/2176/2 "2022-10-12T09:36:41Z")

</div>

To me it seems that the target which includes `Based::CreateApplication` was not built correctly for the architecture `arm64`. I don’t know if premake supports MacOS ARM64 (with universal binaries or without), and I can’t find any details on their site for this. This function isn’t part of GLFW, so a good starting point would be to check that you can make a simple “hello world” ARM64 application with premake and move from there.

If you’d like to try an alternative build approach you could look at this [cmake starter for GLFW](https://github.com/juliettef/GLFW-CMake-starter). Whilst premake is a superior build scripting language to cmake, cmake generally has wider support and GLFW has official build scripts for it.

---

<div class="post-metadata">

**Author:** ![wowthatsmath](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/wowthatsmath/32/681_2.png) [@wowthatsmath](https://discourse.glfw.org/u/wowthatsmath)\
**Post date:** [October 13, 2022, 4:20am UTC](https://discourse.glfw.org/t/building-glfw-from-source-on-mac-12-6-w-premake/2176/3 "2022-10-13T04:20:31Z")

</div>

Thank you for the reply dougbinks!

Before I included GLFW, the build was working perfectly fine with premake while `Based::CreateApplication` was incorporated. After a bit of fishing, I commented out the the `Based::CreateApplication` function and found the problem truly lied within the MacWindow file. It could not identify glfw3.h. Not 100% sure why, the MacWindow file has includedirs to the directory of GLFW. Although, now I have a completely working project with GLFW added as a submodule and built with premake.

Thank you for the help!
