Closed Costor closed 3 years ago
Please don't delete the template when submitting features, issues or pull requests!
Can you try formatting this a little bit?
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
- 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
- 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
- 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.
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.
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):
My analysis and temporary fixes
Concerning 2) The CMakelists.txt for streamfx has a check for "Nvidia Face tracking" in Line 562. However that does not work - though cmake gives the warning "Face tracking Windows only: disabling..", the lines from 1148 on are still included by cmake. Moreover the lines 872ff include the nvidia-ar.* sources unconditionally if only the submodule arsdk is present. So I had to comment out all this lines to prevent arsdk files from being included in the build. Probably it is best to not install the whole submodule arsdk if nvidia face tracking is not wanted or not available for Linux.
Concerning 3) streamfx/CMakeFiles/StreamFX.dir/source/nvidia/cuda/nvidia-cuda.cpp contains lines "NAME = static_cast\<type>(os_dlsym(..))" to load symbols from dynamic CUDA libraries. os_dlsym() returns void*, which is cast to a function pointer. g++ throws an error on this casts, as ANSI C does not permit casts from object pointers to function pointers. MSC is probably more forgiving here. So the solution for g++ seems to either use a C-type cast (that is what the other c++ code in obs-studio does) or to use reinterpret_cast (what I did)
Concerning 4) streamfx/source/obs/gs/gs-vertex.hpp unconditionally includes xmmintrin.h which is a x86 specific include for SIMD instructions and does not exist on other architectures. obs-studio has build in architecture independent support for SIMD instructions by using the sse2neon solution. This is already via obs.h->obs-studio/libobs/util/sse-intrin.h ->simde/x86/sse2.h (Note that sse2.h is architecture aware and includes ARM64 support though for historical reasons it is placed in x86/ folder). So I put #if defined(MSC) .. #endif around the #include (probably the include is superfluous anyway as it also might be handled by sse2.h under Windows).
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