Skip to content

Workaround for IPP linking problem#19681

Merged
alalek merged 7 commits intoopencv:3.4from
eplankin:link_problem
Mar 31, 2021
Merged

Workaround for IPP linking problem#19681
alalek merged 7 commits intoopencv:3.4from
eplankin:link_problem

Conversation

@eplankin
Copy link
Copy Markdown
Contributor

@eplankin eplankin commented Mar 5, 2021

Description

OpenCV tests are stuck at IPP initialization because each OpenCV module is linked to ippCore lib. Probably, it was caused by changes in IPP dispatchers.
Valid for IPP versions > 2019; can be reproduced at distanceTransform performance test, for example.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please fill description of this PR?
What kind of problem is observed? How we can reproduce that?

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 6, 2021

See last section of my comment #10229 (comment)
IPP binaries should be fixed instead (should use -fvisibilty=hidden for static .a files as we don't need to export all symbols from there).
Touched linker flags are just workarounds for that problem.


Also relates #16505

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 29, 2021

Moved fix to cmake/OpenCVFindIPP.cmake
Patch is rebased onto 3.4 branch.

@eplankin Please verify and remove "Draft" status if it works.

@eplankin eplankin marked this pull request as ready for review March 30, 2021 18:19
@alalek alalek merged commit 6f1eefe into opencv:3.4 Mar 31, 2021
@eplankin eplankin deleted the link_problem branch March 31, 2021 09:28
@alalek alalek mentioned this pull request Apr 1, 2021
@mshabunin
Copy link
Copy Markdown
Contributor

I think I still can reproduce this issue:

  1. OpenCV@3.4 (5340dc6)
  2. Ubuntu 18; icc from oneAPI 2021.2.0 (apt install intel-basekit)
  3. . /opt/intel/oneapi/setvars.sh ; cmake -GNinja -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icc ../opencv && build (note that IPP-ICV is being used)
  4. ./bin/opencv_perf_core --help - hangs

When run using gdb and breaking execution at some point:

#0  0x00007ffff4db7e00 in icv_ownGetMaskFeatures@plt ()
   from /build-icc/lib/libopencv_core.so.3.4
#1  0x00007ffff5196a6c in icv_ownSetCpuFeaturesAndIdx ()
   from /build-icc/lib/libopencv_core.so.3.4
#2  0x00007ffff6af56f1 in ippicvSetCpuFeatures ()
   from /build-icc/lib/libopencv_imgproc.so.3.4
#3  0x00007ffff6af5732 in ippicvInit () from /build-icc/lib/libopencv_imgproc.so.3.4
#4  0x00007ffff53570cc in icv_ippSafeInit () from /build-icc/lib/libopencv_core.so.3.4
#5  0x00007fffffffc878 in ?? ()
#6  0x000000001007efff in ?? ()
#7  0x00007fffffffc8a0 in ?? ()
#8  0x000000001007efff in ?? ()
#9  0x000000001007efff in ?? ()
#10 0x000000006c65746e in ?? ()
#11 0x00007ffff5198cf5 in in_ippicviGetLibVersion ()
   from /build-icc/lib/libopencv_core.so.3.4
#12 0x00007ffff5079e3f in cv::ipp::getIppFeatures() ()
   from /build-icc/lib/libopencv_core.so.3.4
#13 0x00007ffff64b7476 in __sti__$E () from /build-icc/lib/libopencv_imgproc.so.3.4
#14 0x00007ffff7de5733 in call_init (env=0x7fffffffca00, argv=0x7fffffffc9e8, argc=2, l=<optimized out>)
    at dl-init.c:72
#15 _dl_init (main_map=0x7ffff7ffe170, argc=2, argv=0x7fffffffc9e8, env=0x7fffffffca00) at dl-init.c:119
#16 0x00007ffff7dd60ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#17 0x0000000000000002 in ?? ()
#18 0x00007fffffffce47 in ?? ()
#19 0x00007fffffffce81 in ?? ()
#20 0x0000000000000000 in ?? ()

Note: Some other tests work (opencv_test_core), some not (opencv_test_calib3d), I haven't check all.

@alalek
Copy link
Copy Markdown
Member

alalek commented Apr 1, 2021

Perhaps we need to adjust CMAKE_CXX_COMPILER_ID MATCHES checks for Intel compiler too (on Linux only)
As workaround add cmake -DOPENCV_FORCE_IPP_EXCLUDE_LIBS_CORE=ON ...

@mshabunin
Copy link
Copy Markdown
Contributor

Looks like it doesn't help, my command was: cmake -GNinja -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icc -DOPENCV_FORCE_IPP _EXCLUDE_LIBS_CORE=ON ../opencv and tests still hang.

Perhaps this fix is only applicable to standalone IPP, not for IPP-ICV (whole block is guarded by if("${name}" STREQUAL "core")). I've been able to fix it by adding OR "${name}" STREQUAL "icv" to this expression.

@alalek
Copy link
Copy Markdown
Member

alalek commented Apr 1, 2021

IPPICV flow is controlled by -DOPENCV_FORCE_IPP_EXCLUDE_LIBS=ON (without "_CORE")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants