Ask Your Question
0

Multiple opencv 3 & IPP build issues

asked 2016-05-16 07:00:03 -0600

DanM gravatar image

This post started out as a question, but morphed into a notification of multiple problems I had building opencv 3 with IPP "out of the box", and to provide a workaround, which works for me at least.

Here's a summary of my issues:

  1. Opencv3 does not build out of the box with the supplied IPP libraries. This is an apparent link failure, and happens with several objects.
  2. Opencv3 does not recognize the IPPROOT environment variable, which I believe is a standard environment variable used when IPP is already installed on a system
  3. I could find no documentation on how to direct OpenCV to look for the existing IPP on the system, and had to search thru included cmake files to find the right flag.
  4. OpenCV3 does not work with IPP 9, due to Intel removing the libippm.a library, and OpenCV still looking for it.
  5. sudo make install doesnt work, as the linker cannot find several of the IPP libraries (libirc, libimf, libsvml)

Solution (at least for me):

  1. edit cmake/OpenCVFindIPP.cmake, and comment out the line _ipp_add_library(m)
  2. build with D IPPROOT='pathToMyIPP'
  3. instead of sudo make install, need to ensure that the root user has sourced the appropriate Intel compilervars script (for me its /opt/intel/bin/compilervars.sh intel64), then do
    su make install

Details:

I've been using opencv 2.4.x for awhile now but need to upgrade to 3 to get functionality that doesnt exist in 2.4.x. I downloaded 3.1.0 from the website and tried to build i (only flag I used was -D CMAKE_BUILD_TYPE=RELEASE) . It fails when trying to link with the IPP that comes bundled in the 3rdparty directory of opencv 3. I have a CentOS version of linux, but I'm fairly certain that CentOS does not play in any of these problems.

Problems using OpenCV-provided IPP:

