Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

IPP v7 and OpenCV2.1/2.2 (Linux, Ubuntu)

oprenzel
Beginner
940 Views

I tried out to build OpenCV (2.1 and 2.2) with IPP support under Linux (Ubuntu 10.10). With IPP below version 7.0 this was successful, but not with the most recent versions of IPPs (7.0.1).

During configuration of OpenCV with Cmake, only the following path was accepted as IPP_PATH:

/opt/intel/composerxe-2011/ipp/bin

However, while building OpenCV, the following error appears:

Linking CXX shared library ../../lib/libcxcore.so

/usr/bin/ld: cannot find -lippsmerged

/usr/bin/ld: cannot find -lippsemerged

/usr/bin/ld: cannot find -lippimerged

/usr/bin/ld: cannot find -lippiemerged

/usr/bin/ld: cannot find -lippvmmerged

/usr/bin/ld: cannot find -lippvmemerged

/usr/bin/ld: cannot find -lippccmerged

/usr/bin/ld: cannot find -lippccemerged

/usr/bin/ld: cannot find -lippcvmerged

/usr/bin/ld: cannot find lippcvemerged

--> The libs listed here are obviously not included anymore in IPP v7

How can this problem be solved?

Regards, Oliver

0 Kudos
12 Replies
Vladimir_Dudnik
Employee
940 Views

Hi Oliver,

With IPP 7.0 we did some changes in product folder structure and library names in order to simplify IPP use. We have informed IPP users on this change during IPP 7.0 Beta program, you may find more details on that at Selecting the Intel Integrated Performance Primitives (Intel IPP) libraries needed by your applicationKB article.

These changesnot yet incorporated in OpenCV build system, we will work with OpenCV developers to make that happen soon.

Meantime, you may try to do thechanges inIPP section of OpenCV CMakeLists.txt file, located in root OpenCV folder.

This change work for me on Windows7 64-bit and IPP 7.0.1 from Parallel Studio 2011 XE for OpenCV 2.1 snapshot from SVN which I took a few weeks before OpenCV 2.2 published. It should be relatively easy to incorporate support for Linux as well after your read IPP KB article and realize what particularly change madein IPP 7.0library names.

############################### IPP ################################
set(IPP_FOUND)
set(OPENCV_LOADER_PATH)

if(UNIX)
if(APPLE)
set(OPENCV_LOADER_PATH DYLD_LIBRARY_PATH)
else()
set(OPENCV_LOADER_PATH LD_LIBRARY_PATH)
endif()
endif()

