janchorowski / kaldi-python

Python wrappers for Kaldi data
Apache License 2.0
61 stars 51 forks source link

[Solved] Compiling errors when making (with the latest kaldi toolkit) #9

Open CyanHillFox opened 6 years ago

CyanHillFox commented 6 years ago

--Updated 11/29/2017 The problem is solved by using older kaldi toolkit (the version committed on 9/9/2017).

--Original First sorry for my poor English. I'm trying to install kaldi-python, but I received compiling errors(see below) when making. I don't know whether it is because I'm using the wrong boost library, which I installed with sudo apt-get libboost-dev-all. And the GCC version I'm using is 5.4.0(on Ubuntu 16.04).

Sincerely.

The errors are like:

In file included from /home/jian/Downloads/repository/kaldi/src/util/kaldi-table.h:470:0,
                 from kaldi_io_internal.cpp:37:
/home/jian/Downloads/repository/kaldi/src/util/kaldi-table-inl.h: In instantiation of ‘kaldi::SequentialTableReaderBackgroundImpl<Holder>::T& kaldi::SequentialTableReaderBackgroundImpl<Holder>::Value() [with Holder = PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > >; kaldi::SequentialTableReaderBackgroundImpl<Holder>::T = boost::python::api::object]’:
kaldi_io_internal.cpp:510:1:   required from here
/home/jian/Downloads/repository/kaldi/src/util/kaldi-table-inl.h:782:26: error: binding ‘const T {aka const boost::python::api::object}’ to reference of type ‘kaldi::SequentialTableReaderBackgroundImpl<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >::T& {aka boost::python::api::object&}’ discards qualifiers
     return holder_.Value();

and

/usr/include/boost/python/detail/invoke.hpp: In instantiation of ‘PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_<false, true>, const RC&, F&, TC&) [with RC = boost::python::detail::copy_const_reference_expects_a_const_reference_return_type<boost::python::api::object&>; F = boost::python::api::object& (kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >::*)(); TC = boost::python::arg_from_python<kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >&>; PyObject = _object]’:
/usr/include/boost/python/detail/caller.hpp:218:46:   required from ‘PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = boost::python::api::object& (kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >::*)(); Policies = boost::python::return_value_policy<boost::python::copy_const_reference>; Sig = boost::mpl::vector2<boost::python::api::object&, kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >&>; PyObject = _object]’
/usr/include/boost/python/object/py_function.hpp:38:33:   required from ‘PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<boost::python::api::object& (kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >::*)(), boost::python::return_value_policy<boost::python::copy_const_reference>, boost::mpl::vector2<boost::python::api::object&, kaldi::SequentialTableReader<PythonToKaldiHolder<BoostPythonconverter<std::vector<std::pair<int, int> >, kaldi::BasicPairVectorHolder<int>, kaldi::BasicPairVectorHolder<int> > > >&> >; PyObject = _object]’
kaldi_io_internal.cpp:510:1:   required from here
/usr/include/boost/python/detail/invoke.hpp:88:14: error: no match for call to ‘(const boost::python::detail::copy_const_reference_expects_a_const_reference_return_type<boost::python::api::object&>) (boost::python::api::object&)’
     return rc( (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)) );
junjunmin commented 6 years ago

Hi Elecky, I encounter the same error. How did you solve this problem?

CyanHillFox commented 6 years ago

@junjunmin The problem is solved by using older kaldi toolkit (the version committed on 9/9/2017), you can give it a try.

jfainberg commented 5 years ago

FYI it looks like the cause of the error is this line changing in kaldi-table.h: const T &Value(); to T &Value(); which now doesn't match with const T &Value() const {return t_;} in kaldi_io_internal.cpp.

zhange1990 commented 4 years ago

I encountered this recently. Can this be solved by modifying the source code in 'kaldi_io_internal.cpp'? @jfainberg

jfainberg commented 4 years ago

@zhange1990 Possibly, yes. I'm sorry I don't remember if I tried or what the outcome was...

zhange1990 commented 4 years ago

Thank you all the same~ Best wishes~ 841412407 邮箱841412407@qq.com 签名由 网易邮箱大师 定制 On 02/24/2020 23:37, Joachim Fainberg wrote: @zhange1990 Possibly, yes. I'm sorry I don't remember if I tried or what the outcome was... — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

zhange1990 commented 4 years ago

I encountered this recently. Is it required to set the boost lib to a specific version? @Elecky @janchorowski

ssnani commented 2 years ago

I have encountered this problem.. Tried with older version of kaldi(5.2) but still facing the error.. error: no match for call to ‘(const boost::python::detail::copy_const_reference_expects_a_const_reference_return_type<boost::python::api::object&>) (boost::python::api::object&)’