kaldi-python icon indicating copy to clipboard operation
kaldi-python copied to clipboard

Compiling error when installing

Open CyanHillFox opened this issue 8 years ago • 4 comments

Hi. I'm trying to install kal-python, and I received some compiling error(see below) when installing. What I did is to change the 7th line of your setup.py to: os.system("KALDI_ROOT=~/Downloads/repository/kaldi make") where the KALDI_ROOT points to my downloaded kaldi repository(the most recent kaldi version). And the version of GCC I'm using is 5.4(on Ubuntu 16.04). Thanks, sincerely.

the error list to too long to paste here, so I select some, they are like:

/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:489: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:489: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)) );

CyanHillFox avatar Nov 29 '17 04:11 CyanHillFox

You don't have to modify the setup script, just export the variable in the shell: export KALDI_ROOT=... or KALDI_ROOT=... python setup.py install.

Have you compiled your kaldi as shared? Do you have boost-python installed?

dmitriy-serdyuk avatar Nov 29 '17 16:11 dmitriy-serdyuk

@dmitriy-serdyuk Thank you so much for your reply. The problem was solved by using an older version of Kaldi(committed on 9/9/2017), and now Kaldi-Python compiles. It seems that the recent Kaldi update broke the compatibility.

CyanHillFox avatar Nov 30 '17 09:11 CyanHillFox

@dmitriy-serdyuk Thank you so much for your reply. The problem was solved by using an older version of Kaldi(committed on 9/9/2017), and now Kaldi-Python compiles. It seems that the recent Kaldi update broke the compatibility.

excuse me,how to install an older version of Kaldi?

ermu-tech avatar Sep 27 '21 03:09 ermu-tech

@ermu-tech

Thank you so much for your reply. The problem was solved by using an older version of Kaldi(committed on 9/9/2017), and now Kaldi-Python compiles. It seems that the recent Kaldi update broke the compatibility.

excuse me,how to install an older version of Kaldi?

You can find an old commit in the commit history for Kaldi, and checkout that particular commit by git checkout hash, where hash corresponds to the hash for that commit.

jfainberg avatar Sep 27 '21 16:09 jfainberg