Description
OS: Arch Linux 64bit
$ pkg-config --libs cblas
-L -lcblas -lblas
$ file /lib/libcblas.so
/lib/libcblas.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=016679535567a6065cc9f5d0cdcbeb3f5830aa93, stripped
$ nm -D /lib/libcblas.so | grep ddot
0000000000008a60 T cblas_ddot
CMake's output:
-- Found PkgConfig: /usr/bin/pkg-config (found version 0.29.1)
-- Checking for module 'cblas'
-- Found cblas, version 3.6.1
-- Checking for module 'lapack'
-- Found lapack, version 3.6.1
-- Found BLAS and LAPACK via pkg-config
I see Dlib doesn't check for cblas_ddot
if it finds BLAS using pkg-config https://github.com/davisking/dlib/blob/master/dlib/cmake_utils/cmake_find_blas.txt#L54. I added the lines checking for cblas_ddot
before the return statement and CMake said it can't find cblas_ddot
. According to this thread, I replaced CHECK_FUNCTION_EXISTS
with CHECK_LIBRARY_EXISTS
and CMake finally found cblas_ddot
.
But I also wrote a simple C program to test cblas_ddot
and it works fine. Which means even though Dlib does not check for cblas_dot
, it should be able to find it at runtime. Right? I've checked link.txt and whether cblas_ddot
is found or not, cblas and lapack are linked. So there probably is a problem when packing Dlib into a shared library.
Activity
davisking commentedon Jul 10, 2016
Cool. So it didn't link right for some configuration of arch linux and you fixed cmake so it did?
krsfrodaslz commentedon Jul 10, 2016
Nope. It still doesn't work.
It's clear now the final shared library got linked to libblas.so and not libcblas.so.
cblas_ddot
is only available in libcblas.so. Maybe we could replacecblas_ddot
withddot_
which is available in all the three files. But why is libcblas.so not linked?davisking commentedon Jul 10, 2016
I don't know. Maybe there is something wrong with pkgconfig.
krsfrodaslz commentedon Jul 10, 2016
Uff..you're right. The output of pkg-config contains a
-L
with no argument and-lcblas
follows it. Maybe gcc treated-lcblas
as the argument of-L
and that's why libcblas.so is not linked. Never encountered this before. Removing-L
and it works now :)davisking commentedon Jul 10, 2016
Sweet
ixna commentedon Aug 18, 2016
For fellow arch linux users, if anyone facing same issue as above and wondering what @mljli means, just replace ./dlib/cmake_utils/cmake_find_blas.txt line 48
set(blas_libraries "${BLAS_REFERENCE_LDFLAGS}")
with
set(blas_libraries "-lcblas;-lblas")
But make sure the output of
pkg-config --libs cblas
is
-L -lcblas -lblas
yn5 commentedon Nov 12, 2018
@ixna Any idea how to go about this when installing dlib trough pip?
davisking commentedon Nov 12, 2018
What exactly is the conclusion here? pkgconfig on arch linux is broken and shouldn't be used at all? Maybe it should just be removed from the cmake script all together. I've never been a big fan of pkgconfig anyway.
yn5 commentedon Nov 12, 2018
I "solved" the issue for now by installing the python-dlib package from AUR and reinstalling my pipenv dependencies
Linux Distro Detection to fix issue number #2159 #154 (#2169)