admshao / obs-transition-matrix

GNU General Public License v2.0
97 stars 13 forks source link

Mac installation #21

Open exocode opened 4 years ago

exocode commented 4 years ago

For anyone who is struggling with MacOS Catalina installation (QT version at compile time differs from runtime) (you can see this in log file of OBS) This could be used to update the MacOS "how to" or someone who searches for a solution.

20:01:55.234: os_dlopen(/Library/Application Support/obs-studio/plugins/obs-transition-matrix/bin/obs-transition-matrix.so->/Library/Application Support/obs-studio/plugins/obs-transition-matrix/bin/obs-transition-matrix.so): dlopen(/Library/Application Support/obs-studio/plugins/obs-transition-matrix/bin/obs-transition-matrix.so, 257): Library not loaded: @rpath/QtWidgets
20:01:55.234:   Referenced from: /Library/Application Support/obs-studio/plugins/obs-transition-matrix/bin/obs-transition-matrix.so
20:01:55.234:   Reason: Incompatible library version: obs-transition-matrix.so requires version 5.15.0 or later, but QtWidgets provides version 5.14.0
20:01:55.234: 
20:01:55.234: Module '/Library/Application Support/obs-studio/plugins/obs-transition-matrix/bin/obs-transition-matrix.so' not loaded
20:01:55.251: [obs-websocket] you can haz websockets (version 4.8.0)
20:01:55.251: [obs-websocket] qt version (compile-time): 5.10.1 ; qt version (run-time): 5.14.1
20:01:55.253: [obs-websocket] module loaded!
20:01:55.253: ---------------------------------
20:01:55.253:   Loaded Modules:
20:01:55.253:     obs-websocket.so
20:01:55.253:     obs-ndi.so
20:01:55.253:     move-transition.so
20:01:55.253:     cloud_captions_plugin.so
20:01:55.253:     advanced-scene-switcher.so
20:01:55.253:     StreamDeckPlugin.so
20:01:55.253:     vlc-video.so
20:01:55.253:     text-freetype2.so
20:01:55.253:     rtmp-services.so
20:01:55.253:     obs-x264.so
20:01:55.253:     obs-vst.so
20:01:55.253:     obs-transitions.so
20:01:55.253:     obs-outputs.so
20:01:55.253:     obs-libfdk.so
20:01:55.253:     obs-filters.so
20:01:55.253:     obs-ffmpeg.so
20:01:55.253:     obs-browser.so
20:01:55.253:     mac-vth264.so
20:01:55.253:     mac-syphon.so
20:01:55.253:     mac-decklink.so
20:01:55.253:     mac-capture.so
20:01:55.253:     mac-avcapture.so
20:01:55.253:     linux-jack.so
20:01:55.253:     image-source.so
20:01:55.253:     frontend-tools.so
20:01:55.253:     decklink-ouput-ui.so
20:01:55.253:     coreaudio-encoder.so
20:01:55.253: ---------------------------------

So installation is not easy, because the version you need is not available anymore. You have to overwrite a file: (BTW: I already have cmake and xcode-tools installed)

mkdir build && cd build
cmake .. \
    -DBUILD_CAPTIONS=true \
    -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
    -DDISABLE_PLUGINS=true \
    -DENABLE_SCRIPTING=0 \
    -DDepsPath=/tmp/obsdeps \
    -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
&& make -j4
git clone https://github.com/admshao/obs-transition-matrix.git
cd obs-transition-matrix
mkdir build && cd build
cmake .. \
    -DQTDIR=/usr/local/opt/qt \
    -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" \
    -DLIBOBS_LIB="../../obs-studio/build/libobs/libobs.dylib" \
    -DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \
    -DCMAKE_INSTALL_PREFIX="/usr" \
&& make -j4

install_name_tool \
        -add_rpath @executable_path/../Frameworks/QtWidgets.framework/Versions/5/ \
        -add_rpath @executable_path/../Frameworks/QtGui.framework/Versions/5/ \
        -add_rpath @executable_path/../Frameworks/QtCore.framework/Versions/5/ \
        -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @rpath/QtWidgets \
        -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @rpath/QtGui \
        -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \
        obs-transition-matrix.so

sudo mkdir -p /Library/Application\ Support/obs-studio/plugins/obs-transition-matrix/bin
sudo cp -r ../data /Library/Application\ Support/obs-studio/plugins/obs-transition-matrix/
sudo cp obs-transition-matrix.so /Library/Application\ Support/obs-studio/plugins/obs-transition-matrix/bin

So with that exact steps I got it built successfully and run on macOS Catalina (10.15.7 (19H2))

Bildschirmfoto 2020-10-28 um 20 57 15
AlbertBaubleDeem commented 3 years ago

Great step by step tutorial. I am working in Big Sur. ATM some calls in the file (https://gist.githubusercontent.com/DDRBoxman/b3956fab6073335a4bf151db0dcbd4ad/raw/ed1342a8a86793ea8c10d8b4d712a654da121ace/qt.rb) are deprecated. See below:

Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/qt.rb:12

Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/qt.rb:13

Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/qt.rb:14

==> Downloading https://ghcr.io/v2/homebrew/core/qt/manifests/5.10.1
##O#- #                                                                       
curl: (22) The requested URL returned error: 404 
Error: Failed to download resource "qt_bottle_manifest"
Download failed: https://ghcr.io/v2/homebrew/core/qt/manifests/5.10.1

It seems like it can be fixed by fixing the code. I will try rewriting the code in the file according to the brew warnings and installing the qt again.

Any other ideas? Is anyone working on this?

petaren commented 2 years ago

Would someone be able to build a macOS binary, I have an M1 Mac so I can't build OBS to be able to build this plugin myself?