dmitriy-serdyuk / kaldi-python

Python wrappers for Kaldi data
Apache License 2.0
34 stars 18 forks source link

Compiling error when installing #18

Open CyanHillFox opened 6 years ago

CyanHillFox commented 6 years ago

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)) );
dmitriy-serdyuk commented 6 years ago

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?

CyanHillFox commented 6 years ago

@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.

ermu-tech commented 2 years ago

#

@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?

jfainberg commented 2 years ago

@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.