Vhonowslend / StreamFX-Public

StreamFX is a plugin for OBS® Studio which adds many new effects, filters, sources, transitions and encoders! Be it 3D Transform, Blur, complex Masking, or even custom shaders, you'll find it all here.
https://s.xaymar.com/streamfx-dc
GNU General Public License v2.0
3.93k stars 2.97k forks source link

Obstacles to build on Linux / arm64 [solved, need permanent fix] but core dump on start of plugin #465

Closed Costor closed 3 years ago

Costor commented 3 years ago

Hi, I successfully compiled and installed StreamFX (bundled with obs-studio) on Linux-arm64 (details below). Doing so I encountered and temporarily fixed three issues with the Linux build process that imho require a permanent fix (see below). However the plugin core dumps when loaded by obs, which might be a result of hidden Linux/arm64 compatibility issues of the obs<->streamfx plugin mechanisms. So my issues are 1) permantly fixing the build process for Linux / arm64 which currently seems borken 2) Making sure my fixes didn't introduce errors that cause the seg fault of streamfx 3) fixing the seg fault of streamfx

Remark: My ultimate goal is to use the hardware encoder h264_nvmpi which replaces h264_nvenc on the nvidia jetson and which I have already compiled into ffmpeg. I will probably need help on this but will start with this only once streamfx works at all.

Environment details

Jetson Nano 4GB RAM (ARM V8 64-Bit, Nvidia GPU), Ubuntu 20.04 LTS, Cuda 10.2, obs-studio 26.1.2 (build from source with ffmpeg 2.4.4 build from source, all running stable), Gcc/g++ 8.0 (must be 8 for compatbility with cuda 10.2), streamfx 0.10.0.0a1-gfbe35d15.

Overview of build obstacles for Linux and/or arm64 (details and my fixes see below):

  1. Just an addition to the instructions: After adding the git submodule streamfx there should also be 'git submodule init && git submodule update' from the streamfx folder to update the submodules of streamfx
  2. Disabling of nvidia arsdk for non-Windows environments does not work, so compile of arsdk files necessarily fails
  3. invalid static_cast for os_dlsym(..) when loading from CUDA lib: discrepancy of gnu g++ compiler to MSC
  4. Use of xmmintrin.h for SIMD instructions for non x86/x64 architectures

My analysis and temporary fixes

streamfx segmentation fault

With this patches, obs including streamfx build successfully only displaying marginal compiler warnings about unused variables etc. Also the install process was without warnings. Remember that obs ran ok without streamfx so I assume streamfx is causing the segmentation fault:

output from obs before segmentation fault

Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /usr/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/themes/Dark.qss
Attempted path: /usr/share/obs/obs-studio/themes/Dark.qss
info: Physical Cores: 4, Logical Cores: 4
info: Physical Memory: 3956MB Total, 1113MB Free
info: Kernel Version: Linux 4.9.140-tegra
info: Distribution: "Ubuntu" "20.04"
info: Session Type: x11
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.9
info: Portable mode: false
Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg
Attempted path: /usr/share/obs/obs-studio/themes/Dark/no_sources.svg
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_actionGridMode_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_program_customContextMenuRequested(QPoint)
QMetaObject::connectSlotsByName: No matching signal for on_transitionRemove_clicked()
info: OBS 26.1.2-161-g36ab7b97c-modified (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
        samples per sec: 48000
        speakers:        2
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter Mesa/X.org llvmpipe (LLVM 11.0.0, 128 bits)
info: OpenGL loaded successfully, version 4.5 (Core Profile) Mesa 20.2.6, shading language 4.50
info: ---------------------------------
info: video settings reset:
        base resolution:   1280x1024
        output resolution: 1024x818
        downscale filter:  Bicubic
        fps:               30/1
        format:            NV12
        YUV mode:          709/Partial
info: NV12 texture support not available
info: Audio monitoring device:
        name: Default
        id: default
info: ---------------------------------
warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so'
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
info: No blackmagic support
warning: v4l2loopback not installed, virtual camera disabled
info: [obs-browser]: Version 2.13.1
info: [obs-browser]: CEF Version 88.2.5+gcab058b+chromium-88.0.4324.150
info: FFMPEG VAAPI supported
info: [StreamFX] Loading Version 0.10.0.0a1-gfbe35d15
Segmentation fault (core dumped)
================ end of output ===========
Xaymar commented 3 years ago

Please don't delete the template when submitting features, issues or pull requests!

Can you try formatting this a little bit?

Costor commented 3 years ago

I emphasised the headlines, hopefully the structure has become clearer. As said above, three issues here 1) permanently fixing the linux / arm64 build process which currently seems broken [I provide analysis and my fixes] 2) making sure my fixes didn't introduce errors that make streamfx seg fault 3) fixing the seg fault

Xaymar commented 3 years ago
  1. Just an addition to the instructions: After adding the git submodule streamfx there should also be 'git submodule init && git submodule update' from the streamfx folder to update the submodules of streamfx

Added.

2.Disabling of nvidia arsdk for non-Windows environments does not work, so compile of arsdk files necessarily fails

Should be taken care of by #466

  1. invalid static_cast for os_dlsym(..) when loading from CUDA lib: discrepancy of gnu g++ compiler to MSC

Should be taken care of by #467

  1. Use of xmmintrin.h for SIMD instructions for non x86/x64 architectures

I'm not sure why this file is still being included, as we completely rely on Compiler optimizations these days.

Costor commented 3 years ago

Great. In order to have a clean situation I removed the streamfx code from two days back and started out with a fresh full clone of streamfx. This way I could also test the build & install instructions.

Instructions & build / compile went fine. All build issues seem to be fixed.

The resulting obs still core dumps on loading/starting streamFX. I will open a new issue for this.