ld: warning: ignoring file /opt/homebrew/Cellar/glfw/3.3.2/lib/libglfw.3.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_glfwCreateWindow", referenced from:
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
"_glfwDestroyWindow", referenced from:
GLWindow::~GLWindow() in MagicCubeLauncher.cpp.o
"_glfwGetKey", referenced from:
Render::processInput() in MagicCubeLauncher.cpp.o
"_glfwGetProcAddress", referenced from:
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
"_glfwGetTime", referenced from:
Render::initRenderLayer() in MagicCubeLauncher.cpp.o
getTime() in MagicCubeLauncher.cpp.o
"_glfwInit", referenced from:
Shader::Shader(char const*, char const*) in MagicCubeLauncher.cpp.o
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
"_glfwMakeContextCurrent", referenced from:
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
"_glfwPollEvents", referenced from:
Render::initRenderLayer() in MagicCubeLauncher.cpp.o
"_glfwSetCursorPosCallback", referenced from:
Render::init() in MagicCubeLauncher.cpp.o
"_glfwSetFramebufferSizeCallback", referenced from:
Render::init() in MagicCubeLauncher.cpp.o
"_glfwSetInputMode", referenced from:
Render::processInput() in MagicCubeLauncher.cpp.o
"_glfwSetScrollCallback", referenced from:
Render::init() in MagicCubeLauncher.cpp.o
"_glfwSetWindowShouldClose", referenced from:
Render::processInput() in MagicCubeLauncher.cpp.o
"_glfwSwapBuffers", referenced from:
Render::initRenderLayer() in MagicCubeLauncher.cpp.o
"_glfwTerminate", referenced from:
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
Render::clear() in MagicCubeLauncher.cpp.o
"_glfwWindowHint", referenced from:
GLWindow::GLWindow(int, int, char*) in MagicCubeLauncher.cpp.o
"_glfwWindowShouldClose", referenced from:
Render::initRenderLayer() in MagicCubeLauncher.cpp.o
ld: symbol(s) not found for architecture x86_64
Can i directly use Rosetta 2 to translate it into arm64 framework for using?
if NOT, is there any other methods i can use to run it on this framework or i need to wait for glew and glfw to support it?
I ran into this issue previously and I finally found a fix for it. What's going on here is that your compiler is building for the wrong architecture. You need to specify that you would like to compile for apple silicon to make this work properly. Since you did not specify your build system, I'll go with what I used which, in this case, was CMake.
All you need to add is the CMAKE_APPLE_SILICON_PROCESSOR option, like so:
# Inside of your `build` directory
$ cmake -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 ..
Without this, my code was explicitly specifying the x86_64
architecture and threw the error you posted. This might not be a silver bullet, but it's how I solved the above problem. You need to do whatever the equivalent of this is for your system, or explicitly specify the architecture if you're compiling manually.