MacOS下OBS源码编译及调测

MacOS下OBS源码编译及调测,第1张

文章目录
    • 源码编译
      • 源码下载
      • 依赖下载
      • cmake源码
        • 出现`Could NOT find Luajit`错误
        • 错误`obs-browser submodule not available`
        • 错误`Could not find a package configuration file provided by "Qt5"`
        • 错误`Could NOT find Libspeexdsp`/`LibAJANTV2`
        • 无法打开“moc”/"uic",因为无法验证开发者
      • make源码
        • 错误`ld: symbol(s) not found for architecture x86_64`
    • 运行OBS
    • lldb调试

源码编译 源码下载
git clone --recursive https://github.com/obsproject/obs-studio.git
依赖下载
  • QT需要自行先下载并安装好。可以直接下载最新版本的qtcreator, 在安装时勾选QT的二进制库文件,此处省略这一步,默认大家都能安装好。或者也可以下载obs提供的qt-deps依赖库。
  • 下载obs的依赖库。
    在这里下载最新的obs-deps,然后解压到对应的目录:/xxx/obs-deps/obsdeps。各个版本的依赖点这里
    ,然后找到macOS的版本下载。
cmake源码

切换到obs-studio源码目录,然后创建一个bulid目录,再执行cmake命令。

cd obs-studio
mkdir build
cd build
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
make -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DSWIGDIR="/xxx/deps" -DDepsPath="/xxx/deps" -DENABLE_SCRIPTING=OFF -DBUILD_BROWSER=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DENABLE_SPEEXDSP=OFF ..
出现Could NOT find Luajit错误
CMake Error at /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Luajit (missing: LUAJIT_LIB LUAJIT_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindLuajit.cmake:69 (find_package_handle_standard_args)
  deps/obs-scripting/obslua/CMakeLists.txt:11 (find_package)

定位到deps/obs-scripting/obslua/CMakeLists.txt第11行,没有Luajit这个库,那我们也不用去安装它了,直接不编译obslua这个模块就可以了。其实包括obspython这个模块都可以一起去掉,不编译。我们在cmake命令时加上DENABLE_SCRIPTING=OFF选项,关闭脚本的编译。

错误obs-browser submodule not available
-- OBS:  DISABLED   linux-jack
CMake Error at cmake/Modules/ObsHelpers.cmake:374 (message):
  OBS: obs-browser submodule not available.
Call Stack (most recent call first):
  plugins/CMakeLists.txt:11 (obs_status)
  plugins/CMakeLists.txt:58 (check_obs_browser)

这个是因为obs-browser子目录下是空的,一般是因为你在clone代码的时候没有加上--recursive导致没有下载到子模块的代码,重新克隆一下代码就可以了。

错误Could not find a package configuration file provided by "Qt5"

···
– OBS: DISABLED linux-jack
– OBS: DISABLED obs-browser
CMake Warning at plugins/obs-browser/CMakeLists.txt:46 (message):
Browser source support is not enabled by default - please switch
ENABLE_BROWSER to ON and specify CEF_ROOT_DIR to enable this functionality.

CMake Error at plugins/obs-vst/CMakeLists.txt:15 (find_package):
By not providing “FindQt5.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Qt5”, but
CMake did not find one.

Could not find a package configuration file provided by “Qt5” with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of “Qt5” to CMAKE_PREFIX_PATH or set “Qt5_DIR”
to a directory containing one of the above files. If “Qt5” provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
plugins/obs-vst/CMakeLists.txt:60 (find_qt)
···
需要将QT的路径加入到CMAKE_PREFIX_PATH环境变量中,执行如下 *** 作:export CMAKE_PREFIX_PATH=/usr/local/opt/qt5,将路径替换成你的QT安装路径。

错误Could NOT find Libspeexdsp/LibAJANTV2
CMake Error at /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Libspeexdsp (missing: SPEEXDSP_LIB SPEEXDSP_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindLibspeexdsp.cmake:49 (find_package_handle_standard_args)
  plugins/obs-filters/CMakeLists.txt:22 (find_package)

都是没有正确下载好OBS的依赖,请在这里下载最新的obs-deps依赖,再尝试。

无法打开“moc”/“uic”,因为无法验证开发者

无法打开“moc”,因为无法验证开发者。
在访达中定位到这两个文件里,右击鼠标打开,点击打开即可。

make源码

cmake成功后在当前目录下直接执行make命令,等待编译结果

make -j
错误ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [UI/frontend-plugins/decklink-output-ui/decklink-output-ui.plugin/Contents/MacOS/decklink-output-ui] Error 1
make[1]: *** [UI/frontend-plugins/decklink-output-ui/CMakeFiles/decklink-output-ui.dir/all] Error 2
make: *** [all] Error 2

此时你应该检查依赖库是不是下错版本了,可以查看自己的CPU型号,下载对应的版本,然后重新来过。
出现如下图示表示编译成功。

运行OBS

我们切换到obs二进制目录下,打开obs,应该就能成功打开。

lldb调试

需要在lldb中设置环境变量:

env LD_LIBRARY_PATH=$LD_LIBRAY_PATH:/xxx/obsdeps/lib  

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/921250.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存