how Compiling dlib on OS X

 

Questions


I try to use dlib in Qt project on OS X. So, in this try I did following:

In dlib root:

cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release

In dlib root:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/Users/user/dlib_build
cmake --build . --config Release --target install

.pro file:

INCLUDEPATH += /Users/user/dlib_build/include
LIBS += -L/Users/user/dlib_build/lib
LIBS += -ldlib

main.cpp:

//...
frontal_face_detector detector = get_frontal_face_detector();
//...

Compile output:

Undefined symbols for architecture x86_64:
"_dgesvd_", referenced from:
       dlib::lapack::binding::gesvd(char, char, int, int, double*, int, double*, double*, int, double*, int, double*, int) in main.o 
ld: symbol(s) not found for architecture x86_64

How can I solve this and use dlib with Qt on OS X?

 

 

————————————————-

Answer

The right solution is to add missing libraries for linking. When Dlib was build – it found some BLAS library and enabled BLAS support.
To find this library – take a look at pkgconfig file from dlib that is located at
/Users/user/dlib_build/lib/pkgconfig, it will have line like “Libs: -L${libdir} -ldlib”
Qt does not manage such dependencies automatically, so you should add blas libraries by hand

The other (simple) solution is to build dlib without BLAS/LAPACK support:
In dlib root:

mkdir build
cd build
cmake .. -DDLIB_USE_BLAS=OFF -DDLIB_USE_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=/Users/user/dlib_build
cmake --build . --config Release --target install

dlib

Facebook Comments

Post a comment