0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

High Sierra / Mojave で OpenGL を使用する際の ld warning について

Last updated at Posted at 2018-11-07

Xcode10以降の Mojave, HighSierraにおいて、OpenGL, GLUTを用いたC++ファイルのコンパイルを行うと以下のような警告がされます。なお、コンパイル自体は成功するので無視できますが、せっかくなので全て修正しましょう。

(はじめての記事なので見づらいところ・知識不足などご容赦ください…!笑)

$ g++ -framework OpenGL -framework GLUT -framework Foundation hoge.cpp -Wno-deprecated
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//GLUT.framework/GLUT.tbd and library file /System/Library/Frameworks//GLUT.framework/GLUT are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib are out of sync. Falling back to library file for linking.

シンボリックリンクを作成

warningの表示では/System/Library/Frameworks/*.frameworkが見つからないという表示ですが、実際に読み込まれているのは/Library/Frameworks/*.frameworkのようです。
$ ls -la /Library/Frameworks/で見るとおそらくOpenGL.frameworkやGLUT.frameworkは見当たらないはずです。

そこで、以下のコマンドでシンボリックリンクを作成します。

$ sudo ln -s -i /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework /Library/Frameworks
$ sudo ln -s -i /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework /Library/Frameworks
$ sudo ln -s -i /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework /Library/Frameworks

ここで一度コンパイルしてみると…

$ g++ -framework OpenGL -framework GLUT -framework Foundation hoge.cpp -Wno-deprecated
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib are out of sync. Falling back to library file for linking.

warningが5つから2つに減っていますね。

残りのwarningについて

残りの2つについては力尽きました。何か分かる方、情報提供していただけると助かります。

参考

Odd ld warning from rstudio - stack overflow

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?