LoginSignup
3
4

More than 5 years have passed since last update.

Macでwaifu2x-converter-glslを導入するときに躓いたこと

Last updated at Posted at 2018-11-09

環境確認

環境:
MacOSX Mojave10.14.1
Xcode 10.1
Homebrew 1.8.2

参考サイト
http://yuukiar.co/blog/2015/06/15/setup-waifu2x-on-mac/#waifu2x-converter-cpp-(wl-amigo)

とりあえず必要なOpenCV3.4.3とGLFW3.2.1をHomebrewでインストール。
$ brew install opencv glfw

Waifu2x-converter-glsl

次にgitでwaifu2x-converter-glsl取ってくる。

$ git clone https://github.com/ueshita/waifu2x-converter-glsl
$ cd waifu2x-converter-glsl
$ open build/waifu2x-converter-glsl.xcodeproj

ビルド

Xcode開いてプロジェクトを立ち上げる

$ xcodebuild -project build/waifu2x-converter-glsl.xcodeproj -scheme waifu2x-converter-glsl -configuration Release -derivedDataPath DerivedData

と実行するとエラー発生。

User defaults from command line:
IDEDerivedDataPathOverride = /Users/hoge/waifu2x-converter-glsl/DerivedData
note: Using new build system
note: Planning build
note: Constructing build description
(中略)
** BUILD FAILED **
The following build commands failed:
Ld /Users/hoge/waifu2x-converter-glsl/DerivedData/Build/Products/Release/waifu2x-converter-glsl normal x86_64
(1 failure)

どうやらXcodeのビルドが失敗しているらしい。

原因:GLFWまわり

ターミナルの代わりにXcode上でBuildしてみる。
やはりBuild Failed…
Xcode上のエラーを右クリック→Reveal in Logで見ると-lglfw3でエラーを吐いているらしい。
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lglfw3

参考サイト
http://dmoviex.hatenablog.com/entry/2016/12/24/131917

Xcodeが当時とUIが違っているので迷うが、
infoやBuildSettingsのタブと並んでいるwaifu2x-converter-glslを開いてProjectのwaifu2x-converter-glslからTargetのwaifu2x-converter-glslに切り替えて、
BuildPhasesのタブ→Link Binary with Libraryを開く。

glfw3.aを削除して、/usr/local/Cellar/glfw/3.2.1/libglfw.3.2.dylibをドラッグドロップで読み込ませて再実行。

原因;OpenCVまわり

再びエラー。
今度はlibopencv_imgproc.3.0.0.dylibが原因らしい。
削除して/usr/local/Cellar/opencv/3.4.3/libopencv_imgproc.3.4.3.dylibをドラッグドロップで読み込ませて再実行。

再び、libopencv_imgcodecs.3.0.0.dylibが原因でエラー。
削除して/usr/local/Cellar/opencv/3.4.3/libopencv_imgcodecs.3.4.3.dylibを読み込ませて再実行。

なんとかエラーが起きずにBuild Succeeded。

$ xcodebuild -project build/waifu2x-converter-glsl.xcodeproj -scheme waifu2x-converter-glsl -configuration Release -derivedDataPath DerivedData
$ cp DerivedData/Build/Products/Release/waifu2x-converter-glsl .

$ waifu2x-converter-glsl

で無事実行できました。
使い方は配布元の本家様や--helpを参照

本家様
https://github.com/ueshita/waifu2x-converter-glsl

3
4
0

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
3
4