物理のバス停 by salt22g

とある物理学見習いの備忘録。

Geant4 cmakeでerror…(macOS)

Geant4のフレームワークをcmakeしようとしたところここでエラーが…

Failed to find "gl.h" in

CMake Error at /usr/local/opt/qt/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
Failed to find "gl.h" in
"/System/Library/Frameworks/OpenGL.framework/Headers;/System/Library/Frameworks/AGL.framework/Headers".
Call Stack (most recent call first):
/usr/local/opt/qt/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:202 (include)
/usr/local/Cellar/geant4/10.5.1/lib/Geant4-10.5.1/Geant4Config.cmake:449 (find_package)
CMakeLists.txt:13 (find_package)

 

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AGL.framework/Headers

なんか場所が変わっていたらしい。

ちなみにGeant4はhomebrewを使ってインストールしたもの。

/usr/local/opt/qt/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake

このファイルを見に行くと

set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/\
Library/Frameworks/AGL.framework/Headers")

ということでここを編集してみる

一応元のファイルは残して…

set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/Library/Frameworks/AGL.framework/Headers" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AGL.framework/Headers" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers")

このように編集

再度

cmake ..

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/hogehoge/

やったぜ。