cmakecpackobs-studio

How to build libobs as dependency of obs-studio-node module?


I am trying obs-studio-node.
This module require libobs as dependency. While building this module it download a pre-built version of libobs if none is specified. We can specify out custom libobs as mentioned in README.md

I followed these steps to build libobs. These steps are listed in README.md

  1. git clone https://github.com/stream-labs/obs-studio
  2. cd obs-studio
  3. git submodule update --init --recursive
  4. mkdir build
  5. cd build
  6. cmake .. -DENABLE_UI=false -DDepsPath="C:\Users\alokm\Downloads\dependencies2019\win64" -DENABLE_SCRIPTING=false -G"Visual Studio 16 2019" -A x64
  7. cmake --build .
  8. cpack -G ZIP

Last step (cpack -G ZIP) is failing with errors

PS C:\Users\alokm\tmp\streamlabs\obs-studio\build> cpack -G ZIP
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install project: obs-studio []
CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/w32-pthreads/cmake_install.cmake:51 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/w32-pthreads/Release/w32-pthreads.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/cmake_install.cmake:37 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:37 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/glad/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/glad/Release/obsglad.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/deps/cmake_install.cmake:42 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:37 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-d3d11/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-d3d11/Release/libobs-d3d11.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:42 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-winrt/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-winrt/Release/libobs-winrt.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:47 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-opengl/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs-opengl/Release/libobs-opengl.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:52 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs/cmake_install.cmake:51 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/libobs/Release/obs.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:57 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/coreaudio-encoder/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/coreaudio-encoder/Release/coreaudio-encoder.dll":
  File exists.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:37 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-wasapi/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-wasapi/Release/win-wasapi.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:42 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-dshow/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-dshow/Release/win-dshow.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:47 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/Release/win-capture.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:52 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/graphics-hook/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/graphics-hook/Release/graphics-hook64.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/cmake_install.cmake:59 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:52 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/get-graphics-offsets/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/get-graphics-offsets/Release/get-graphics-offsets64.exe":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/cmake_install.cmake:64 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:52 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/inject-helper/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/inject-helper/Release/inject-helper64.exe":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-capture/cmake_install.cmake:69 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:52 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/decklink/win/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/decklink/win/Release/win-decklink.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:57 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-mf/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/win-mf/Release/win-mf.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:62 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-qsv11/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-qsv11/Release/obs-qsv11.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:67 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/enc-amf/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/enc-amf/Release/enc-amf.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:77 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/enc-amf/amf-test/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/enc-amf/amf-test/Release/enc-amf-test64.exe":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/enc-amf/cmake_install.cmake:59 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:77 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-openvr/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-openvr/Release/win-openvr.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:87 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/motion-effect/src/motion-transition/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/motion-effect/src/motion-transition/Release/motion-transition.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/motion-effect/cmake_install.cmake:38 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:92 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-vst/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-vst/Release/obs-vst.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:97 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/image-source/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/image-source/Release/image-source.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:102 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-x264/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-x264/Release/obs-x264.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:107 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ffmpeg/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ffmpeg/Release/obs-ffmpeg.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:117 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ffmpeg/ffmpeg-mux/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ffmpeg/ffmpeg-mux/Release/obs-ffmpeg-mux.exe":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ffmpeg/cmake_install.cmake:59 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:117 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-outputs/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-outputs/Release/obs-outputs.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:122 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-filters/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-filters/Release/obs-filters.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:127 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-transitions/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-transitions/Release/obs-transitions.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:132 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-text/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-text/Release/obs-text.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:137 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/rtmp-services/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/rtmp-services/Release/rtmp-services.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:142 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/text-freetype2/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/text-freetype2/Release/text-freetype2.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:147 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ndi/cmake_install.cmake:37 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/obs-ndi/Release/obs-ndi.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:152 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/slobs-virtual-cam/windows/obs-virtual-cam/src/virtual-output/cmake_install.cmake:39 (file):
":
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/slobs-virtual-cam/cmake_install.cmake:37 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/slobs-virtual-cam/windows/obs-virtual-cam/src/virtual-source/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/slobs-virtual-cam/windows/obs-virtual-cam/src/virtual-source/Release/obs-virtualsource.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/slobs-virtual-cam/cmake_install.cmake:37 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/plugins/cmake_install.cmake:157 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:62 (include)


CMake Error at C:/Users/alokm/tmp/streamlabs/obs-studio/build/UI/obs-frontend-api/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/Users/alokm/tmp/streamlabs/obs-studio/build/UI/obs-frontend-api/Release/obs-frontend-api.dll":
  No such file or directory.
Call Stack (most recent call first):
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/UI/cmake_install.cmake:37 (include)
  C:/Users/alokm/tmp/streamlabs/obs-studio/build/cmake_install.cmake:67 (include)


CPack Error: Error when generating package: OBS Studio (64bit)

I guess obs-studio does not support cpack so its failing.
How can I build my custom libobs for obs-studio-node mobule?


Solution

  • Check what exact configuration you have built. The output of CPack tries to install the Release configuration. However, you didn't mention any when did project configuration (and it may project-dependent to set some defaults).

    Try add explicitly what you want:

    $ cmake .. -DENABLE_UI=false -DDepsPath="C:\Users\alokm\Downloads\dependencies2019\win64" -DENABLE_SCRIPTING=false -DCMAKE_CONFIGURATION_TYPES=Release -G "Visual Studio 16 2019" -A x64
    $ cmake --build . --config Release