building c++ opencv 4 with cuda ubuntu 16/04 - c++

I'm trying to build opencv' with cuda 10.2. When the following command :
cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DWITH_TBB=ON -DWITH_CUDA=ON \
-DBUILD_opencv_cudacodec=OFF \
-DENABLE_FAST_MATH=1 \
-DWITH_CUBLAS=1 \
-DWITH_V4L=ON \
-DWITH_OPENGL=ON \
-DWITH_GSTREAMER=ON \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DOPENCV_ENABLE_NONFREE=ON \
-DBUILD_EXAMPLES=TRUE \
-DBUILD_PERF_TESTS=FALSE \
-DEBUILD_TESTS=FALSE ../../opencv
I have the following issue :
Could NOT find CUDNN (missing: CUDNN_LIBRARY CUDNN_INCLUDE_DIR) (Required is at least version "6")
of course I have installed cudnn7 corresponding to cuda 10.2, I the installation test passed.
Can someone help ?

To fix the problem I added the following options for cmake :
-DCUDNN_INCLUDE_DIR=/usr/local/cuda/include \
-DCUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so.7.6.5 \

You may also need to add:
-DCUDNN_VERSION='7.6'
Or in my case it was:
-DCUDNN_VERSION='8.0'

Related

Packages missing while compiling Inkscape source code on Windows with MINGW64

I am trying to compile the source code for Inkscape following this guide https://wiki.inkscape.org/wiki/index.php/Compiling_Inkscape_on_Windows_with_MSYS2
I get the following errors
-- Checking for modules 'harfbuzz;pangocairo;pangoft2;fontconfig;gsl;gmodule-2.0;libsoup-2.4>=2.42
-- No package 'harfbuzz' found
-- No package 'pangocairo' found
-- No package 'pangoft2' found
-- No package 'fontconfig' found
-- No package 'gsl' found
-- No package 'gmodule-2.0' found
-- No package 'libsoup-2.4' found
I found this answer Error while compiling Inkscape from source code but that only works for Ubuntu and I am working on Windows.
I ran this script
msys2installdeps.sh
# install Inkscape dependencies (required)
eval pacman -S $PACMAN_OPTIONS \
$ARCH-double-conversion \
$ARCH-gc \
$ARCH-gsl \
$ARCH-libxslt \
$ARCH-boost \
$ARCH-gtk3 \
$ARCH-gtkmm3 \
$ARCH-gdl \
$ARCH-libsoup
# install Inkscape dependencies (optional)
eval pacman -S $PACMAN_OPTIONS \
$ARCH-poppler \
$ARCH-potrace \
$ARCH-libcdr \
$ARCH-libvisio \
$ARCH-libwpg \
$ARCH-aspell \
$ARCH-aspell-en \
$ARCH-gtkspell3
# install ImageMagick (as Inkscape requires old version ImageMagick 6 we have to specify it explicitly)
# to prevent future updates:
# add the line
# "IgnorePkg = mingw-w64-*-imagemagick"
# to
# "C:\msys64\etc\pacman.conf"
# or (always!) run pacman with the additional command line switch
# --ignore=mingw-w64-*-imagemagick
for arch in $(eval echo $ARCH); do
wget -nv https://gitlab.com/ede123/bintray/raw/master/${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz \
&& pacman -U $PACMAN_OPTIONS ${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz \
&& rm ${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz
done
# install Python and modules used by Inkscape
eval pacman -S $PACMAN_OPTIONS \
$ARCH-python3 \
$ARCH-python3-pip \
$ARCH-python3-lxml \
$ARCH-python3-numpy \
$ARCH-python3-pillow \
$ARCH-python3-six \
$ARCH-python3-gobject
PACKAGES="coverage pyserial scour"
for arch in $(eval echo $ARCH); do
case ${arch} in
mingw-w64-i686)
/mingw32/bin/pip3 install --upgrade --upgrade-strategy eager ${PACKAGES} || \
/mingw32/bin/pip3 install --upgrade ${PACKAGES}
;;
mingw-w64-x86_64)
C:/MinGW/opt/python3/Scripts/pip3 install --upgrade --upgrade-strategy eager ${PACKAGES} || \
C:/MinGW/opt/python3/Scripts/pip3 install --upgrade ${PACKAGES}
;;
esac
done
The script downloads and installs Inkscape's dependencies.

