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

Not building on Archlinux #8

Closed
morrolinux opened this issue Apr 29, 2021 · 10 comments
Closed

Not building on Archlinux #8

morrolinux opened this issue Apr 29, 2021 · 10 comments

Comments

@morrolinux
Copy link

Hi,
This is what happens when I try to build on Archlinux following the README instructions:

[morro@t480s build]$ cmake .. && cmake --build . && cmake --install .
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (Libobs)
  does not match the name of the calling package (LibObs).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  external/FindLibObs.cmake:89 (find_package_handle_standard_args)
  CMakeLists.txt:50 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find Libobs (missing: LIBOBS_INCLUDE_DIR) 
CMake Error at external/FindLibObs.cmake:111 (message):
  Could not find the libobs library
Call Stack (most recent call first):
  CMakeLists.txt:50 (find_package)


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

If I edit external/FindLibObs.cmake and change find_package_handle_standard_args(Libobs ....) to find_package_handle_standard_args(LibObs ....) I still get

[morro@t480s build]$ cmake .. && cmake --build . && cmake --install .
CMake Error at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibObs (missing: LIBOBS_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  external/FindLibObs.cmake:89 (find_package_handle_standard_args)
  CMakeLists.txt:50 (find_package)


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

I do have libobs under /usr/lib/pkgconfig where libobs.pc is found but if I export LIBOBS_INCLUDE_DIR="/usr/lib/pkgconfig/" the output doesn't change so I'm probably not doing it right.
Any suggestions?

@royshil
Copy link
Collaborator

royshil commented Apr 29, 2021

you can always give cmake the directories explicitly e.g.

$ cmake .. -DobsIncludePath=/usr/local/include/libobs -DobsLibPath=/usr/local/lib

@progandy
Copy link

Remove external/FindLibObs.cmake and try again, this file should only be required for osx.

@ngoonee
Copy link

ngoonee commented May 1, 2021

Hi,
This is what happens when I try to build on Archlinux following the README instructions:

Hi, do let me know if you were successful (or better yet try to provide a PKGBUILD). Haven't tried it myself due to time constraints but I will get round to it at some point.

@savy-91
Copy link

savy-91 commented May 1, 2021

I am getting the same error on Ubuntu 21.04

@royshil
Copy link
Collaborator

royshil commented May 2, 2021

I've added a PKGBUILD for making the package
@ngoonee ☝️

@morrolinux
Copy link
Author

Awesome work @royshil !
However I had to

sudo ln -s /usr/local/share/obs/obs-plugins/obs-backgroundremoval /usr/share/obs/obs-plugins/obs-backgroundremoval
sudo ln -s /usr/local/lib/obs-plugins/obs-backgroundremoval.so /usr/lib/obs-plugins/obs-backgroundremoval.so

Because apparently OBS plugins in Archlinux are loaded from /usr/lib rather than /usr/local so you might want to correct that in the Makefile or add those two lines in the pkgbuild IDK.

Thanks for the awesome work :)

@royshil
Copy link
Collaborator

royshil commented May 13, 2021

@morrolinux can you plz make a PR with changes to the PKGBUILD?

@progandy
Copy link

progandy commented May 13, 2021

Here is a working PKGBUILD that downloads the release version and does not use git at all. Feel free to use it without attribution, I consider it public domain / CC0.

The changes in prepare should probably fixed directly. Maybe skip version_from_git if VERSION is set or let it fail gracefully. The models listed in CMakeLIsts have to be fixed as well.

pkgname=obs-backgroundremoval
pkgver=0.2.4_beta
_ONNXRUNTIME_FILE=onnxruntime-linux-x64-1.7.0.tgz
_onnxdir=onnxruntime-linux-x64-1.7.0
_bgdir=$pkgname-${pkgver//_/-}
pkgrel=1
arch=(x86_64)
url='https://github.com/royshil/obs-backgroundremoval'
pkgdesc="Background removal plugin for OBS studio (precomopiled onnxruntime)"
license=(MIT custom)
depends=(obs-studio opencv)
makedepends=(cmake)
source=("${_bgdir}.tar.gz::https://github.com/royshil/$pkgname/archive/refs/tags/v${pkgver//_/-}.tar.gz" 
        "https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/$_ONNXRUNTIME_FILE")
sha256sums=('5e66cfc45827581bc8da50a775d3e8601beb4aec72d42f0efc4d3e403161ddc1'
            '0345f45f222208344406d79a6db3280ed2ccc884dc1e064ce6e6951ed4c70606')

prepare() {
  # build from archive, not git. Version set during build()
  sed -i "s/^version_from_git/#&/" $_bgdir/CMakeLists.txt

  # fix models listed in cmake
  sed -i '/^.*file(GLOB/i file(GLOB onnxmodels data/*.onnx)' $_bgdir/CMakeLists.txt
  sed -i 's/"data\/SINet_Softmax.onnx"/${onnxmodels}/' $_bgdir/CMakeLists.txt
}

build() {
  cd "$_bgdir"
  # no way to set beta suffix
  # set rpath to avoid installing onnxruntime globally
  cmake -B build -DVERSION="${pkgver//_*/.0}" -DobsIncludePath=/usr/include/obs/ \
           -DCMAKE_INSTALL_PREFIX:PATH=/usr \
           -DOnnxruntime_INCLUDE_DIRS="$srcdir/$_onnxdir/include/" -DOnnxruntime_LIBRARIES="$srcdir/$_onnxdir/lib/libonnxruntime.so" \
           -DOnnxruntime_INCLUDE_DIR="$srcdir/$_onnxdir/include/" \
           -DCMAKE_INSTALL_RPATH="/usr/lib/obs-backgroundremoval"
  cd build
  make
}

package() {
  make -C "$_bgdir/build" DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/obs-backgroundremoval" "$_bgdir/LICENSE"

  # install onnxruntimey
  cd "$_onnxdir"
  install -Dt "$pkgdir/usr/share/licenses/obs-backgroundremoval/onnxruntime" \
          LICENSE  Privacy.md  README.md  ThirdPartyNotices.txt
  install -Dt "$pkgdir/usr/lib/obs-backgroundremoval" lib/*
}

@ngoonee
Copy link

ngoonee commented May 19, 2021

The provided PKGBUILD by @progandy works for me. Thanks!

@royshil
Copy link
Collaborator

royshil commented May 25, 2021

the changes have been incorporated into the PKGBUILD. Thank you everyone!

@royshil royshil closed this as completed May 25, 2021
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
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

5 participants