尝试使用 devtoolset-8 编译 Azure 语音示例

问题描述 投票:0回答:1

我正在尝试使用 devtoolset-8 编译 azure linux c++ 示例:

scl enable devtoolset-8 "make"

但是我非常缺乏依赖项,我也找不到解决方案。

错误信息:

g++ compressed-audio-input.cpp -o compressed-audio-input \
    --std=c++14 \
    -I/root/speechsdk/include/cxx_api -I/root/speechsdk/include/c_api \
    -L/root/speechsdk/lib/centos7-x64 \
    -lMicrosoft.CognitiveServices.Speech.core -lpthread -l:libasound.so.2
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_length(__mbstate_t&, char const*, char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_encoding() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr(unsigned long, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator+=(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(unsigned long, char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::out_of_range::out_of_range(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::resize(unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::end()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::erase(unsigned long, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, unsigned long, char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::logic_error::logic_error(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_max_length() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_in(__mbstate_t&, char const*, char const*, char const*&, char32_t*, char32_t*, char32_t*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::invalid_argument::invalid_argument(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator=(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::~__codecvt_utf8_base()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::push_back(char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_always_noconv() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::insert(unsigned long, char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator=(wchar_t const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(unsigned long, unsigned long, char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_always_noconv() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())@GLIBCXX_3.4.22'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::logic_error::logic_error(std::logic_error const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__atomic_futex_unsigned_base::_M_futex_notify_all(unsigned int*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_out(__mbstate_t&, wchar_t const*, wchar_t const*, wchar_t const*&, char*, char*, char*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_set_length(unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_out(__mbstate_t&, char32_t const*, char32_t const*, char32_t const*&, char*, char*, char*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::collate<char> const& std::use_facet<std::__cxx11::collate<char> >(std::locale const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(unsigned long, char)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::insert(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::time_get<char, std::istreambuf_iterator<char, std::char_traits<char> > >::get(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, tm*, char const*, char const*) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::push_back(wchar_t)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::basic_istringstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_length(__mbstate_t&, char const*, char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_replace(unsigned long, unsigned long, wchar_t const*, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_assign(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_dispose()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_encoding() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::basic_ifstream<wchar_t, std::char_traits<wchar_t> >::basic_ifstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::basic_istream<wchar_t, std::char_traits<wchar_t> >& std::getline<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(std::basic_istream<wchar_t, std::char_traits<wchar_t> >&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_unshift(__mbstate_t&, char*, char*, char*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::back()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::~__codecvt_utf8_base()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::time_get<char, std::istreambuf_iterator<char, std::char_traits<char> > > const& std::use_facet<std::__cxx11::time_get<char, std::istreambuf_iterator<char, std::char_traits<char> > > >(std::locale const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::collate<char>::transform(char const*, char const*) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__future_base::_State_baseV2::_Make_ready::_M_set()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<char32_t>::do_max_length() const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::logic_error::logic_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__atomic_futex_unsigned_base::_M_futex_wait_until(unsigned int*, unsigned int, bool, std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char*, char*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(char const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*, char*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::insert(unsigned long, wchar_t const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::invalid_argument::invalid_argument(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_copy_chars(wchar_t*, wchar_t const*, wchar_t const*)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__codecvt_utf8_base<wchar_t>::do_in(__mbstate_t&, char const*, char const*, char const*&, wchar_t*, wchar_t*, wchar_t*&) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_of(char const*, unsigned long) const@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::_V2::generic_category()@GLIBCXX_3.4.21'
/root/speechsdk/lib/centos7-x64/libMicrosoft.CognitiveServices.Speech.core.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned long) const@GLIBCXX_3.4.21'
collect2: error: ld returned 1 exit status
make: *** [compressed-audio-input] Error 1

即使我设法使用 gcc 7.5.0 进行编译,它也不适合我,因为我将使用其他使用 devtoolset-8 的已完成项目来实现此功能,并且不可能使用 gcc 7.5.0 版本。

c++ azure speech-to-text
1个回答
0
投票

您遇到的错误消息表明,在尝试将您的程序与 lib

Microsoft.CognitiveServices.Speech
库链接时,缺少或不兼容的 C++ 标准库符号。

  • 安装包

    Microsoft.CognitiveServices.Speech

  • Azure 中创建 Azure 语音服务。

enter image description here

  • 代码参考取自 MSDOC
    Microsoft.CognitiveServices.Speech

替换为您的 SpeechkeySpeechRegion

#include <iostream>
#include <string>
#include <speechapi_cxx.h>

using namespace Microsoft::CognitiveServices::Speech;
using namespace Microsoft::CognitiveServices::Speech::Audio;

int main()
{
    std::string speechKey = "48f3e82567e648ab8d198d26d63a5f37"; // Replace with your actual Speech API key
    std::string speechRegion = "eastus"; // Replace with your actual Speech API region

    auto speechConfig = SpeechConfig::FromSubscription(speechKey, speechRegion);

    speechConfig->SetSpeechRecognitionLanguage("en-US");

    auto audioConfig = AudioConfig::FromDefaultMicrophoneInput();
    auto speechRecognizer = SpeechRecognizer::FromConfig(speechConfig, audioConfig);

    std::cout << "Speak into your microphone.\n";
    auto result = speechRecognizer->RecognizeOnceAsync().get();

    if (result->Reason == ResultReason::RecognizedSpeech)
    {
        std::cout << "RECOGNIZED: Text=" << result->Text << std::endl;
    }
    else if (result->Reason == ResultReason::NoMatch)
    {
        std::cout << "NOMATCH: Speech could not be recognized." << std::endl;
    }
    else if (result->Reason == ResultReason::Canceled)
    {
        auto cancellation = CancellationDetails::FromResult(result);
        std::cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;

        if (cancellation->Reason == CancellationReason::Error)
        {
            std::cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
            std::cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
            std::cout << "CANCELED: Did you set the correct speech API key and region?" << std::endl;
        }
    }

    return 0;
}

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.