centos 7 make FFmpeg /libavutil/common.h:33:19: fatal error: errno.h: No such file or directory

ndk build ffmpeg 3.4.2 configure success ,but when I make it .fatal error like this
configure script is
I make it in CentOS Linux release 7.4.1708 (Core)
similar, I make fdkaac fatal error too like this
I don't know I what is the problem of system
I think you should change android ndk version
I use the ndk r16b I get the problem also
so I use the ndk r15c
I success
I holp this can help you
this is my .sh file
#!/bin/bash
rm -rf android/arm
echo "stone"
NDK=/xxxxxxx/android-ndk-r15c
NDK_VERSION=android-14
ARCH=arm
SYSROOT=$NDK/platforms/$NDK_VERSION/arch-$ARCH
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-symver \
--cross-prefix=$CROSS_COMPILE \
--target-os=android \
--arch=$ARCH \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j8
make install
}
build_one
~~~~~~~~~~~~

Crosscompile OpenCV with FFMPEG support

I am trying to cross compile opencv with ffmpeg support for an arm board with a buildroot based custom linux. The host is an ubuntu PC.
I want static opencv libraries.
I have downloaded ffmpeg source and crosscompiled it with the following configuration
./configure \
--enable-cross-compile \
--cross-prefix=arm-linux-gnueabihf- \
--target-os=linux \
--arch=arm \
--disable-static \
--enable-shared \
--enable-nonfree \
--enable-ffmpeg \
--enable-gpl \
--enable-swscale \
--enable-pthreads \
--disable-yasm \
--disable-stripping \
--prefix=../build \
--extra-cflags=-I../build/include --extra-ldflags=-L../build/lib
The paths are all correct and ffmpeg is built successfully. Then when I try to configure opencv with cmake-gui, I have to manually specify all paths.
But despite this, opencv configuration is unable to resolve FFMPEG correctly
I have attached the screen shot below
It cannot resolve ffmpeg versions. I tried to ignore it and build but it fails with linker error
Linking CXX static library ../../lib/libopencv_features2d.a
[ 49%] Built target opencv_features2d
make: *** [all] Error 2

Compiling PDCurses on Windows with MinGW

I'm getting the weirdest error when I do ./configure when building nmcurses-5.9
The issue is when I try to run
CC="gcc -m32" LD="ld -m32" ./configure \
--prefix=/mingw \
--without-cxx-binding \
--without-ada \
--enable-warnings \
--enable-assertions \
--enable-reentrant \
--with-debug \
--with-normal \
--disable-home-terminfo \
--enable-sp-funcs \
--enable-term-driver \
--enable-interop \
--with-pthread
and the error I get is
./configure: line 21016: D:\Program: No such file or directory
on that line is
${MAKE:-make} preinstall
I am building this in MinGW using msys.
any help would be apreciated.
In ${MAKE:-make} preinstall, the expression ${MAKE:-make} expands to the
value of the shell variable MAKE, if it is set, and otherwise to make.
So MAKE is set and expands to something probably of the form D:\Program Files\...,
i.e. a path with embedded spaces, which is construed as distinct tokens
D:\Program and Files\... by the shell when attempting to execute the
intended command:
\path\to\make preinstall
Instead it attempts to execute a program D:\Program with arguments Files\... preinstall
and complains that no such program exists.
With GNU autotools is advisable to install tools in paths that are free of
embedded spaces.

Failed to link osmesa correctly

Mesa version = 12.0.1
Tried version before this as well.
At link time this error comes up: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libGL.so: undefined reference to _glapi_tls_Dispatch'.
The script i am using to install mesa:
#!/bin/bash
make -j4 distclean # if in an existing build
autoreconf -fi
./configure \
CXXFLAGS="-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
CFLAGS="-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
--disable-xvmc \
--disable-glx \
--disable-dri \
--with-dri-drivers="" \
--with-gallium-drivers="swrast" \
--enable-texture-float \
--enable-shared-glapi \
--disable-egl \
--with-egl-platforms="" \
--enable-gallium-osmesa \
--enable-llvm-shared-libs=yes \
--enable-gallium-llvm=yes \
--prefix=/home/ec2-user/new-mesa/mesaBuild/
make -j2
make -j4 install
After installation :
Added prefix(defined in script) to /etc/ld.so.conf' and ran ldconfig
Then in link command: -Lprefix -lOSMesa
What am i doing wrong?