Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 700176 - media-libs/opencv - ld: lib/libopencv_core.so.3.4.1: undefined reference to `cblas_zgemm'
Summary: media-libs/opencv - ld: lib/libopencv_core.so.3.4.1: undefined reference to `...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Amy Liffey
URL: https://wiki.gentoo.org/wiki/Blas-lap...
Whiteboard:
Keywords:
: 701940 741626 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-15 13:55 UTC by Thomas Beutin
Modified: 2020-09-23 05:02 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (gzipped) (build.log.gz,157.86 KB, application/gzip)
2019-11-15 14:34 UTC, Thomas Beutin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Beutin 2019-11-15 13:55:58 UTC
[...]
[544/680] : && /usr/bin/x86_64-pc-linux-gnu-g++  -march=sandybridge -fomit-frame-pointer -O2 -pipe   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-securi
ty -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -p
thread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp  -Wl,-O1 -Wl,--as-needed  -Wl,--gc-sections    -rdynami
c modules/flann/CMakeFiles/opencv_test_flann.dir/test/test_lshtable_badarg.cpp.o modules/flann/CMakeFiles/opencv_test_flann.dir/test/test_main.cpp.o  -o bin/opencv_test_flann  lib/libopencv_ts.a lib/libopencv_flann.so.3.4.1 lib/libopencv_
highgui.so.3.4.1 -ldl -lm -lpthread -lrt -lGL -lGLU /usr/lib64/libtbb.so lib/libopencv_videoio.so.3.4.1 lib/libopencv_imgcodecs.so.3.4.1 lib/libopencv_imgproc.so.3.4.1 -L/usr/lib64 lib/libopencv_core.so.3.4.1 && :
FAILED: bin/opencv_test_flann 
: && /usr/bin/x86_64-pc-linux-gnu-g++  -march=sandybridge -fomit-frame-pointer -O2 -pipe   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissi
ng-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fo
mit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp  -Wl,-O1 -Wl,--as-needed  -Wl,--gc-sections    -rdynamic modules/
flann/CMakeFiles/opencv_test_flann.dir/test/test_lshtable_badarg.cpp.o modules/flann/CMakeFiles/opencv_test_flann.dir/test/test_main.cpp.o  -o bin/opencv_test_flann  lib/libopencv_ts.a lib/libopencv_flann.so.3.4.1 lib/libopencv_highgui.so
.3.4.1 -ldl -lm -lpthread -lrt -lGL -lGLU /usr/lib64/libtbb.so lib/libopencv_videoio.so.3.4.1 lib/libopencv_imgcodecs.so.3.4.1 lib/libopencv_imgproc.so.3.4.1 -L/usr/lib64 lib/libopencv_core.so.3.4.1 && :
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: lib/libopencv_core.so.3.4.1: undefined reference to `cblas_zgemm'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: lib/libopencv_core.so.3.4.1: undefined reference to `cblas_sgemm'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: lib/libopencv_core.so.3.4.1: undefined reference to `cblas_dgemm'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: lib/libopencv_core.so.3.4.1: undefined reference to `cblas_cgemm'
collect2: error: ld returned 1 exit status


This might somewhat related to bug 698756 - i'm running on app-eselect/eselect-blas-0.2,virtual/{lapack.blas}-3.8,sci-libs/lapack-3.8, but have this issue on the system:

# eselect blas list
Available BLAS/CBLAS (lib32) candidates:
  (none found)
Available BLAS/CBLAS (lib64) candidates:
  (none found)



Reproducible: Always




# emerge --info '=media-libs/opencv-3.4.1-r6::gentoo'
Portage 2.3.76 (python 3.6.9-final-0, default/linux/amd64/17.0/desktop, gcc-9.2.0, glibc-2.29-r2, 5.3.11-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.3.11-gentoo-x86_64-Intel_Xeon_E312xx_-Sandy_Bridge-with-gentoo-2.6
KiB Mem:    49353364 total,  33656896 free
KiB Swap:   33554428 total,  33553404 free
Timestamp of repository gentoo: Thu, 14 Nov 2019 08:45:01 +0000
Head commit of repository gentoo: e64d6fba8ed13603a8280f7c633211d4542cb5d0
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://192.168.45.107/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

barzog-overlay
    location: /var/lib/layman/barzog-overlay
    masters: gentoo
    priority: 50

java
    location: /var/lib/layman/java
    masters: gentoo
    priority: 50

python
    location: /var/lib/layman/python
    masters: gentoo
    priority: 50

rion
    location: /var/lib/layman/rion
    masters: gentoo
    priority: 50

science
    location: /var/lib/layman/science
    masters: gentoo
    priority: 50

seden
    location: /var/lib/layman/seden
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=sandybridge -fomit-frame-pointer -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/fax /usr/share/gnupg/qualified.txt /var/spool/fax/etc /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/apache2-php7.2/ext-active/ /etc/php/apache2-php7.3/ext-active/ /etc/php
/cgi-php5.6/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/php/cli-php7.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/
texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /var/spool/fax/etc/xferfaxlog"
CXXFLAGS="-march=sandybridge -fomit-frame-pointer -O2 -pipe"
DISTDIR="/mnt/gentoo/distfiles/"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-li
bs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/lib/systemd/"
LANG="en_IE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en en_US de_DE de"
MAKEOPTS="-j28"
PKGDIR="/mnt/gentoo/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.gi
t"
PORTAGE_TMPDIR="/mnt/gentoo/tmp"
USE="R X X509 a52 aac aalib accounting acl acpi adns aim aio alsa amd64 amr ansi ao aot apache2 apng applet archive asm ass audio audiofile automount avahi avx awt bacula-console bash-completion bazaar bcmath berkdb bidi bind-mysql bittor
rent blas bluetooth bluray bonobo boost bzip2 cacert cairo caja calendar caps ccache cdb cdda cddb cdio cdparanoia cdr cgi chipcard chroot clang colord command-args corefonts cpudetection cpulimit cracklib cramfs crypt cscope css csv ctyp
e cue cups curl curlwrappers customlog cvs cvsgraph cxx cyrus dba dbi dbm dbus dbx devhelp device-mapper devmap dga dhcp dirac directfb djvu dlna dlopen dnsdb dri dri3 drm dts dv dvb dvd dvda dvdr dvi ecc egl elogind enchant encode eselec
t-ldso excel exif expat faad fam fastcgi fat fdk ffmpeg fftw fits flac flash flatfile fltk fontconfig fonts fpx ftp fuse fusefs gallium gd gdal gdbm gdu gegl geoclue geoip geos ggi gif gimp ginac git glib glpk glut gmp gnome-keyring gnupl
ot gpg gphoto2 graphviz gs gsf gsl gsm gssapi gstreamer gtk gtk2 gtk3 gudev gzip h323 hardened hardenedphp hddtemp hdf5 hdri highlight hpn html http hunspell hwdb iconv icq icu idea idled idn imagemagick imap imlib imlib2 inifile innodb i
nt64 introspection ios ipalias ipc ipod ipv6 iso jabber jack java javascript jbig jingle jit jpeg jpeg2k json kdrive kerberos keymap kmod kpathsea lame lapack latex lcms ldap lensfun less libass libcaca libcerf libcxx libnotify libsampler
ate libv4l libv4l2 libwww live llvm lm_sensors lmtp logrotate logwatch lua lz4 lzma lzo mad magic mathml matplotlib matroska mbox mcal md5sum memlimit mercurial metis mgetty mhash midi milter mime mimencode ming mmap mms mmx mmxext mng mp
3 mp4 mpeg mpir mplayer msn mtp multilib mumps musepack musicbrainz mysql mysqli nagios-dns nagios-game nagios-ntp nagios-ping nagios-ssh natspec ncurses net netboot netcdf netlink network network-uri networkmanager nfs nis nls nntp nptl 
nsplugin nss ntfs ntp oav ocaml ocamlopt ocatve ocr octave odbc offensive ogg openal opencl openexr opengl openh264 openmp openrc openssh openssl opus orc ortp osc oscar pam pam_chroot pam_console pam_timestamp pango parse-clocks pcf pci 
pcntl pcre pda pdf pdfkit pdflib perl pgo php pic plotutils png policykit portaudio posix postfix postgis postgres postproc postscript ppds procmail ps pulseaudio pwdb python qdbm qt5 quotas quvi radius raw rdesktop rdp readline recode re
iserfs rpc rrdtool rss rtmp ruby samba sample sasl scanner schroedinger scotch screen sendfile sensord session sftp sftplogging shaper shared sharedext shorten shout sieve simplexml slang slp smartcard smime smp sms smtp sna sndfile snmp 
snortsam soap sockets socks5 sound sox spamassassin sparse spatialite speex spell spice spl split-usr sql sqlite sqlite3 sse sse2 sse3 sse4 sse4_1 ssh ssl ssse3 stream subversion svg sysfs syslog sysvipc szip t1lib taglib tcpd telepathy t
est-programs theora threads tidy tiff timidity tokenizer tools transparent-proxy truetype truetype-fonts tslib twolame type1-fonts udev udisks unicode upnp upnp-av upower usb userlocales utf8 uuid v4l vaapi vala vcd vdpau vhosts video vim
-syntax virtual-users virus-scan vnc vorbis vpx vte wavpack wayland wddx weather webdav webkit webm webp wifi win32codecs withsamplescripts wmf x264 x265 xattr xcb xcomposite xetex xface xfs xft xinerama xinetd xml xml2 xmlrpc xmp xmpp xo
rg xosd xpdf-headers xpm xps xrandr xscreensaver xsl xslt xv xvfb xvid xvmc xz yahoo yaml yaz zeromq zlib zstd zvbi" ABI_X86="32 64" APACHE2_MODULES="access auth auth_basic auth_digest authn_default authn_core authn_file authn_dbm authn_d
bd authn_alias authn_anon authz_core authz_groupfile authz_host authz_user authz_dbd authz_dbm authz_owner authz_default dbd ident imagemap alias echo charset_lite cache file_cache disk_cache mem_cache ext_filter case_filter case-filter-i
n deflate filter mime_magic cern_meta proxy proxy_connect proxy_ftp http2 proxy_html proxy_http proxy_ajp proxy_balancer proxy_fcgi proxy_wstunnel expires headers usertrack info include cgi cgid dav dav_lock dav_fs vhost_alias speling rew
rite log_config logio env setenvif mime status substitute autoindex asis negotiation dir imap actions userdir so unique_id version dumpio log_forensic reqtimeout socache_shmcb unixd slotmem_shm ratelimit remoteip lbmethod_bybusyness lbmet
hod_byrequests lbmethod_bytraffic lbmethod_heartbeat xml2enc brotli watchdog" APACHE2_MPMS="worker" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" FFTOOLS="cws2fws ffhash pktdu
mper sidxindex qt-faststart aviocat ismindex" GPSD_PROTOCOLS="aivdm sirf mtk3301 gpsclock superstar2 timing nmea" GRUB_PLATFORMS="pc multiboot efi coreboot efi-64" INPUT_DEVICES="keyboard mouse evdev wacom synaptics" KERNEL="linux" L10N="
en_GB en en_US de_DE de" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer nlpsolver pdfimport wiki-publisher scripting-beanshell" LLVM_TARGETS="X86 NVPTX" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3" POSTGR
ES_TARGETS="postgres11 postgres12" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24 ruby25" SANE_BACKENDS="net hp" USERLAND="GNU"
 VIDEO_CARDS="vga intel i915 i965 fbdev vesa" XFCE_PLUGINS="clock multiload-nandhp power trash"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Thomas Beutin 2019-11-15 14:34:53 UTC
Created attachment 596234 [details]
build.log (gzipped)
Comment 2 Benda Xu gentoo-dev 2019-11-16 02:20:33 UTC
I have pinned down the bug.

Please run:

`eselect blas add lib64 /usr/lib64/blas/reference reference`

manually.


@lumin, the upgrade path from sci-libs/blas-reference to sci-libs/lapack-3.8 is not smooth.  Somehow the above command in pkg_postinst() does not succeed leaving  no viable blas candidates.
Comment 3 Benda Xu gentoo-dev 2019-11-16 05:23:23 UTC
Uninstallation of sci-libs/blas-reference removes /etc/env.d/blas/lib64/reference, and uninstallation of sci-libs/lapack-reference removes /etc/env.d/lapack/lib64/reference. Unfortunately they are uninstalled after sci-libs/lapack is installed, and /etc/env.d/blas/lib64/reference is not in the package file list and is not protected.
Comment 4 Thomas Beutin 2020-01-06 13:13:04 UTC
(In reply to Benda Xu from comment #2)
> I have pinned down the bug.
> 
> Please run:
> 
> `eselect blas add lib64 /usr/lib64/blas/reference reference`
> 
> manually.

i did it, but it doesn't helps - the issue persists.
Comment 5 François Bissey 2020-01-06 19:49:36 UTC
I am more inclined to think there is a flaw in the build system. The run of cmake on the 64bit ABI arch finds /usr/lib64/liblapack.so, however the error is on a cblas symbol. I think libopencv_core.so.3.4.1 expect to be compiled with a lapack that includes cblas symbols as well.

[90/680] : && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -march=sandybridge -fomit-frame-pointer -O2 -pipe   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp  -Wl,-O1 -Wl,--as-needed -shared -Wl,-soname,libopencv_core.so.3.4 -o lib/libopencv_core.so.3.4.1 modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/alloc.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/arithm.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/array.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/batch_distance.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/channels.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/command_line_parser.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/conjugate_gradient.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/convert.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/convert.sse4_1.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/convert_c.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/convert_scale.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/copy.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/count_non_zero.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/cuda_gpu_mat.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/cuda_host_mem.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/cuda_info.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/cuda_stream.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/datastructs.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/directx.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/downhill_simplex.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/dxt.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/gl_core_3_1.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/glob.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/kmeans.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/lapack.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/lda.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/logger.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/lpsolver.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/lut.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/mathfuncs.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/mathfuncs_core.dispatch.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matmul.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_c.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_decomp.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_expressions.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_iterator.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_operations.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_sparse.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/matrix_wrap.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/mean.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/merge.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/minmax.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/norm.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/ocl.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/opencl/runtime/opencl_clamdblas.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/opencl/runtime/opencl_clamdfft.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/opencl/runtime/opencl_core.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/out.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/ovx.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/parallel_impl.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/pca.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_base64.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_c.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_cpp.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_json.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_types.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_xml.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/persistence_yml.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/rand.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/softfloat.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/split.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/stat.dispatch.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/stat_c.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/stl.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/sum.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/tables.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/trace.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/types.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/utils/filesystem.cpp.o modules/core/CMakeFiles/opencv_core.dir/src/va_intel.cpp.o modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.o  -ldl -lm -lpthread -lrt -lGL -lGLU /usr/lib64/libtbb.so -lz -lva -lva-drm -llapack -L/usr/lib64 && :

If -llapack doesn't provide cblas and lib/libopencv_core.so.3.4.1 does use cblas directly, then of course it is underlinked.
Using openblas instead of reference would probably fix the issue. A more general fix would be pass -lcblas as well.
Comment 6 François Bissey 2020-01-07 07:48:40 UTC
A deep look at cmake/OpenCVFindLAPACK.cmake in opencv's source shows that for mkl, openblas and accelerate they are actually after
* lapacke (headers)
* cblas (headers)
* lapack (libraries)
stuff. The compilation check for the libraries only look for lapack functions. opencv also seem to provide its alternate lapacke headers in any case. I don't know that lapacke is actually required. But cblas definitely is. cmake doesn't really have a FindCBLAS module, just BLAS and LAPACK.

My recommendation would be for the ebuild to pass
-DLAPACK_LIBRARIES="-llapack -lcblas" 
to cmake when lapack is required. Probably should add virtual/cblas to the dependencies as well.
Comment 7 Benda Xu gentoo-dev 2020-01-26 09:08:00 UTC
(In reply to Thomas Beutin from comment #4)
> (In reply to Benda Xu from comment #2)
> > I have pinned down the bug.
> > 
> > Please run:
> > 
> > `eselect blas add lib64 /usr/lib64/blas/reference reference`
> > 
> > manually.
> 
> i did it, but it doesn't helps - the issue persists.

How about reinstalling sci-libs/lapack?
Comment 8 Benda Xu gentoo-dev 2020-01-26 09:10:18 UTC
(In reply to François Bissey from comment #6)
> A deep look at cmake/OpenCVFindLAPACK.cmake in opencv's source shows that
> for mkl, openblas and accelerate they are actually after
> * lapacke (headers)
> * cblas (headers)
> * lapack (libraries)
> stuff. The compilation check for the libraries only look for lapack
> functions. opencv also seem to provide its alternate lapacke headers in any
> case. I don't know that lapacke is actually required. But cblas definitely
> is. cmake doesn't really have a FindCBLAS module, just BLAS and LAPACK.
> 
> My recommendation would be for the ebuild to pass
> -DLAPACK_LIBRARIES="-llapack -lcblas" 
> to cmake when lapack is required. Probably should add virtual/cblas to the
> dependencies as well.

I don't understand. Lapack is a fortran library. Why does it depend on a c library?
Comment 9 François Bissey 2020-01-26 09:27:58 UTC
Lapack is indeed a fortran library. There is also lapacke (notice the final "e") which a c interface to it or a c version. Lapack depends on blas which also has c version called cblas.

The point is, big libraries like openblas or MKL present one library that includes:
lapack
lapacke
blas
cblas
and sometimes more. All in one single library I repeat. The issue here is that opencv actually depends not only on lapack but on cblas. But it expect to get everything from one single library. And the *-reference libraries in Gentoo are definitely separate libraries.
Comment 10 François Bissey 2020-01-26 09:32:49 UTC
I was a bit hasty and may be not clear. opencv calls functions from both lapack and cblas so needs to be linked with both. opencv is actually in C so it just wraps lapack's fortran calls but it is using cblas directly.
Comment 11 Benda Xu gentoo-dev 2020-01-26 13:36:52 UTC
(In reply to François Bissey from comment #10)
> I was a bit hasty and may be not clear. opencv calls functions from both
> lapack and cblas so needs to be linked with both. opencv is actually in C so
> it just wraps lapack's fortran calls but it is using cblas directly.

Thanks François, that makes a lot of sense to me now.  It is not a bug of lapack we are providing.

Let's call opencv maintainer for help, hopefully adding cblas linking explicitly.
Comment 12 Jeroen Roovers gentoo-dev 2020-09-23 05:02:08 UTC
*** Bug 741626 has been marked as a duplicate of this bug. ***
Comment 13 Jeroen Roovers gentoo-dev 2020-09-23 05:02:17 UTC
*** Bug 701940 has been marked as a duplicate of this bug. ***