Bug#1001236: libopencv-dnn4.5 lacks stable ABI

Steve Langasek steve.langasek at canonical.com
Mon Dec 6 20:13:57 GMT 2021


Package:libopencv-dnn4.5
Version: 4.5.4+dfsg-1
Severity: serious
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu jammy

libopencv-dnn is provided as a shared library in Debian, but it evidently
does not have a stable ABI.

This shows up in the gyoto autopkgtests, which, miserably, don't exit
non-zero on these errors:

$ ./debian/tests/gyoto-mk-video 
WARNING: PatternDisk: not tested for repeat_phi_>1; check your results
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/lib/python3/dist-packages/gyoto/animate.py", line 823, in main
    mk_video(**args.__dict__)
  File "/usr/lib/python3/dist-packages/gyoto/animate.py", line 655, in mk_video
    video=backend(output, fps, width, height)
  File "/usr/lib/python3/dist-packages/gyoto/animate.py", line 125, in __init__
    import cv2
ImportError: /usr/lib/python3/dist-packages/cv2.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZTIN2cv3dnn14dnn4_v202106085LayerE
$

This symbol was present in opencv 4.5.3 but is not present in 4.5.4:

$ apt download libopencv-dnn4.5=4.5.3+dfsg-1ubuntu1
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libopencv-dnn4.5 amd64 4.5.3+dfsg-1ubuntu1 [972 kB]
Fetched 972 kB in 3s (307 kB/s)           
$ dpkg-deb -R libopencv-dnn4.5_4.5.3+dfsg-1ubuntu1_amd64.deb dnn-4.5.3
$ objdump -T dnn-4.5.3/usr/lib/x86_64-linux-gnu/libopencv_dnn.so.4.5|grep _ZTIN2cv3dnn14dnn4_v202106085LayerE
00000000002fd448 g    DO .data.rel.ro	0000000000000018  Base        _ZTIN2cv3dnn14dnn4_v202106085LayerE
$ apt download libopencv-dnn4.5
Get:1 http://archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 libopencv-dnn4.5 amd64 4.5.4+dfsg-1ubuntu2 [1102 kB]
Fetched 1102 kB in 2s (550 kB/s)
$ dpkg-deb -R libopencv-dnn4.5_4.5.4+dfsg-1ubuntu2_amd64.deb dnn-4.5.4 
$ objdump -T dnn-4.5.4/usr/lib/x86_64-linux-gnu/libopencv_dnn.so.4.5|grep _ZTIN2cv3dnn14dnn4_v202106085LayerE
$

opencv uses no symbols files to prevent ABI skew; and from the type name
(dnn4_v20210608) it appears this is not a stable interface.  But it is
exported, and it is used.

This is also not a one-off symbol change.

$ diff -u <(objdump -T dnn-4.5.3/usr/lib/x86_64-linux-gnu/libopencv_dnn.so.4.5 | grep '\.text' | cut -b50- |sort) <(objdump -T dnn-4.5.4/usr/lib/x86_64-linux-gnu/libopencv_dnn.so.4.5 | grep '\.text' | cut -b50- |sort) | grep -c ^- 
256
$

Since upstream doesn't ship a stable ABI here, there are basically two
choices:

 - change the binary package name and conflict with older versions of the
   library (libopencv-dnn4.5debian1 Conflicts: libopencv-dnn4.5)
 - ship this as a static library only.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20211206/d7570ac7/attachment.sig>


More information about the debian-science-maintainers mailing list