On compile (make stage), there's a ton of errors that look like:
../../lib/libopencv_imgproc.so.3.1.0: undefined reference to ippiCopySubpixIntersect_8u_C1R' ../../lib/libopencv_imgproc.so.3.1.0: undefined reference toippiCopy_32f_AC4C3R' ../../lib/libopencv_imgproc.so.3.1.0: undefined reference to ippiDistanceTransform_5x5_8u32f_C1R' ../../lib/libopencv_imgproc.so.3.1.0: undefined reference toippiFilterBorder_32f_C1R' ../../lib/libopencv_imgproc.so.3.1.0: undefined reference to ippiFilterBorderInit_32f' ../../lib/libopencv_imgproc.so.3.1.0: undefined reference toippiResizeCubic_32f_C3R' ../../lib/libopencv_core.so.3.1.0: undefined reference to `ippiNorm_L2_16u_C1MR'

I see that theres a libippicv.a file included under 3rdparty, and I checked a few of the symbols for existence using nm libippicv.a, and all the symbols I checked exist. I also did a search on the entire opencv3 tree for inclusion of this library in the link line of make files, and it seems to exist. So I'm really confused. Since I have IPP as part of the intel compiler suite I gave up and used the IPP that came from Intel.

Directing CMake to use system IPP

It turns out I have the intel compiler on my system so I ... (more)

edit retag flag offensive close merge delete

Comments

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-05-17 08:35:42 -0600

Let me provide some feedback to your very long talk. As a moderator of the Q&A and frequent contributor to OpenCV repository I guess I can give you some pointers.

Opencv3 does not build out of the box with the supplied IPP libraries

  • Let me start by saying that you should at least provide us with decent information, like your configuration, OpenCV options installed, IPP version, ... this is the bare minimal needed for developers to help debug your problem.
  • Besides that, just tested and confirmed that OpenCV 3 just builds perfectly fine on Ubuntu 14.04 with the packed limited IPP functionality.
  • With latest OpenCV 3 master branch, I mean getting the github repository, and not some other prepacked version on the net.
  • So I just proved that this statement is false without any more explanation.

Solution ...

  • IF you found a solution to your problem, then please provide fixes through pull requests with fixes.
  • This is a community based software library, heavily depending on its user base to fix possible wrongs in the codebase.

I downloaded 3.1.0 from the website

  • First giant mistake here. Go to github and download the latest branch. TONS of fixes have been merged since the release of that package :) Only way to be sure you have the latest version is to grab it yourself through a clone.

only flag I used was -D CMAKE_BUILD_TYPE=RELEASE

  • In my opinion second mistake, use at least CMAKE-GUI first to identify possible libraries not correctly found.
  • It is way more intuitive for giving directions to the current problems.

It fails when trying to link with the IPP that comes bundled in the 3rdparty directory of opencv 3.

  • As said, it works just fine here with a clean copy of the latest repo.

those strange looking errors using OpenCV provided IPP

  • You are mixing debug and release binaries here, because that is the only time I see such errors with numbers next to functionality popping up
  • Also be aware that the shipped IPP is a limited set of functionality, offered by Intel to OpenCV users for free. If you use any other IPP function yourself, it will NOT work, unless you have a payed version of IPP on your system.

In my opinion the stuff above should be fixed first before we can continue on the other errors. It is like making sure the above works first

I was willing to spend over a week of very frustrating effort trying to make it work

  • That was just a wrong decision here. The community is active, pass along faster if you have problems and we will surely help you out faster!

I realize that as a user I have no right to ask the OpenCV developers to do any additional work

  • Actually you do, just like said by @LBerger, there are interfaces enough to push your questions to the developers and to ask for help where possible.
edit flag offensive delete link more
0

answered 2016-05-21 12:51:59 -0600

DanM gravatar image

Steven,

Thanks for the feedback. The length of my post was to provide all the details I thought might be pertinent to my issue, and also to show that I made some attempt to solve the problem myself. Because of its length I tried to separate it into summary/details sections.

As far as config goes, I dont know the totality of what you might want. I'm using:

  • gcc/g++ 4.8.5 20150623
  • CentOS 7 (though as I mentioned in my, admittedly long, post I dont think this plays)
  • cmake 2.8.11
  • uname -a returns:
    3.10.0-327.3.1.el7.x86_64 #1 SMP Wed Dec 9 14:09:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  • Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz, 64GB RAM

Do you need my version_string.temp, or anything else?

I tried both the version of OpenCV off the website and from git. If the website version isn't valid/recommended, then it should be removed.

Here's my commands (after unziping opencv from git repository):

  • mkdir testbuild
  • mkdir testinstall
  • cd testbuild
  • cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/dan/testoc3/opencv-3.1.0/testinstall ..
  • make -j8 (though just make fails too)

Result: [ 45%] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast_score.cpp.o ../../lib/libopencv_core.a(matrix.cpp.o): In function reduceMinC32f(cv::Mat const&, cv::Mat&)': matrix.cpp:(.text._ZL13reduceMinC32fRKN2cv3MatERS0_+0x33d): undefined reference toippiMin_32f_C1R' ../../lib/libopencv_core.a(matrix.cpp.o): In function reduceMinC16s(cv::Mat const&, cv::Mat&)': matrix.cpp:(.text._ZL13reduceMinC16sRKN2cv3MatERS0_+0x45b): undefined reference toippiMin_16s_C1R' ../../lib/libopencv_core.a(matrix.cpp.o): In function reduceMinC16u(cv::Mat const&, cv::Mat&)': matrix.cpp:(.text._ZL13reduceMinC16uRKN2cv3MatERS0_+0x45b): undefined reference toippiMin_16u_C1R' ../../lib/libopencv_core.a(matrix.cpp.o): In function reduceMinC8u(cv::Mat const&, cv::Mat&)': matrix.cpp:(.text._ZL12reduceMinC8uRKN2cv3MatERS0_+0x65b): undefined reference toippiMin_8u_C1R' ../../lib/libopencv_core.a(matrix.cpp.o): In function reduceMaxC32f(cv::Mat const&, cv::Mat&)': matrix.cpp:(.text._ZL13reduceMaxC32fRKN2cv3MatERS0_+0x33d): undefined reference toippiMax_32f_C1R'

and tons more errors like them.

A google search on this issue gets very few hits, but the ones I could find appear to me to be either unsanswered or suggesting turning IPP off

Neither seemed right to me.

I had purchased the intel compiler, and have IPP from that. The rest of the post was what I had to do to get opencv3 to build with a pre-installed version of IPP.

If you need further information from me, please let me know.

edit flag offensive delete link more

Comments

in CMakeCache.txt there are two lines :

IPPICV_INSTALL_PATH:INTERNAL=/usr/local/share/opencv/share/OpenCV/3rdparty/lib/libippicv.a
IPPICV_LOCATION_PATH:INTERNAL=/usr/share/opencv/3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a

you can check if path is good

LBerger gravatar imageLBerger ( 2016-05-21 15:04:35 -0600 )edit

Mine is:

IPPICV_INSTALL_PATH:INTERNAL=/home/dan/testoc3/opencv-3.1.0/testinstall/share/OpenCV/3rdparty/lib/libippicv.a
IPPICV_LOCATION_PATH:INTERNAL=/home/dan/testoc3/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a

which is where the ippicv stuff was put when it unzip'd.

Could this problem have something to do with the fact that I had IPP installed already, and those libraries are in my LIBRARY_PATH. Perhaps the system libraries are being found before the OpenCV supplied libraries during link?

DanM gravatar imageDanM ( 2016-05-21 17:32:38 -0600 )edit

Strike that last. The name of the library being searched is libippicv.a, and that name only exists under opencv's 3rdparty directory tree, so link-line library ordering isnt the problem.

DanM gravatar imageDanM ( 2016-05-22 07:13:06 -0600 )edit

I don't understand your comment about "I could find appear to me to be either unsanswered or suggesting turning IPP off". If you disable IPP it's not same error (don't forget to delete CMakeCache.txt before running cmake)

LBerger gravatar imageLBerger ( 2016-05-22 08:39:02 -0600 )edit

Any new developments here? I'm having very similar issues. I got past the issue with the built-in IPP by moving to a fresh VM with no previous IPP installation. However, I'm also interested in using my own IPP since it may (or may not - can't find any information) improve performance even further. I'm running into linker errors which look like the same as Dan's but since the whole process is a part of a debian packaging script I'm not sure if I can use his solution.

tomasth gravatar imagetomasth ( 2016-10-05 09:21:36 -0600 )edit

Dynamic linking may be the solution for me http://answers.opencv.org/question/51...

tomasth gravatar imagetomasth ( 2016-10-05 09:38:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-16 07:00:03 -0600

Seen: 2,823 times

Last updated: May 21 '16