Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 带有M1的Mac OS在使用glfw glew时遇到错误_Macos_Opengl_Glfw_Glew_Rosetta 2 - Fatal编程技术网

Macos 带有M1的Mac OS在使用glfw glew时遇到错误

Macos 带有M1的Mac OS在使用glfw glew时遇到错误,macos,opengl,glfw,glew,rosetta-2,Macos,Opengl,Glfw,Glew,Rosetta 2,我可以直接使用Rosetta 2将其转换为arm64框架使用吗 如果没有,我是否可以使用其他方法在这个框架上运行它 或者我需要等待glew和glfw来支持它?我以前遇到过这个问题,最终找到了解决方案。这里发生的事情是,编译器为错误的体系结构构建。您需要指定您要为apple silicon编译以使其正常工作。因为您没有指定构建系统,所以我将使用我使用的,在本例中是CMake 您只需添加选项,如下所示: #在“build”目录中 $cmake-DCMAKE\u APPLE\u SILICON\u处理

我可以直接使用Rosetta 2将其转换为arm64框架使用吗

如果没有,我是否可以使用其他方法在这个框架上运行它
或者我需要等待glew和glfw来支持它?

我以前遇到过这个问题,最终找到了解决方案。这里发生的事情是,编译器为错误的体系结构构建。您需要指定您要为apple silicon编译以使其正常工作。因为您没有指定构建系统,所以我将使用我使用的,在本例中是CMake

您只需添加选项,如下所示:

#在“build”目录中
$cmake-DCMAKE\u APPLE\u SILICON\u处理器=arm64。。
没有这一点,我的代码就显式地指定了
x86_64
体系结构,并抛出了您发布的错误。这可能不是一个灵丹妙药,但这就是我解决上述问题的方法。您需要为您的系统执行与此等效的操作,或者在手动编译时明确指定体系结构。

您拥有的glfw版本已经是arm64,但您正在构建的项目是为
x86-64
构建的。因此,请修复您的代码或构建设置。
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