So, after few days of struggling - answering my own question.
As far as I understand, there were two issues here:
libcvextern.so
was missing.
libcvextern.so
dependencies were missing.
Fixing the issues:
1. Missing libcvextern.so:
- Downloaded the Emgu.CV.runtime.ubuntu
- unzip it and get the
libcvextern.so
file (build/x64/libcvextern.so
).
- Add the
libcvextern.so
file to the project and set Copy to Output directory
to Copy if Newer
Note: For the windows nuget package the files that you need are added automatically. Not sure why this does not happen for linux.
2. Missing dependencies:
- As per the documentation (Linux -> Getting ready), I have cloned the repo and ran the script that makes sure that all dependencies are installed:
get dotnet Framework:
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
Get the source code:
git clone https://github.com/emgucv/emgucv emgucv
cd emgucv
git submodule update --init --recursive
Make sure the dependencies are available:
# cd into the relevant platform
cd platforms/ubuntu/20.04
# As per documentation: This only needs to be run once.
./apt_install_dependency
# This is what actually builds the dependencies. This will take a while...
./cmake_configure
Bonus:
If you, like me, don't have root permissions to your machine, you can use docker.
Update Dec-2022:
I'll try and keep posting docker files for new versions as they come out with my conclusions after making emgu work...
The Dockerfile I have used:
.NET 6, emgu 4.6, Dec-2022:
FROM ubuntu
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
RUN apt-get update && apt-get -y install sudo
# Dotnet Framework
# https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
WORKDIR /tmp
RUN wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0
# Make sure all emgu dependencies are in place
# http://www.emgu.com/wiki/index.php/Download_And_Installation#Getting_ready
WORKDIR /mnt/emgu_repo
RUN git clone https://github.com/emgucv/emgucv emgucv
WORKDIR /mnt/emgu_repo/emgucv
RUN git fetch origin 4.6.0
RUN git checkout 4.6.0
RUN git submodule update --init --recursive
# install cmake for compiling open cv dependencies
RUN apt-get update && apt-get install -y cmake protobuf-compiler ffmpeg libgtk-3-dev libgstreamer1.0-dev libavcodec-dev libswscale-dev libavformat-dev libdc1394-22-dev libv4l-dev ocl-icd-dev freeglut3-dev libgeotiff-dev libusb-1.0-0-dev
WORKDIR /mnt/emgu_repo/emgucv/platforms/ubuntu/20.04
RUN ./apt_install_dependency
# this takes a long time
RUN ./cmake_configure
WORKDIR /mnt/my_app_root
# emgu needs the libcvextern.so file & dependency in the rrot folder
RUN cp /mnt/emgu_repo/emgucv/libs/runtimes/ubuntu-x64/native/* ./
ENTRYPOINT ["bash"]
.NET core 3.1, emgu 4.3, Sep-2020:
FROM ubuntu
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
# Bring the dotnet Framework
RUN wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-3.1
# Make sure all emgu dependencies are in place
# http://www.emgu.com/wiki/index.php/Download_And_Installation#Getting_ready
WORKDIR /mnt/emgu_repo
RUN git clone https://github.com/emgucv/emgucv emgucv
WORKDIR /mnt/emgu_repo/emgucv
RUN git submodule update --init --recursive
WORKDIR /mnt/emgu_repo/emgucv/platforms/ubuntu/18.04
RUN apt-get update && apt-get -y install sudo
RUN `cat ./apt_install_dependency.sh | grep -Ev "\#\!"` -y
RUN ./cmake_configure.sh
ENTRYPOINT ["bash"]