Compilation of OpenCV / Eigen3 fail - c++

I want to use OpenCV but I cannot compile it and I think It's because of Eigen.
when I use Cmake command, Eigen is found:
> -- Use Eigen: YES (ver 3.2.2)
Whereas I have only Eigen2 on my computer. (Maybe It's an obsolete file but I don't know where it comes from).
Then, once Cmake is done I do
make -j4
At 64% I have this following error:
/home/sl001093/opencv-2.4.10/modules/contrib/src/rgbdodometry.cpp:65:47: fatal error: unsupported/Eigen/MatrixFunctions : no file like that
compilation aborted.
make[2]: * [modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.o] Error 1
make1: * [modules/contrib/CMakeFiles/opencv_contrib.dir/all] Error 2
make: *** [all] Erreur 2
Thank you very much in advance !
EDIT: here the output of the command line ccmake

Use cmake-gui
Set OpenCV source and build directory
Configure
In the Search box, type "eigen"
Activate "WITH_EIGEN" flag
Configure again
A variable "EIGEN_INCLUDE_PATH" should appear: click there and browse to the "include" subdirectory of your Eigen library.
Eigen is a header only library, so you don't need to install/build it: just download a package (see "Get it" section on the right side of the page) and unzip it for the purpose of building OpenCV.
BTW, why are you using OpenCV 2.4 when there is already OpenCV 3 available? It might be that OpenCV 2.4 is not compatible with recent versions of Eigen, but I know as a fact that it is compatible with version 3.2.2.

Related

mxnet build with intel mkl always throw error "Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll."

os : windows 10 64bits
compiler : vc2015 64bits update 3
mxnet : 1.3.1
Building mxnet 1.3.1(mxnet1.4.0 has bugs, can't build it under windows,please check14203 for more details).
I can build the mxnet with cpp-package, but when I call the forward function o the Executor, it keep throwing
Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
Following are my steps to build the mxnet
git clone --recursive https://github.com/apache/incubator-mxnet mxnet
cd mxnet
Download intel mkl(w_mkl_2019.2.190.exe)
install it
open cmake3.11.0
I disable cpp_package,opencv,cuda,USE_MKLML_MKL(else mshadow will use openBLAS).
I disable USE_TENSORRT and USE_VTUNE too
press configure,disable BUILD_TESTING
press configure again, all green
press generate,all green
open ALL_BUILD.vcxproj
Select Release build
All build
All green, except install project fail
>file cannot create directory: C:/Program Files/mxnet/lib. Maybe need
1> administrative privileges.
Already open vc as admin, still the same error
Add Anaconda3 into PATH
Add libmxnet.dll and C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl\mkl_rt.dll into a folder which could be found by the os
select build with cpp_package from cmake gui
configure->generate
reopen ALL_BUILD.vcxproj
Select ALL_BUILD->build
Because install do not work,I copy the files lib to build_cpu/install
Because lrs and wds of op.h do not declare type,I need to add mx_float for them
write a simple program, can compile
When I call forward of the Executor,the program throw Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
Add C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl的mkl_intel_thread.dll into the folder could be found by the os
26.Run again,still the same error Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
My Anaconda3 install mxnet,it got mkl_intel_thread.dll and mkl_rt.dll too,I wonder there are confliction,problem is I did not add the bin path of Anaconda3 into the PATH.
I tried to copy different mkl_intel_thread.dll and mkl_rt.dll into the folder where the exe at, but every combination of them give me same error.
Those dll come from following path
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl
C:\Users\yyyy\Anaconda3\envs\gluon\Library\bin
C:\Users\yyyy\Anaconda3\Library\bin
C:\Users\yyyy\Anaconda3\pkgs\mkl-2019.1-144\Library\bin
Do anyone know how to solve this issue?Thanks
This problem should be caused by static MKL linkage, here's some advice may helpful to you.
Have you ever tried to set environmental variable for pre-load libs,
Here is Linux
export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_def.so:/opt/intel/mkl/lib/intel64/libmkl_avx2.so:/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so:/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so:/opt/intel/lib/intel64_lin/libiomp5.so
In windows, setting env by mkl/bin/mklvars.bat intel64, then run your python in same environment
or in python to add the library manually sys.path.append(" your path to the library") or Pyinstaller numpy "Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll"...
If above suggestions did not help, please try to modify the 'CMakeList.txt' file, change line 44 ~ 47 to single-dynamic linkage and re-cmake to install:
if(MSVC)
set(LIBS ${LIBS} mkl_rt ${MKL_COMPILER_LIB_FILE} PARENT_SCOPE)
else()
set(LIBS ${LIBS} mkl_rt ${MKL_COMPILER_LIB_FILE} PARENT_SCOPE)

Rstudio, configure: error: GDALAllRegister not found in libgdal

I am a newbie and tried various methods already. I ran into problems from this one problem. please help. I think there are two problems here. 1) my c++ is not uptodate. 2) my GDALAllRegister not found in libgdal.
I am using mac 2017.
> install.packages("sf")
Installing package into ‘/Users/haoluo/Library/R/3.4/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
sf 0.6-1 0.6-3 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘sf’
...
In file included from /usr/local/Cellar/gdal/HEAD-41888/include/gdal.h:42:
/usr/local/Cellar/gdal/HEAD-41888/include/cpl_port.h:187:6: error: Must have C++11 or newer.
# error Must have C++11 or newer.
^
1 error generated.
In file included from gdal_test.cpp:1:
In file included from /usr/local/Cellar/gdal/HEAD-41888/include/gdal.h:42:
/usr/local/Cellar/gdal/HEAD-41888/include/cpl_port.h:187:6: error: Must have C++11 or newer.
# error Must have C++11 or newer.
^
1 error generated.
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘sf’
* removing ‘/Users/haoluo/Library/R/3.4/library/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
I failed to read the prompt in the first place. Now the problem has been solved by simply answering n to the question Do you want to install from sources the package which needs compilation?
I want to thank #nicola again for the help!
enter image description here

