在mac os上编译dlib

时间:2017-04-29 02:57:06

标签: c++ macos dlib

我在macOS上编译了dlib c ++代码。这是我输入cmake时的结果

build cmake ..
-- The C compiler identification is AppleClang 7.3.0.7030029
-- The CXX compiler identification is AppleClang 7.3.0.7030029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building a C++11 test project to see if your compiler supports C++11
-- ********** Your compiler failed to build a C++11 project.  C++11 is required to use all parts of dlib! **********
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- C++11 activated (compiler doesn't have full C++11 support).
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Looking for png_create_read_struct
-- Looking for png_create_read_struct - found
-- Looking for jpeg_read_header
-- Looking for jpeg_read_header - found
-- Searching for BLAS and LAPACK
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'cblas'
--   No package 'cblas' found
-- Checking for module 'lapack'
--   No package 'lapack' found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Found Intel MKL BLAS/LAPACK library
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- *** Dlib CUDA support requires C++11 but your compiler doesn't support it. ***
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/fengshaozhe/Applications/dlib-19.4/examples/build

这对我来说似乎很好。然后我做了

cmake --build . --config Release

看起来一切都已完成。但是当我试图像这样运行这个例子时

./face_landmark_detection_ex

我收到了错误

dyld: Library not loaded: libmkl_rt.dylib
  Referenced from: /Users/fengshaozhe/Applications/dlib-19.4/examples/build/./face_landmark_detection_ex
  Reason: image not found
[1]    70386 trace trap  ./face_landmark_detection_ex

有人能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

我通过升级cmake解决了这个问题。最后一个cmake版本是3.5,当前的cmake版本是3.8。 但我不知道为什么升级cmake可以解决这个问题。 有人可以告诉我原因吗?