Question / Help [MAC-OS] Help needed Building obs-studio package from source code along with dependent libraries like qt/libavcodec.

Apparao Maiskar

New Member
Hi,
I'm new to obs-studio. I'm able to build package using below steps and able to install & open the built dmg file in the same machine.

$ git clone --recursive -j8 https://github.com/obsproject/obs-studio.git
$ brew reinstall ffmpeg --with-sdl2 --with-fdk-aac
$ brew install qt5
$ mkdir obs-studio/build && cd obs-studio/build
$ cmake .. -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.11.1
$ make package
[100%] Built target text-freetype2
Run CPack packaging tool...
CPack: Create package using Bundle
CPack: Install projects
CPack: - Run preinstall target for: obs-studio
CPack: - Install project: obs-studio
CPack: Create package
CPack: - package: /Volumes/obs-studio/build/obs-studio-x64-OBS.dmg generated.

Maiskar-Apparao:build maiskar$ ls -lh obs-studio-x64-OBS.dmg
-rw-r--r--@ 1 maiskar admin 4.9M Aug 23 11:39 obs-studio-x64-OBS.dmg

But when I try to install the built obs.dmg package in other target machine, its giving below shown errors.

Process: obs [1776]
Path: /Volumes/VOLUME/OBS.app/Contents/MacOS/OBS
Identifier: com.obsproject.obs-studio
Version: ???
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: obs [1776]
User ID: 502

Date/Time: 2018-08-22 17:53:26.939 +0530
OS Version: Mac OS X 10.13.6 (17G65)
Report Version: 12
Bridge OS Version: 3.0 (14Y664)
Anonymous UUID: D49807C4-9A26-DA8D-BD4F-429E67004AC3

Sleep/Wake UUID: 189A3568-28E0-4F26-B639-A7BD55F7D77C

Time Awake Since Boot: 10000 seconds
Time Since Wake: 1000 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Library not loaded: /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets
Referenced from: /Volumes/VOLUME/OBS.app/Contents/Resources/bin/obs
Reason: image not found

Binary Images:
0x10aa4f000 - 0x10abd5fff +obs (0) <F7B5B038-6F4F-3554-B3D2-1D3BF051960F> /Volumes/VOLUME/OBS.app/Contents/Resources/bin/obs
0x110713000 - 0x11075dacf dyld (551.4) <8A72DE9C-A136-3506-AA02-4BA2B82DCAF3> /usr/lib/dyld

Model: MacBookPro14,2, BootROM MBP142.0178.B00, 2 processors, Intel Core i5, 3.1 GHz, 8 GB, SMC 2.44f1
Graphics: Intel Iris Plus Graphics 650, Intel Iris Plus Graphics 650, Built-In
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80CE, 0x4B3445364533303445422D45474347202020
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80CE, 0x4B3445364533303445422D45474347202020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.37.31.1a9)
Bluetooth: Version 6.0.7f10, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.0 Bus
USB Device: iBridge
Thunderbolt Bus: MacBook Pro, Apple Inc., 33.1
Thunderbolt Bus: MacBook Pro, Apple Inc., 33.1
-----------
-------------
Process: obs [3839]
Path: /Volumes/VOLUME/OBS.app/Contents/MacOS/OBS
Identifier: com.obsproject.obs-studio
Version: ???
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: obs [3839]
User ID: 502

Date/Time: 2018-08-22 18:04:33.182 +0530
OS Version: Mac OS X 10.13.6 (17G65)
Report Version: 12
Bridge OS Version: 3.0 (14Y664)
Anonymous UUID: D49807C4-9A26-DA8D-BD4F-429E67004AC3

Sleep/Wake UUID: 189A3568-28E0-4F26-B639-A7BD55F7D77C

Time Awake Since Boot: 11000 seconds
Time Since Wake: 1700 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Library not loaded: /usr/local/opt/ffmpeg/lib/libavcodec.58.dylib
Referenced from: /Volumes/VOLUME/OBS.app/Contents/Resources/bin/obs
Reason: image not found

Binary Images:
0x10c655000 - 0x10c7dbfff +obs (0) <F7B5B038-6F4F-3554-B3D2-1D3BF051960F> /Volumes/VOLUME/OBS.app/Contents/Resources/bin/obs
0x10c946000 - 0x10cd89ff3 +org.qt-project.QtWidgets (5.11 - 5.11.1) <BBDD05ED-151D-3EA8-81E2-221E50E3A62E> /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets
0x10cef2000 - 0x10cef5ff7 +libobs-frontend-api.dylib (0) <5F70692C-E519-32B8-A02E-EA27A4A4F26C> /Volumes/VOLUME/OBS.app/Contents/Resources/bin/libobs-frontend-api.dylib
0x10f538000 - 0x10f582acf dyld (551.4) <8A72DE9C-A136-3506-AA02-4BA2B82DCAF3> /usr/lib/dyld

Maiskar-Apparao:build maiskar$ du -ksh obs-studio-x64-OBS.dmg
4.9M obs-studio-x64-OBS.dmg

As shown below, OBS 2.app is the one built from source code has less size compared to that of obs downloaded & installed from online. This created the doubt in my mind, the "make package", I followed to build "OBS 2.app" is not bundling qt and ffmpeg's libavcodec libraries inside the package.
Maiskar-Apparao:build maiskar$ du -ksh /Applications/OBS*
16M /Applications/OBS 2.app
76M /Applications/OBS.app

Library not loaded: /usr/local/opt/ffmpeg/lib/libavcodec.58.dylib
Library not loaded: /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets

And to get rid of the above errors, I tried reinstalling ffmpeg --with-sdl2 --with-fdk-aac, and along with qt. Then I'm able to install and open the custom built obs application.

My understanding is the online downloaded obs.dmg file has bigger size compare to that of custom built one and also former obs.dmg is install-able and running without installing dependent libraries like qt (or) ffmpeg's libavcodec. But this is not the case with custom built obs 2.dmg, which needs explicit installing of libavcodec and qt manually to open and run it.

It will be really helpful to me, If anyone can guide me how to bundle obs-studio along with dependent libraries like qt and ffmpeg's libavcodec. So that the custom built obs package can be installed & opened in target machine without necessity of installing dependent libraries like qt / libavcodec.

Thanks,
Apparao Maiskar.
 

Narcogen

Active Member
Out of curiosity, is there a reason you're not using the precompiled binaries?

I'm not an expert, but I was never able to compile any version of OBS from source without installing ffmpeg and qt myself. I believe the distributed binaries come from a build system that provides these dependencies, and the source code from OBS' git project expects you to meet those yourself.

The build instructions specifically state:

Use macports or homebrew and install FFmpeg, x264, Qt5, and cmake.

https://github.com/obsproject/obs-studio/wiki/Install-Instructions#macos

The executable you then make will depend on where those are installed on your system. I am not sure what the difference is between what the OBS project does to bundle those into the app so that end users don't need to install them themselves.
 
Top