[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precising Linux build instructions #14

Closed
ysalmon opened this issue May 5, 2021 · 9 comments
Closed

Precising Linux build instructions #14

ysalmon opened this issue May 5, 2021 · 9 comments

Comments

@ysalmon
Copy link
ysalmon commented May 5, 2021

I suggest expanding the build instruction with the following, which will be of interest to people who got OBS Studio from the official PPA.

The PPA does not contain a libobs or libobs-dev and one should not install the version that comes with Debian/Ubuntu as it will not be the same version.
One should get the sources for the installed version, as in the case of a MacOS build : currently git clone --single-branch -b 26.1.1 git@github.com:obsproject/obs-studio.git, then tell cmake where to find it.
Furthermore, one should instruct cmake to install to /usr, not /usr/local as it would by default, because the PPA version of OBS will look there.
So the cmake configuration line is

cmake .. -DobsIncludePath=~/Downloads/obs-studio/libobs -DCMAKE_INSTALL_PREFIX:PATH=/usr

Also, I found that a sudo ldconfig was in order after unpacking onnxruntime but that may be a peculiarity of my system.

@Wurschdbude
Copy link

@ysalmon THX alot for the hint regarding correct branch. This solved it for me. I also use PPA on Ubuntu 20.04 and cloned the repository for the headers.

I did not install to /usr, instead i moved to the following structure, which i prefer for my obs-installation:

~/.config/obs-studio/plugins/obs-backgroundremoval/
├── bin
│   └── 64bit
│       └── obs-backgroundremoval.so
└── data
    ├── SINet_Softmax.onnx
    └── SINet_Softmax_simple.onnx

In my case i did not need to sudo ldconfig.

@royshil
Copy link
Collaborator
royshil commented May 13, 2021

@ysalmon @Wurschdbude can y'all plz make a PR with fixes to the README?

@marcelotrevisani
Copy link

@ysalmon THX alot for the hint regarding correct branch. This solved it for me. I also use PPA on Ubuntu 20.04 and cloned the repository for the headers.

I did not install to /usr, instead i moved to the following structure, which i prefer for my obs-installation:

~/.config/obs-studio/plugins/obs-backgroundremoval/
├── bin
│   └── 64bit
│       └── obs-backgroundremoval.so
└── data
    ├── SINet_Softmax.onnx
    └── SINet_Softmax_simple.onnx

In my case i did not need to sudo ldconfig.

I was not able to use the snap configuration
for some reason is not finding the libonnxruntime

error: os_dlopen(/home/bb8/snap/obs-studio/1195/.config/obs-studio/plugins/obs-backgroundremoval/bin/64bit/obs-backgroundremoval.so->/home/bb8/snap/obs-studio/1195/.config/obs-studio/plugins/obs-backgroundremoval/bin/64bit/obs-backgroundremoval.so): libonnxruntime.so.1.7.0: cannot open shared object file: No such file or directory

warning: Module '/home/bb8/snap/obs-studio/1195/.config/obs-studio/plugins/obs-backgroundremoval/bin/64bit/obs-backgroundremoval.so' not loaded
ldd obs-backgroundremoval.so | grep onnx
	libonnxruntime.so.1.7.0 => /usr/local/lib/libonnxruntime.so.1.7.0 (0x00007f794a5d3000)

however, the file is there

ls /usr/local/lib/libonnxruntime.so.1.7.0
/usr/local/lib/libonnxruntime.so.1.7.0

@coleshaw
Copy link

@marcelotrevisani , curious if you figured out the issue you were having with OBS not finding libonnxruntime.so.1.7.0? I'm running into the same error using a flatpak installation...

@mjevans
Copy link
mjevans commented Sep 12, 2021

I am attempting to build this on Debian stable (11 Bullseye released in 2021), following the current Linux directions with some minor changes.

# # language-pack-en is missing, 
$ sudo apt install -y libobs-dev libopencv-dev wget git build-essential cmake libonnx-dev
$ git clone https://github.com/royshil/obs-backgroundremoval.git .
$ mkdir obs-backgroundremoval/build && cd obs-backgroundremoval/build && \
   cmake .. && cmake --build . && cmake --install .

-- Found Git: /usr/bin/git (found version "2.30.2")
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find LibObs (missing: LIBOBS_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
external/FindLibObs.cmake:97 (find_package_handle_standard_args)
CMakeLists.txt:69 (find_package)

-- Configuring incomplete, errors occurred!
See also ".../src-obs-backgroundremoval/build/CMakeFiles/CMakeOutput.log".

dpkg -l *onnx*
ii libonnx-dev:amd64 1.7.0+dfsg-3 amd64 Open Neural Network Exchange (ONNX) (dev)
ii libonnx1:amd64 1.7.0+dfsg-3 amd64 Open Neural Network Exchange (ONNX) (libs)
ii libonnxifi:amd64 1.7.0+dfsg-3 amd64 Open Neural Network Exchange (ONNX) (ONNXIFI)

dpkg -l '*obs*'
ii libobs-dev:amd64 1:27.0.1-dmo2 amd64 recorder and streamer for live video content (development files)
ii libobs0:amd64 1:27.0.1-dmo2 amd64 recorder and streamer for live video content (shared library)
ii obs-plugins 1:27.0.1-dmo2 amd64 recorder and streamer for live video content (plugins)
ii obs-studio 1:27.0.1-dmo2 amd64 recorder and streamer for live video content

Didn't get there yet, but in case it does...

find /usr -iname '*libonnx*'
/usr/lib/x86_64-linux-gnu/libonnx.so.1
/usr/lib/x86_64-linux-gnu/libonnx_proto.so.1
/usr/lib/x86_64-linux-gnu/libonnxifi_dummy.so
/usr/lib/x86_64-linux-gnu/libonnxifi_loader.a
/usr/lib/x86_64-linux-gnu/libonnx.so
/usr/lib/x86_64-linux-gnu/libonnx_proto.so
/usr/lib/libonnxifi.so
/usr/share/doc/libonnx1
/usr/share/doc/libonnxifi
/usr/share/doc/libonnx-dev
/usr/share/lintian/overrides/libonnxifi

find /usr -iname '*libobs*'
/usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc
/usr/lib/x86_64-linux-gnu/cmake/LibObs
/usr/lib/x86_64-linux-gnu/cmake/LibObs/LibObsConfig.cmake
/usr/lib/x86_64-linux-gnu/cmake/LibObs/LibObsConfigVersion.cmake
/usr/lib/x86_64-linux-gnu/cmake/LibObs/LibObsTarget-release.cmake
/usr/lib/x86_64-linux-gnu/cmake/LibObs/LibObsTarget.cmake
/usr/lib/x86_64-linux-gnu/libobs-frontend-api.so.0.0
/usr/lib/x86_64-linux-gnu/libobs-opengl.so.0.0
/usr/lib/x86_64-linux-gnu/libobs.so.0
/usr/lib/x86_64-linux-gnu/libobsglad.so.0
/usr/lib/x86_64-linux-gnu/libobs-frontend-api.so.0
/usr/lib/x86_64-linux-gnu/libobs-opengl.so.0
/usr/lib/x86_64-linux-gnu/libobs-scripting.so
/usr/lib/x86_64-linux-gnu/libobs-frontend-api.so
/usr/lib/x86_64-linux-gnu/libobs-opengl.so
/usr/lib/x86_64-linux-gnu/libobs.so
/usr/lib/x86_64-linux-gnu/libobsglad.so
/usr/share/doc/libobs0
/usr/share/doc/libobs-dev
/usr/share/obs/libobs

@mjevans
Copy link
mjevans commented Sep 13, 2021

Rebased instructions based on the archlinux package build
#8 (comment)

src-obs-backgroundremoval$ cmake -B build -DobsIncludePath=/usr/include/obs -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_RPATH="/usr/lib/obs-backgroundremoval" -DOnnxruntime_INCLUDE_DIRS=/usr/include/onnx/ -DOnnxruntime_INCLUDE_DIR=/usr/include/onnx/ -DOnnxruntime_LIBRARIES=/usr/lib/x86_64-linux-gnu/libonnx.so

cd build ; make

... onnxruntime_cxx_api.h isn't included in any package shipped by Debian

https://github.com/microsoft/onnxruntime/releases
Current version
wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz
tar -axf onnxruntime-linux-x64-1.8.1.tgz

$ cmake -B build -DobsIncludePath=/usr/include/obs -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_RPATH="/usr/lib/obs-backgroundremoval"
-DOnnxruntime_INCLUDE_DIRS="$srcdir/$_onnxdir/include/"
-DOnnxruntime_LIBRARIES="$srcdir/$_onnxdir/lib/libonnxruntime.so"
-DOnnxruntime_INCLUDE_DIR="$srcdir/$_onnxdir/include/"

cd build
make
sudo cmake --install
sudo cp -v ../onnxruntime*/lib/* /usr/lib/obs-backgroundremoval/

obs

Now to figure out the v4l2loopback camera...

@melhindi
Copy link

Hi,
I am running ubuntu 21.04 and I had to do the following to be able to build and install the plugin:

  • Remove OBS-Studio installed via snap and install OBS-Studio via ppa (sudo apt install obs) [this was required due to dependency conflicts with libobs-dev]
  • Install dependencies as mentioned in README
apt install -y libobs-dev libopencv-dev language-pack-en wget git build-essential cmake
wget https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz
tar xzvf onnxruntime-linux-x64-1.7.0.tgz --strip-components=1 -C /usr/local/ --wildcards "*/include/*" "*/lib*/"
  • Run: cmake -S . -B build -DobsIncludePath=/usr/include/obs to configure the build [this was required since LibObs could not be found (missing: LIBOBS_INCLUDE_DIR) ]
  • Run build and install cmake --install build && sudo cmake --install build [sudo was required for installation since we are installing to /usr/...]
  • Last but not least I found that the plugin was installed to the wrong directories (my OBS installation did not load the plugin). So, I had to do the following in addition:
sudo mv /usr/local/share/obs/obs-plugins/obs-backgroundremoval /usr/share/obs/obs-plugins
sudo mv /usr/local/lib/obs-plugins/obs-backgroundremoval.so /usr/lib/obs-plugins

I was not able to find an official statement about the correct plugin install directory, but the information written in this forum helped me: https://forums.linuxmint.com/viewtopic.php?t=278509

If people agree that this is the correct installation procedure/location, I am happy to create a PR.

@marcelotrevisani
Copy link

Hi,
I am running ubuntu 21.04 and I had to do the following to be able to build and install the plugin:

* Remove OBS-Studio installed via snap and install OBS-Studio via ppa (`sudo apt install obs`) [this was required due to dependency conflicts with libobs-dev]

* Install dependencies as mentioned in README
apt install -y libobs-dev libopencv-dev language-pack-en wget git build-essential cmake
wget https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz
tar xzvf onnxruntime-linux-x64-1.7.0.tgz --strip-components=1 -C /usr/local/ --wildcards "*/include/*" "*/lib*/"
* Run: `cmake -S . -B build -DobsIncludePath=/usr/include/obs` to configure the build [this was required since LibObs could not be found (missing: LIBOBS_INCLUDE_DIR) ]

* Run build and install `cmake --install build && sudo cmake --install build` [sudo was required for installation since we are installing to /usr/...]

* Last but not least I found that the plugin was installed to the wrong directories (my OBS installation did not load the plugin). So, I had to do the following in addition:
sudo mv /usr/local/share/obs/obs-plugins/obs-backgroundremoval /usr/share/obs/obs-plugins
sudo mv /usr/local/lib/obs-plugins/obs-backgroundremoval.so /usr/lib/obs-plugins

I was not able to find an official statement about the correct plugin install directory, but the information written in this forum helped me: https://forums.linuxmint.com/viewtopic.php?t=278509

If people agree that this is the correct installation procedure/location, I am happy to create a PR.

That worked for me, I just needed to change the location of the plugins to
/usr/lib/x86_64-linux-gnu/obs-plugins/

royshil pushed a commit that referenced this issue Mar 7, 2023
* Add obs-plugintemplate files (#1)

* Add obs-plugintemplate files

* Rename

* Update CMakeLists.txt

* Update main.yml

* files

* Update CMakeLists.txt

* Fix

* Update .Brewfile

* Update main.yml

* Update main.yml

* check-cmake.sh

* Update main.yml

* Update main.yml

* Build my opencv (#2)

* BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* check-cmake

* Update main.yml

* Update buildspec.json

* Update CMakeLists.txt

* Build my onnxruntime (#3)

* fix

* Update BuildMyOnnxruntime.cmake

* Enable arm64

* 0.5.2

* Update BuildMyOnnxruntime.cmake

* Update .Brewfile

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* fix

* Fix

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* a

* Create .gitmodules

* Create onnxruntime

* Update onnxruntime

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* fix

* Update BuildMyOnnxruntime.cmake

* ARCHITECTURE

* Apply

* Update BuildMyOnnxruntime.cmake

* fix

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* aaa

* Enable Windows build (#4)

* Enable Windows build

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Fix linkage

* Remove /WX

* Update ObsPluginHelpers.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update CMakeLists.txt

* Fix

* Update CMakeLists.txt

* a

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Disable DML

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update background-filter.cpp

* Update BuildMyOnnxruntime.cmake

* Disable DML

* Fix segfault (#6)

* Update Model.h

* 0.5.6

* Ccache macos (#8)

* Ccache

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Revert "Update BuildMyOnnxruntime.cmake"

This reverts commit 44d9caa.

* Revert "Update BuildMyOnnxruntime.cmake"

This reverts commit 9294106.

* Direct ml (#7)

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* dml

* 0.5.7

* Update CMakeLists.txt

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* a

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Fix

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* Linux build (#9)

* linux

* 0.5.8

* Update BuildMyOnnxruntime.cmake

* Update setup_ccache (#10)

* bump version (#11)

* Use ninja on windows (#12)

* Update main.yml

* Update main.yml

* Use Ninja

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* ccache

* Update BuildMyOpenCV.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* Update main.yml

* Update CMakeLists.txt

* Update BuildMyOnnxruntime.cmake

* Long path

* Update main.yml

* Update BuildMyOnnxruntime.cmake

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOnnxruntime.cmake

* Windows opencv ccache (#13)

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update BuildMyOpenCV.cmake

* Update main.yml

* Update BuildMyOpenCV.cmake

* bump 0.5.10 (#14)

* Cleanup (#15)

* Cleanup

* bump version

* Fix ep (#16)

* Update BuildMyOnnxruntime.cmake

* Update BuildMyOpenCV.cmake

* Update main.yml (#18)

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* 0.5.12

* Fix

* Update package-macos.zsh

* Update package-linux.zsh

* Update CMakeLists.txt

* ci

* Fix

* Update background-filter.cpp

* Fix

* clang-format

* cmake-format

* Update BuildMyOpenCV.cmake

* Update BuildMyOnnxruntime.cmake

* Fix errors

* Use -isystem

* Use list in set_target_properties

* INTERFACE_INCLUDE_DIRECTORIES must be on IMPORTED TARGET

* Update ObsPluginHelpers.cmake
@royshil
Copy link
Collaborator
royshil commented Mar 18, 2023

new build scripts in place for linux

@royshil royshil closed this as completed Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants