安装 dlib 时出错
Posted
技术标签:
【中文标题】安装 dlib 时出错【英文标题】:error in installing dlib 【发布时间】:2018-06-23 03:33:27 【问题描述】:在安装 dlib 时,执行命令 $ cmake --build . --config Release
时出错。
构建突然停止显示此错误:
`$ cmake --build . --config Release[ 75%] Built target dlib
[ 75%] Building CXX object CMakeFiles/dlib_.dir/src/other.cpp.o
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:56:1: error: reference to ‘list’ is ambiguous
list _max_cost_assignment (
^
In file included from /usr/local/include/boost/python/dict.hpp:11:0,
from /usr/local/include/boost/python.hpp:24,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:6,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python.h:6,
from /home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:4:
/usr/local/include/boost/python/list.hpp:57:7: note: candidates are: class boost::python::list
class list : public detail::list_base
^
In file included from /usr/include/c++/5/list:63:0,
from /usr/local/include/boost/detail/container_fwd.hpp:92,
from /usr/local/include/boost/functional/hash/extensions.hpp:22,
from /usr/local/include/boost/functional/hash/hash.hpp:594,
from /usr/local/include/boost/functional/hash.hpp:6,
from /usr/local/include/boost/type_index/stl_type_index.hpp:46,
from /usr/local/include/boost/type_index.hpp:29,
from /usr/local/include/boost/function/function_base.hpp:21,
from /usr/local/include/boost/function/detail/prologue.hpp:17,
from /usr/local/include/boost/function/function_template.hpp:13,
from /usr/local/include/boost/function/detail/maybe_include.hpp:15,
from /usr/local/include/boost/function/function0.hpp:11,
from /usr/local/include/boost/python/errors.hpp:13,
from /usr/local/include/boost/python/handle.hpp:11,
from /usr/local/include/boost/python/args_fwd.hpp:10,
from /usr/local/include/boost/python/args.hpp:10,
from /usr/local/include/boost/python.hpp:11,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:6,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python.h:6,
from /home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:4:
/usr/include/c++/5/bits/stl_list.h:507:11: note: template<class _Tp, class _Alloc> class std::__cxx11::list
class list : protected _List_base<_Tp, _Alloc>
^
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:69:11: error: reference to ‘list’ is ambiguous
const list& assignment
^
In file included from /usr/local/include/boost/python/dict.hpp:11:0,
from /usr/local/include/boost/python.hpp:24,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:6,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python.h:6,
from /home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:4:
/usr/local/include/boost/python/list.hpp:57:7: note: candidates are: class boost::python::list
class list : public detail::list_base
^
In file included from /usr/include/c++/5/list:63:0,
from /usr/local/include/boost/detail/container_fwd.hpp:92,
from /usr/local/include/boost/functional/hash/extensions.hpp:22,
from /usr/local/include/boost/functional/hash/hash.hpp:594,
from /usr/local/include/boost/functional/hash.hpp:6,
from /usr/local/include/boost/type_index/stl_type_index.hpp:46,
from /usr/local/include/boost/type_index.hpp:29,
from /usr/local/include/boost/function/function_base.hpp:21,
from /usr/local/include/boost/function/detail/prologue.hpp:17,
from /usr/local/include/boost/function/function_template.hpp:13,
from /usr/local/include/boost/function/detail/maybe_include.hpp:15,
from /usr/local/include/boost/function/function0.hpp:11,
from /usr/local/include/boost/python/errors.hpp:13,
from /usr/local/include/boost/python/handle.hpp:11,
from /usr/local/include/boost/python/args_fwd.hpp:10,
from /usr/local/include/boost/python/args.hpp:10,
from /usr/local/include/boost/python.hpp:11,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:6,
from /home/kshitij/src/dlib-18.16/dlib/../dlib/python.h:6,
from /home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:4:
/usr/include/c++/5/bits/stl_list.h:507:11: note: template<class _Tp, class _Alloc> class std::__cxx11::list
class list : protected _List_base<_Tp, _Alloc>
^
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp: In function ‘double _assignment_cost(const dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>&, const int&)’:
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:72:72: error: no matching function for call to ‘python_list_to_vector(const int&)’
return assignment_cost(cost, python_list_to_vector<long>(assignment));
^
In file included from /home/kshitij/src/dlib-18.16/dlib/../dlib/python.h:6:0,
from /home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:4:
/home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:29:16: note: candidate: template<class T> std::vector<T> python_list_to_vector(const boost::python::api::object&)
std::vector<T> python_list_to_vector (
^
/home/kshitij/src/dlib-18.16/dlib/../dlib/python/boost_python_utils.h:29:16: note: template argument deduction/substitution failed:
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:72:72: note: cannot convert ‘assignment’ (type ‘const int’) to type ‘const boost::python::api::object&’
return assignment_cost(cost, python_list_to_vector<long>(assignment));
^
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp: In function ‘void bind_other()’:
/home/kshitij/src/dlib-18.16/tools/python/src/other.cpp:89:32: error: ‘_max_cost_assignment’ was not declared in this scope
def("max_cost_assignment", _max_cost_assignment, (arg("cost")),
^
CMakeFiles/dlib_.dir/build.make:206: recipe for target 'CMakeFiles/dlib_.dir/src/other.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_.dir/src/other.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_.dir/all' failed
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2`.
这会阻止创建 .so 文件。
【问题讨论】:
【参考方案1】:您正在使用位于两个不同命名空间中的list
s。你应该打电话给他们
std::list
或
boost::python::list
取决于您打算使用哪一个。
【讨论】:
以上是关于安装 dlib 时出错的主要内容,如果未能解决你的问题,请参考以下文章
使用 Windows 10 在 Python 3.5 上安装 dlib 时出错