foreach(v "7.0" "6.1" "6.0" "5.3" "5.2" "5.1")
if(NOT IPP_FOUND)
if(WIN32)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(UNIX)
find_path(IPP_PATH "libippi${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "libippiem64t${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(IPP_PATH)
file(GLOB IPP_HDRS "${IPP_PATH}/../../../ipp/include")
if(IPP_HDRS)
set(IPP_FOUND TRUE)
endif()
endif()
endif()
endforeach()

message(STATUS "IPP detected: ${IPP_FOUND}")

if(WIN32 AND NOT MSVC)
set(IPP_FOUND)
endif()

set(USE_IPP ${IPP_FOUND} CACHE BOOL "Use IPP when available")

message(STATUS "IPP_FOUND: ${IPP_FOUND}")
message(STATUS "USE_IPP: ${USE_IPP}")
message(STATUS "USE_PATH: ${IPP_PATH}")

if(IPP_FOUND AND USE_IPP)
add_definitions(-DHAVE_IPP)
include_directories("${IPP_PATH}/../../../ipp/include")
if(WIN32)
link_directories("${IPP_PATH}/../../../ipp/lib/ia32")
else()
link_directories("${IPP_PATH}/../../../ipp/lib/intel64")
endif()

set(A ${CMAKE_STATIC_LIBRARY_PREFIX})
set(B ${IPP_ARCH}${CMAKE_STATIC_LIBRARY_SUFFIX})
if(WIN32)
set(L l)
else()
set(L)
endif()
set(IPP_LIBS ${A}ipps_l${B}
${A}ippi_l${B}
${A}ippvm_l${B}
${A}ippcc_l${B}
${A}ippcv_l${B}
${A}ippcore_l${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()


Regards,
Vladimir

0 Kudos
oprenzel
Beginner
940 Views
Dear Vladimir,

this also worked fine unter Ubuntu 10.10! Thank you very much for this information!

Best regards,
Oliver
0 Kudos
Ying_H_Intel
Employee
940 Views

We had published one technical notes about IPP v6 and OpenCV 2.1:Using Intel IPP with OpenCV

For those who may ask how to modify the CMakeLists.txt to make sure the IPP v7 works with OpenCV under linux 64bit,

Please refer to the build steps in Using Intel IPP with OpenCV
http://software.intel.com/en-us/articles/using-intel-ipp-with-opencv/
=>2.1 Integrate Intel?IPP library into OpenCV library
enter the command
>cmake -D USE_IPP=on -D IPP_PATH=/opt/intel/ipp/lib/intel64 ../

and did almost same change as Vladimir as below, this changes work for me on Ubuntu 10.04 64bit and IPP 7.0.1 64bit library(l_ipp_7.0.1.107_intel64).

############################### IPP ################################
set(IPP_FOUND)
set(OPENCV_LOADER_PATH)

if(UNIX)
if(APPLE)
set(OPENCV_LOADER_PATH DYLD_LIBRARY_PATH)
else()
set(OPENCV_LOADER_PATH LD_LIBRARY_PATH)
endif()
endif()

foreach(v "7.0" "6.1" "6.0" "5.3" "5.2" "5.1")
if(NOT IPP_FOUND)
if(WIN32)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(UNIX)
find_path(IPP_PATH "libippi${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "libippi
${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic li
ries")
endif()
endif()
if(IPP_PATH)
file(GLOB IPP_HDRS "${IPP_PATH}/../../include")
if(IPP_HDRS)
set(IPP_FOUND TRUE)
endif()
endif()
endif()
endforeach()

message(STATUS "IPP detected: ${IPP_FOUND}")

if(WIN32 AND NOT MSVC)
set(IPP_FOUND)
endif()

set(USE_IPP ${IPP_FOUND} CACHE BOOL "Use IPP when available")

if(IPP_FOUND AND USE_IPP)
add_definitions(-DHAVE_IPP)
include_directories("${IPP_PATH}/../../include")
link_directories("${IPP_PATH}/../../lib/intel64")
# please change to ${IPP_PATH}/../../lib/ia32 if 32bit
# platform
# file(GLOB em64t_files "${IPP_PATH}/../lib/*em64t*")
# set(IPP_ARCH)
# if(em64t_files)
# set(IPP_ARCH "em64t")
# endif()

set(A ${CMAKE_STATIC_LIBRARY_PREFIX})
set(B ${IPP_ARCH}${CMAKE_STATIC_LIBRARY_SUFFIX})
if(WIN32)
set(L l)
else()
set(L)
endif()
set(IPP_LIBS
${A}ippvm_l${B}
${A}ippcc_l${B}
${A}ippcv_l${B}
${A}ippi_l${B}
${A}ipps_l${B}
${A}ippcore_l${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()


Regards
Ying H.

0 Kudos
sascha_w
Beginner
940 Views
Hi,
i tried both solutions and the 2nd worked for me on Win7 x64 with VS2010.
But there is a problem with defining the "HAVE_IPP" value.. it's never defined during cmake process.. but the path is found correctly:

the output of cmake says:
IPP detected: TRUE
IPP_FOUND: TRUE
USE_IPP: ON
USE_PATH: ..../redist/ia32/ipp
IPP_Libs:
ipps_l.lib;ippi_l.lib;ippvm_l.lib;ippcc_l.lib;ippcv_l.lib;ippcore_l.lib

Is it correct that the HAVE_IPP must be defined in the cvconfig.h? or anywhere else???
Can i define it myself?

I'am also using TBB and this is working fine..
And i also tried out the svn snapshot, there is a better makefile for detecting IPP. I can compile the solution but the HAVE_IPP is not defined too. And there are other problems with loading cascade for face detection. The CascadeClassifier.load() fails every time.

I really hope you have a solution for me.

Regards
Sascha

0 Kudos
Vladimir_Dudnik
Employee
940 Views
Hello,

HAVE_IPP macro should be defined in MSVC project files once IPP found at CMake configure stage. Please check you have lines like below in your CMakeLists.txt

if(IPP_FOUND)
add_definitions(-DHAVE_IPP)
include_directories(${IPP_INCLUDE_DIRS})
link_directories(${IPP_LIBRARY_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_LIBRARIES})
endif()

Regards,
Vladimir
0 Kudos
sascha_w
Beginner
940 Views
Hi,

thank you for the fast reply.

Yes i found the code in CMakeLists.txt.
but still no define in cvconfig.h:

/* Intel Integrated Performance Primitives */
/* #undef HAVE_IPP */

I have defined it myself and build the solution successfully but the problem with cascade loading still occurs..

How can i check in my program if IPP is linked?

useOptimized() returns a '1' but

#ifdef HAVE_IPP
cout<<"IPP is present"<#endif

doesn't work.

and

const char* plugin_info = 0;
cvGetModuleInfo(0,0,&plugin_info);
ipp_is_used = plugin_info != 0 && strstr(plugin_info,ipp)!=0;

is just for dynamic linking isn't it?

Regards
Sascha
0 Kudos
Vladimir_Dudnik
Employee
940 Views
I think HAVE_IPP should be defined in MSVC project files, you can check any OpenCV module settings, it should be listed in Preprocessor settings.

Unfortunately after OpenCV moved to static link with IPP there is no way to detect at runtime if IPP was linked or not. I think cvGetModuleInfo should be redesigned in future or some other API should be provided in order to detect linkage with IPP.

For now, I just check MSVC project files before build to ensure that right path to IPP is there and HAVE_IPP macro is defined.

Regards,
Vladimir
0 Kudos
sascha_w
Beginner
940 Views
I think i've successfully linked the library by adding HAVE_IPP manually.
I used the official OpenCV2.2 release from december 2010 but
now i'am getting linker errors when compiling my Application:

1>OpenCVFaceDetection.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::CascadeClassifier::~CascadeClassifier(void)" (??1CascadeClassifier@cv@@UAE@XZ) referenced in function __unwindfunclet$??0OpenCVFaceDetection@@QAE@XZ$0
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::CascadeClassifier::empty(void)const " (?empty@CascadeClassifier@cv@@UBE_NXZ)
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::CascadeClassifier::read(class cv::FileNode const &)" (?read@CascadeClassifier@cv@@UAE_NABVFileNode@2@@Z)
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::CascadeClassifier::detectMultiScale(class cv::Mat const &,class std::vector,class std::allocator > > &,double,int,int,class cv::Size_,class cv::Size_)" (?detectMultiScale@CascadeClassifier@cv@@UAEXABVMat@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@NHHV?$Size_@H@2@2@Z)
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "public: virtual class cv::Size_ __thiscall cv::CascadeClassifier::getOriginalWindowSize(void)const " (?getOriginalWindowSize@CascadeClassifier@cv@@UBE?AV?$Size_@H@2@XZ)
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall cv::CascadeClassifier::detectSingleScale(class cv::Mat const &,int,class cv::Size_,int,int,double,class std::vector,class std::allocator > > &)" (?detectSingleScale@CascadeClassifier@cv@@MAE_NABVMat@2@HV?$Size_@H@2@HHNAAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@@Z)
1>OpenCVFaceDetection.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall cv::CascadeClassifier::runAt(class cv::Ptr &,class cv::Point_)" (?runAt@CascadeClassifier@cv@@MAEHAAV?$Ptr@VFeatureEvaluator@cv@@@2@V?$Point_@H@2@@Z)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

any suggestions to solve it?


ok.. solved it, i think cmake 2.8.4 creates a not well working vs2010 solution..
there was a bug in using cmake 2.8 instead of 2.6 wasn't it?

Regards
Sascha
0 Kudos
Vladimir_Dudnik
Employee
941 Views
Did not try CMake 2.8.4, I use version 2.8.3 on Win7 x64

Vladimir
0 Kudos
sascha_w
Beginner
941 Views
ok, thank you very much, It's working now by testing with a sample code:


// load IPP
cvUseOptimized(true);

double t0 = (double) cvGetTickCount();
cvSmooth(iplImg, med1,CV_MEDIAN,M);
t0 = (double) cvGetTickCount() - t0;

// unload IPP
cvUseOptimized(false);

double t1 = (double) cvGetTickCount();
cvSmooth(iplImg, med1,CV_MEDIAN,M);
t1 = (double) cvGetTickCount() - t1;

printf("t0=%.2f\nt1=%.2f\n", (double)t0/1000,(double)t1/1000);

output:
t0=1.xx
t1=10.xx

so i think it's working correctly.

But i've got a new question.
When i try to load resources, visual studio uses a wrong charset.. For Example i can't load cascadeClassifier xml files.. or show windows with correct title
I saw it because i created a window with:

imshow("window",img);

but the window title was a cryptic name like "H$( window" ...
i tried to save with other encoding like utf-8 with signature or utf-8 without signature but nothing seems to work..
What charset OpenCV expect?

Regards
Sascha
0 Kudos
Vladimir_Dudnik
Employee
941 Views
I would recommend you to check OpenCV MSVC project setting which were generated by CMake. It might the problem is there is mix with UNICODE and other settings for different OpenCV modules.

Vladimir
0 Kudos
Kiran_C_
Beginner
941 Views

vladimir-dudnik (Intel) wrote:

These changesnot yet incorporated in OpenCV build system, we will work with OpenCV developers to make that happen soon.

Regards,
Vladimir

 

Vladmir, I have been trying to get OpenCV 3.4.7 work with IPP 8.0 and enable TBB support as well. My cmake for OpenCV includes  "-DWITH_TBB=YES -DWITH_IPP=YES" (installation is on Redhat Linux). I get an error that says:

"- checking for module 'tbb'

--   package 'tbb' not found"

 

--   Other third-party libraries:
--     Use IPP:                     IPP not found
--     Use Eigen:                   NO
--     Use TBB:                     NO
--     Use OpenMP:                  NO
--     Use GCD                      NO
--     Use Concurrency              NO
--     Use C=:                      NO
--     Use Cuda:                    NO

 

Would you have any info on how to get this working? 

 

0 Kudos
Reply