Linking VLC build to ffmpeg build libraries

I'm receiving the following error message when attempting to build VLC:
checking for mad_bit_init in -lmad... yes
checking for MPG123... yes
checking for libavutil variant... libav
checking for GST_APP... yes
checking for GST_VIDEO... yes
checking for AVCODEC... no
configure: error: Requested 'libavcodec >= 57.16.0' but version of libavcodec is 56.1.0. Pass --disable-avcodec to ignore this error.
I am running the command (first step of Configuration from link below, I did the contrib method and built everything else as well):
./configure
So let's get the obvious out of the way: I'm missing the most recent version of libavcodec (v57). Using --disable-avcodec is not a viable solution. Doing a quick apt-file search libavcodec I'm seeing that for debian/jessie the latest version published is libavcodec56, not 57. I did also notice that libavcodec57 was available for installation with ffmpeg here https://ffmpeg.org/download.html
I actually needed to also build ffmpeg from source. So I did that, worked my way through the dependencies without too much trouble using the guide linked to below.
So here is my issue: After building and doing a make install of ffmpeg, I still get that error above, despite having the latest libavcodec freshly compiled.
So my question is: since I used that guide, I am still getting the error when building vlc. I see that the lib exists her: /root/ffmpeg_build/lib/libavcodec.a, and I figured make install would put it where it needs to be. Is there some other compile flag I can set while compiling vlc to point it to that lib directory to look for libavcodec?
ffmpeg build: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
vlc build: https://wiki.videolan.org/UnixCompile/
UPDATE: tried this, still getting the error message: PKG_CONFIG_PATH="/root/ffmpeg_build/lib:$PKG_CONFIG_PATH" LD_LIBRARY_PATH="/root/ffmpeg_build/lib:$LD_LIBRARY_PATH" ./configure
UPDATE2: tried this, still getting the error message: ./configure --libdir="/root/ffmpeg_build/lib:$LIBDIR"
UPDATE3: I tried merging my ffmpeg libs into my vlc libs and may have made things worse. My ffmpeg libs lived here: /root/ffmpeg_build/lib
My vlc build (contrib builds as well) lived here: /opt/vlc/
So I merged them with my existing vlc contrib lib:
cp /root/ffmpeg_build/lib/* /opt/vlc/contrib/x86_64-linux-gnu/lib/
cp /root/ffmpeg_build/lib/pkgconfig/* /opt/vlc/contrib/x86_64-linux-gnu/lib/pkgconfig/
Then ran configure:
./configure --with-contrib=contrib/x86_64-linux-gnu
Which finally worked, but now I get this error when I try to make:
Now I get the error:
/usr/bin/ld: /opt/vlc/contrib/x86_64-linux-gnu/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC

dyn.load error linking a package with Rcpp

I've made an R package with Rcpp, to use the methods of a library I programmed in c++.
I've R running on the last version:
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS
I'm executing the following instruction to install my package:
> install.packages("mypackage", repos = NULL)
The package compiles well, I have the .o files of my source code, but in the linking phase I got the error:
* installing *source* package ‘rbdd’ ...
** libs
make: No se hace nada para 'all'.
installing to /home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs
** R
** preparing package for lazy loading
** help
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:27: All text must be in a section
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:28: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so':
/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so: undefined symbol: _ZN4cudd12defaultErrorENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
Error: loading failed
Ejecución interrumpida
ERROR: loading failed
mypackge.so is created in the src folder of my package.
I've got a Makevars file (in src, too) with the following content:
PKG_CPPFLAGS=-I./buddy-2.5/src -I./cudd-3.0.0/cudd -I./cudd-3.0.0/mtr -I./cudd-3.0.0/cplusplus -I./cudd-3.0.0/dddmp -I./cudd-3.0.0/util -I./cudd-3.0.0 -isystem /usr/include/c++/v1 -std=c++11
PKG_LIBS=-lc++ -L/lib
and my NAMESPACE file has the lines:
useDynLib(mypackage)
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp, evalCpp)
Someone knows how to solve this problem?
I am a little concerned about
PKG_LIBS=-lc++ -L/lib
Did you really mean /lib? If it is your library, a more common place would be /usr/local/lib which is also search by default.
But, and that is a BIG but, you also need to understand what you need to do for ldconfig for the proper setup of libfoo.so, libfoo.so.$MAJOR and so on. I taught myself that many moons ago from a Linux HOWTO.
If and when that is setup right, you can link it to R via Rcpp. Otherwise maybe stick with system libraries, or package-local static libraries. That approach will also make your package more portable.
The problem was I am consumming external libs, and I must compile it and execute ldconfig before compile my R library.

ocaml batteries unbound toploop error

I am trying to install bap required for ropc https://github.com/pakt/ropc as per the instructions given in ropc/bap/INSTALL in Ubuntu 14.04 . I have run these commands successfully .
sudo apt-get install ocaml ocaml-native-compilers ocaml-findlib camlidl \
libocamlgraph-ocaml-dev libextlib-ocaml-dev binutils-dev automake \
libcamomile-ocaml-dev otags libpcre3-dev camlp4-extra bison flex
Now , when I make it inside the bap directory , I get the following Unbound module toploop error, which seems to be a compatibility issue between batteries and ocaml. How do I get around this ? Please see the image for further details
Image uploaded
I read that I should add -I +compiler-libs somewhere. But where exactly? I have no experience working with ocaml and I am just trying to build ropc successfully.
I tried to compile the pact/ropc project, and I can only confirm problems.
Although the ocaml configuration succeeds, the compile shows an undefined error:
Error: Some fatal warnings were triggered (2 occurrences)
../Makefile.shared:84: recipe for target 'nat.cmo' failed
make[2]: *** [nat.cmo] Error 2
make[2]: Leaving directory '/home/strobel/tmp/ropc/bap-0.4/bigint-3.12/otherlibs/num'
Makefile:5: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/strobel/tmp/ropc/bap-0.4/bigint-3.12'
Makefile:356: recipe for target 'all-recursive' failed
The bap component used in ROPC is available in opam but ROPC is not, and it shows signs of bitrot. There are 3 issues opened for the github project telling about compile problems.
I have a quite well provisioned ocaml setup, with packages directly from opam (very up to date versions), and my approach was to see if it would compile here.
What to do?
Maybe uninstall your debian ocaml packages, start anew with opam. There is the possibility to install old ocaml versions, too, so maybe walk back in time to a 3.12 ocaml version. But getting the required packages in corresponding versions might not be so easy, opam is quite new. It will be an advanced ocaml debugging job IMO.