Closed GloriousEggroll closed 1 month ago
Nevermind figured it out.
The bundled onnxruntime libraries with the default build options from https://github.com/occ-ai/obs-backgroundremoval/pull/581 force cuda rpaths.
There's a few things to fix. --
https://github.com/occ-ai/obs-backgroundremoval/pull/545
And without the CMakeList changes there for using system onnxruntime it would not detect onnxruntime on my system even though I had onnxruntime-devel installed. So, I recommend porting that portion of that patch over.
-DUSE_SYSTEM_ONNXRUNTIME=ON \
And build requirements:
BuildRequires: onnxruntime-devel
And requirements:
Requires: onnxruntime
However, that kept wanting to use:
OrtSessionOptionsAppendExecutionProvider_Tensorrt
Which of course relies on cuda, so I also did:
-DDISABLE_ONNXRUNTIME_GPU=ON \
That allowed it to fully work and build on Fedora via my spec sheet.
Here's the relevant parts of my spec sheet:
Name: obs-studio-plugin-backgroundremoval
Version: 1.1.13
Release: 1%{?dist}
Summary: A plugin for OBS Studio that allows you to replace the background in portrait images and video, as well as enhance low-light scenes.
License: GPL-2.0-or-later
URL: https://github.com/occ-ai/obs-backgroundremoval
Source0: https://github.com/occ-ai/obs-backgroundremoval/archive/refs/tags/%{version}.tar.gz
# ROCM support
Patch0: 545.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: cmake(libobs)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: curl-devel
BuildRequires: opencv-devel
BuildRequires: onnxruntime-devel
Requires: opencv-core
Requires: onnxruntime
Supplements: obs-studio%{?_isa}
%description
%{name}.
%prep
%autosetup -n obs-backgroundremoval-%{version} -p1
%build
%cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DENABLE_FRONTEND_API=ON \
-DENABLE_QT=OFF \
-DENABLE_ROCM=OFF \
-DUSE_SYSTEM_ONNXRUNTIME=ON \
-DDISABLE_ONNXRUNTIME_GPU=ON \
-DUSE_SYSTEM_OPENCV=ON
%cmake_build
%install
%cmake_install --prefix /usr
%files
%license LICENSE
%{_libdir}/obs-plugins/obs-backgroundremoval*
%{_datadir}/obs/obs-plugins/obs-backgroundremoval*
%changelog
* Wed Jun 05 2024 Tom Crider <gloriouseggroll@gmail.com>
- Initial build 1.1.13
This should be enough for a clean Fedora rpm build without relying on cuda or rocm
Thank you for sharing!
I'm trying to build this as an rpm package for fedora, but it seems to have hard coded rpaths that require cuda:
Does this absolutely require cuda to function properly? I didn't see any mention of cuda as a hard requirement in the readme.