ripose-jp/Memento

make on MacOS (Apple Silicon) -- cannot find mpv

Closed this issue · 2 comments

So after installing the prereqs, I tried running make:

vincent@Azure ➜  Memento git:(master) make
mkdir -p build
cd build; \
	cmake -DCMAKE_BUILD_TYPE=Release  ..; \
	cmake --build . -j
CMake Error at /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find mpv (missing: mpv_LIBRARY mpv_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/Findmpv.cmake:6 (find_package_handle_standard_args)
  CMakeLists.txt:138 (find_package)


-- Configuring incomplete, errors occurred!
gmake[1]: Entering directory '/Users/vincent/projects/Memento/build'
gmake[1]: Makefile: No such file or directory
gmake[1]: *** No rule to make target 'Makefile'.  Stop.
gmake[1]: Leaving directory '/Users/vincent/projects/Memento/build'
make: *** [release] Error 2

Here's where MPV is:

vincent@Azure ➜  Memento git:(master) whereis mpv
mpv: /opt/homebrew/bin/mpv /opt/homebrew/share/man/man1/mpv.1
vincent@Azure ➜  Memento git:(master)
vincent@Azure ➜  Memento git:(master) ll /opt/homebrew/bin/mpv
lrwxr-xr-x@ 40 vincent 25 Jul 14:20  /opt/homebrew/bin/mpv -> /Applications/mpv.app/Contents/MacOS/mpv*

I tried setting some environment variables to no avail:

vincent@Azure ➜  Memento git:(master) export mpv_LIBRARY='/Applications/mpv.app/Contents/MacOS'
vincent@Azure ➜  Memento git:(master) make
mkdir -p build
cd build; \
        cmake -DCMAKE_BUILD_TYPE=Release -DOCR_SUPPORT=ON ..; \
        cmake --build . -j
CMake Error at /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find mpv (missing: mpv_LIBRARY mpv_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/Findmpv.cmake:6 (find_package_handle_standard_args)
  CMakeLists.txt:138 (find_package)

-- Configuring incomplete, errors occurred!
gmake[1]: Entering directory '/Users/vincent/projects/Memento/build'
gmake[1]: Makefile: No such file or directory
gmake[1]: *** No rule to make target 'Makefile'.  Stop.
gmake[1]: Leaving directory '/Users/vincent/projects/Memento/build'
make: *** [release] Error 2
vincent@Azure ➜  Memento git:(master)

I even tried cloning the mpv project and setting mpv_INCLUDE_DIR

vincent@Azure ➜  Memento git:(master) export mpv_INCLUDE_DIR=/Users/vincent/projects/mpv/libmpv
vincent@Azure ➜  Memento git:(master) make
mkdir -p build
cd build; \
        cmake -DCMAKE_BUILD_TYPE=Release -DOCR_SUPPORT=ON ..; \
        cmake --build . -j
CMake Error at /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find mpv (missing: mpv_LIBRARY mpv_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.27.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/Findmpv.cmake:6 (find_package_handle_standard_args)
  CMakeLists.txt:138 (find_package)


-- Configuring incomplete, errors occurred!
gmake[1]: Entering directory '/Users/vincent/projects/Memento/build'
gmake[1]: Makefile: No such file or directory
gmake[1]: *** No rule to make target 'Makefile'.  Stop.
gmake[1]: Leaving directory '/Users/vincent/projects/Memento/build'
make: *** [release] Error 2

You're trying to link to the binary in the app bundle. You need to link to the libmpv dylib. Run brew install --formula mpv and try again.

Ah thanks! Seems I had both the cask and the formula installed.

vincent@Azure ➜  libmpv git:(master) brew install --formula mpv
Warning: mpv 0.36.0 is already installed, it's just not linked.
To link this version, run:
  brew link mpv
vincent@Azure ➜  libmpv git:(master) brew link mpv
Linking /opt/homebrew/Cellar/mpv/0.36.0...
Error: Could not symlink bin/mpv
Target /opt/homebrew/bin/mpv
already exists. You may want to remove it:
  rm '/opt/homebrew/bin/mpv'

To force the link and overwrite all conflicting files:
  brew link --overwrite mpv

To list all files that would be deleted:
  brew link --overwrite --dry-run mpv
vincent@Azure ➜  libmpv git:(master) brew link --overwrite --dry-run mpv
Would remove:
/opt/homebrew/bin/mpv -> /Applications/mpv.app/Contents/MacOS/mpv
/opt/homebrew/share/man/man1/mpv.1 -> /opt/homebrew/Caskroom/mpv/0.36.0/documentation/man/mpv.1
vincent@Azure ➜  libmpv git:(master) brew link --overwrite mpv
Linking /opt/homebrew/Cellar/mpv/0.36.0... 9 symlinks created.
vincent@Azure ➜  libmpv git:(master)

After running brew link, make worked:

vincent@Azure ➜  Memento git:(master) ✗ make
mkdir -p build
cd build; \
        cmake -DCMAKE_BUILD_TYPE=Release -DOCR_SUPPORT=ON ..; \
        cmake --build . -j
-- Found mpv: /opt/homebrew/lib/libmpv.dylib
-- Found SQLite3: /Library/Frameworks/Mono.framework/Headers (found version "3.26.0")
-- Found Python: /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 (found version "3.11.5") found components: Development Development.Module Development.Embed
-- Configuring done (2.3s)
-- Generating done (0.3s)
-- Build files have been written to: /Users/vincent/projects/Memento/build

I gave a quick go at updating the readme:
#181