【问题标题】:Why is Glew not finding OpenGL headers in MacOS Catalina?为什么 Glew 在 MacOS Catalina 中找不到 OpenGL 标头?
【发布时间】:2021-02-09 22:20:54
【问题描述】:

升级到 Catalina 破坏了我的构建,三天的搜索并没有解决问题。代码在 Catalina 之前运行良好。

我得到的具体错误是

/usr/local/include/GL/glew.h:1217:14: fatal error: 'OpenGL/glu.h' file not found
#    include <OpenGL/glu.h>
             ^~~~~~~~~~~~~~ /usr/local/include/GL/glew.h:1217:14: 
note: did not find header 'glu.h' in
      framework 'OpenGL' (loaded from '/System/Library/Frameworks')

我的 glew 是从 brew 安装的,brew info 说:

$ brew info glew
glew: stable 2.2.0 (bottled), HEAD
OpenGL Extension Wrangler Library
https://glew.sourceforge.io/
Conflicts with:
  root (because root ships its own copy of glew)
/usr/local/Cellar/glew/2.2.0 (38 files, 3.4MB) *
  Poured from bottle on 2020-10-27 at 10:52:58
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/glew.rb
License: BSD-3-Clause
==> Dependencies
Build: cmake ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 6,917 (30 days), 12,565 (90 days), 50,126 (365 days)
install-on-request: 3,383 (30 days), 6,400 (90 days), 26,243 (365 days)
build-error: 0 (30 days)

据我所知,关于“root 提供自己的 glew 副本”的部分并非如此,因为对整个系统的 find 搜索找不到另一个 glew.h。

我的构建标志是(通过 CMake 设置)

SET(APP_COMPILE_FLAGS  "-g -Wall -Wno-nullability-completeness")
SET(APP_LINK_FLAGS     "-framework OpenGL -lglfw -lGLEW")

其他可能相关的信息:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

我正在运行 XCode 12.0.1、XCode 12 的命令工具和 MacOS 10.15.7。有什么见解吗?

【问题讨论】:

  • 你能在你的系统上找到文件glu.h吗?
  • 是的,sudo find /Library/Developer/CommandLineTools -name glu.h -print 给出 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework /Versions/A/Headers/glu.h。但是仅仅把它作为一个包含目录并没有帮助,因为 Glew 期待“OpenGL/glu.h”
  • Headers/glu.h 不是OpenGL/glu.h。还能在OpenGL目录下找到标题glu.h吗?
  • 对。但对 Glew 的头球做手术似乎不是答案。
  • 你为什么只看/Library/Developer/CommandLineTools?你安装glu.h了吗? glu.h 好像没有glew

标签: c++ opengl macos-catalina glew


【解决方案1】:

这显然不是理想的正确答案,而是创建一个链接

/usr/local/include/OpenGL -> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers

是一个解决了我的问题的 hack。

【讨论】:

    猜你喜欢
    • 2020-02-25
    • 1970-01-01
    • 2020-02-06
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 2020-09-04
    • 2021-02-09
    • 1970-01-01
    相关资源
    最近更新 更多