opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

Repeat #1448

Open anomal3 opened this issue 2 months ago • 0 comments

I will duplicate a possible fix for error #1448 when dependencies are not found. I'll duplicate this under a new issue because the previous one is closed.

Image

I encountered the same problem on a stripped-down Ubuntu installation using Proxmox. If you have a similar problem, here are the steps for building from source and with dependencies. The library itself will be located in a different location, see screenshot. 1 Installing build dependencies

sudo apt-get update
sudo apt-get install -y \
build-essential cmake git pkg-config \
libjpeg-dev libpng-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev \
libgtk2.0-dev libgtk-3-dev libcanberra-gtk* \
libtbb-dev libeigen3-dev libx264-dev libx265-dev \
libopenexr-dev libilmbase-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
yasm

These packages contain all the libraries needed by OpenCV and OpenCvSharpExtern.


  1. Download OpenCV and OpenCvSharp sources mkdir -p ~/build-opencv cd ~/build-opencv
# OpenCV
git clone -b 4.8.1 https://github.com/opencv/opencv.git
git clone -b 4.8.1 https://github.com/opencv/opencv_contrib.git

# OpenCvSharp
git clone https://github.com/shimat/opencvsharp.git

  1. Build OpenCV with FFmpeg and OpenEXR support cd opencv mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ 
-D WITH_FFMPEG=ON \ 
-D WITH_TBB=ON \ 
-D WITH_OPENEXR=ON \ 
-D BUILD_opencv_python=OFF \ 
-D BUILD_opencv_java=OFF \ 
-D BUILD_EXAMPLES=OFF \ 
-D BUILD_TESTS=OFF \ 
-D BUILD_DOCS=OFF ..

make -j$(nproc) sudo make install

The process is not fast. OpenCV check:

pkg-config --modversion opencv4


  1. Building OpenCvSharpExtern cd ~/build-opencv/opencvsharp/src

Create a build folder

mkdir build && cd build

Build for Linux

cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DOpenCV_DIR=/usr/local/lib/cmake/opencv4

make -j$(nproc)

After building, the libOpenCvSharpExtern.so file will be in build/Linux/x64/Release/. (For some reason the file didn't appear there, but it did appear as in the screenshot)


  1. Copying to project cp build/Linux/x64/Release/libOpenCvSharpExtern.so /YOUR_PATH/

Optional: If the file appeared like mine, change the path.

Checking dependencies:

ldd /YOUR_PATH/libOpenCvSharpExtern.so | grep "not found"

Everything should be found.

anomal3 avatar Oct 29 '25 10:10 anomal3