在OS X上编译dlib [英] Compiling dlib on OS X

查看:103
本文介绍了在OS X上编译dlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在OS X的Qt项目中使用dlib。因此,在此尝试中,我做了以下操作:

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

在dlib根目录中:

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

在dlib根目录中:

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

.pro文件:

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();
//...

编译输出:

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

如何解决此问题并在OS X上将dlib与Qt一起使用?

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

推荐答案

正确的解决方案是添加缺少的库以进行链接。构建Dlib时-它找到了一些BLAS库并启用了BLAS支持。
要查找此库,请查看位于
/ Users / user / dlib_build / lib / pkgconfig的dlib的pkgconfig文件,它的行类似于库:-L $ {libdir} -ldlib
Qt不会自动管理此类依赖关系,因此您应该手动添加blas库

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

另一种(简单的)解决方案是在不使用BLAS的情况下构建dlib / LAPACK支持:
在dlib根目录中:

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

这篇关于在OS X上编译dlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