norihiro / obs-face-tracker

Face tracking plugin for OBS Studio
GNU General Public License v2.0
366 stars 31 forks source link

Build package for macOS ARM64 (M1 processor) #90

Closed hiteq closed 2 years ago

hiteq commented 2 years ago

Hi. I'm just a fan of obs-face-tracker. Here is the most likely branch of OBS for Apple silicon and obs-face-tracker doesn't work because of architecture maybe. https://github.com/obsproject/obs-studio/pull/5155

I hope it work with this project someday. image

norihiro commented 2 years ago

A current log file is required to help fix your issue. Please post a link to your current log file.

  1. In OBS select Help > Log Files > Upload Current Log File.
  2. Click Copy URL and then paste the link here.

If you are running OBS Studio built for M1 architecture, I think you should build this plugin for M1 architecture. The distributing binary is built for x86_64.

hiteq commented 2 years ago

Here it is. https://obsproject.com/logs/9hHHx2zhM6TINKTa

norihiro commented 2 years ago

The version of OBS Studio does not look the released version. Once the PR at OBS Studio is merged and the build flow is established, I will consider to follow it. Since the PR has not been merged yet, I'm afraid the flow would be unstable.

Until then, please use x86_64 binary or build this plugin by yourself. If there is something that needs to be fixed for arm64, PRs and issues will be welcome. The build flow should be not so difficult if you have M1 host. After building OBS Studio, install openblas (run brew install openblas), extract the source code of this plugin at the same level as obs-studio, and finally run ci/macos/build-macos.sh.

hiteq commented 2 years ago

Thanks for comment. I got M1 host so I tried but got some errors.

Error with codes on root of obs-studio with no obs-face-tracker folder

CMake Error at cmake/external/ObsPluginHelpers.cmake:27 (find_package): By not providing "Findlibobs.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "libobs", but CMake did not find one.

Could not find a package configuration file provided by "libobs" with any of the following names:

libobsConfig.cmake
libobs-config.cmake

Add the installation prefix of "libobs" to CMAKE_PREFIX_PATH or set "libobs_DIR" to a directory containing one of the above files. If "libobs" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): external/FindLibObs.cmake:98 (include) CMakeLists.txt:20 (include)


image

norihiro commented 2 years ago

The screenshot looks something strange. The contents of obs-face-tracker should be extracted inside obs-studio. I remembered I've left build-instruction in README file. https://github.com/norihiro/obs-face-tracker#building The directory structure should be same as this instruction.

hiteq commented 2 years ago

image Sorry about that I'm not familiar with cmake. I tried your instruction one by one and still missed something maybe. My "$d0" was "face-build" folder in "Download".

norihiro commented 2 years ago

Could you try this cmake command instead under face-build/obs-face-tracker/build?

cmake .. \
    -DQTDIR="/tmp/obsdeps" \
    -DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \
    -DLIBOBS_LIB=../../obs-studio/libobs \
    -DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo
hiteq commented 2 years ago

Perhaps that branch I mentioned for M1 builds have changed some locations of resources for building plugins? image

This is what I have from error log after failed cmake. CMakeError.log CMakeOutput.log

norihiro commented 2 years ago

I have tested cmake with the PR 5155 on Linux and it run through without error.

The cmake files in this project are just modified from the previous version of plugin-template. To be honest, I don't fully understand how it is working.

Looking at the updated ObsPluginHelpers.cmake, I think you need to add these options to cmake command for obs-face-tracker.

-D CMAKE_OSX_ARCHITECTURES=arm64 -D OBS_CODESIGN_LINKER=OFF

And, if you remove these lines from obs-studio/cmake/external/ObsPluginHelpers.cmake, what will happen? https://github.com/obsproject/obs-studio/blob/0524d9de747fdf2a41992bab26a89732a9610494/cmake/external/ObsPluginHelpers.cmake#L22-L37

By the way, I think the PR aims to have cross-compile for arm64 using x64 host. If you are building on arm64, I think you don't need to have the PR, do you?

norihiro commented 2 years ago

I started to modify cmake files in #92. Once it's done, the build flow with the PR 5155 might run.

hiteq commented 2 years ago

I found some post about arm64 build for obs-face-tracker from someone's blog. These solutions could be outdated and I got errors but hope this could be help you. https://www.kilinbox.net/2021/02/obsarmbuild.html

norihiro commented 2 years ago

The master branch of obs-studio now merged the CMake overhaul. Now some bufixes are in progress in their repository.

hiteq commented 2 years ago

It works so fine.