Debugging OBS in Clion

univrsal

Active Member
Hey there,

I usually develop my plugin on Windows with Visual Studio, which works fine, but I recently
added a linux version and now I need to work with with the source code on linux.

Since I'm used to a graphical IDE I'd like to work with Clion for now. I opened obs-studio repository
in Clion and it detected the CMakeLists.txt and added all build configurations just fine,
but when I try and run it through Clion I get the following error:
Code:
Failed to initialize video.  Your GPU may not be supported, or your graphics drivers may need to be updated.
Code:
/home/usr/.CLion2016.2/system/cmake/generated/obs-studio-24ccea19/24ccea19/Debug/UI/obs
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/local/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/themes/Dark.qss
Attempted path: /usr/local/share/obs/obs-studio/themes/Dark.qss
Attempted path: share/obs/obs-studio/license/gplv2.txt
Attempted path: /usr/local/share/obs/obs-studio/license/gplv2.txt
info: CPU Name: AMD FX(tm)-8350 Eight-Core Processor
info: CPU Speed: 4000.066MHz
info: Physical Cores: 4, Logical Cores: 8
info: Physical Memory: 7990MB Total, 1576MB Free
info: Kernel Version: Linux 4.15.3-1-ARCH
info: Distribution: "Arch Linux" Unknown
debug: found alternate keycode 218 for OBS_KEY_PRINT which already has keycode 107
info: Portable mode: false
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked()
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed()
QMetaObject::connectSlotsByName: No matching signal for on_program_customContextMenuRequested(QPoint)
info: OBS 21.0.2-5-gd9f34825 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
    samples per sec: 44100
    speakers:        2
info: ---------------------------------
info: Initializing OpenGL...
info: OpenGL version: 3.2.0 NVIDIA 390.25
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
error: Failed to initialize video.  Your GPU may not be supported, or your graphics drivers may need to be updated.
info: Freeing OBS context data
info: == Profiler Results =============================
info: run_program_init: 51024,9 ms
info:  ┣OBSApp::AppInit: 1,722 ms
info:  ┃ ┗OBSApp::InitLocale: 1,483 ms
info:  ┗OBSApp::OBSInit: 232,591 ms
info:    ┣obs_startup: 12,741 ms
info:    ┗OBSBasic::OBSInit: 186,914 ms
info:      ┣OBSBasic::InitBasicConfig: 0,133 ms
info:      ┣OBSBasic::ResetAudio: 0,189 ms
info:      ┗OBSBasic::ResetVideo: 186,542 ms
info: obs_hotkey_thread(25 ms): min=0,071 ms, median=0,105 ms, max=52,107 ms, 99th percentile=1,849 ms, 99,9502% below 25 ms
info: audio_thread(Audio): min=0 ms, median=0,032 ms, max=1,384 ms, 99th percentile=0,054 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25,128 ms, median=25,177 ms, max=77,19 ms, 87,6058% within ±2% of 25 ms (0% lower, 12,3942% higher)
info: =================================================
info: Number of memory leaks: 220

Process finished with exit code 255
Before that error OBS also complained about not finding lang files, the licence etc. but I fixed that by copying them to /usr/local/share/obs/obs-studio/ (Arch seems to install them somewhere else by default)
OBS runs just fine outside of Clion so I guess something about the way it handles the build results in the error.

So my question is: Does anyone have experience with getting obs to work inside Clion. I technically only need the debugging feature to track down some issues so I'd also take advice in using gdb for debugging even though that's not as straightforward.

Thanks in advance!
 

c3r1c3

Member
The issue has something to do with CLion not linking/updating stuff correctly. If you look at the build paths and the commands that CLion runs (i.e. it builds it and then tries to run the compile without installing it), CLion isn't doing something correctly.

My guess is it has something to do with ldconfig (i.e. CLion not invoking it at all, or correctly) or something that CLion is altering in the cmake process that makes the build not be able to use your GPU.
 

univrsal

Active Member
The issue has something to do with CLion not linking/updating stuff correctly. If you look at the build paths and the commands that CLion runs (i.e. it builds it and then tries to run the compile without installing it), CLion isn't doing something correctly.

My guess is it has something to do with ldconfig (i.e. CLion not invoking it at all, or correctly) or something that CLion is altering in the cmake process that makes the build not be able to use your GPU.
Hmm yeah I figured that it has something to do with how Clion builds it but I have no idea how to change that. For now I just built obs manually and pointed clion to the binary. It's stupid but I can use Clion to debug my plugin now even though it behaves a little wonky.
 

c3r1c3

Member
Something that I'm about to try is using CLion for code and using the built-in terminal to issue the build/install commands. That should work, but I haven't tried it yet. (It should also be a touch more convenient then alt-tabbing to an external terminal and issuing the commands there.)
 

univrsal

Active Member
Something that I'm about to try is using CLion for code and using the built-in terminal to issue the build/install commands. That should work, but I haven't tried it yet. (It should also be a touch more convenient then alt-tabbing to an external terminal and issuing the commands there.)
I'll be happy to hear about the results^^
 

c3r1c3

Member
Sorry about that.

Yes, it works just like issuing the commands from a standalone terminal, so the usual "rm -rf *;cmake ..; make -j12; sudo make install;obs" (or just the last 4 or 3 of those) command works perfectly.

On a side note I have thought about turning the above into a script and have CLion run it 'automatically' via cmake, but that would be a drain on system resources and wouldn't be worthwhile.
 
Top