提问:rokid-openvoice-sdk的linux demo运行出现段错误

沟通与交流

(121749746) #1

rokid-openvoice-sdk在ubuntu中编译demo.cc生成的demo可执行程序,运行后报段错误,能否帮忙看下?谢谢! rokid-openvoice-sdk/build$ ./demo D 2018-01-07 10:30:22.411956 [speech.Connection] work thread runing D 2018-01-07 10:30:22.412353 [speech.Connection] work thread: connecting D 2018-01-07 10:30:22.411987 [speech.tts] thread ‘send_reqs’ begin D 2018-01-07 10:30:22.412391 [speech.tts] TtsImpl.send_reqs wait req available D 2018-01-07 10:30:22.412406 [speech.tts] TtsImpl.poll wait D 2018-01-07 10:30:22.412319 [speech.tts] thread ‘gen_results’ run D 2018-01-07 10:30:22.412368 [speech.Connection] server uri is wss://apigwws.open.rokid.com:443/api Segmentation fault (core dumped)


(大发) #2

收到您的提问~ 会转给技术同学看看哈


(chen.zhang) #3

必现吗? 能否gdb看一下崩溃的堆栈信息


(121749746) #4

是必现的,用gdb 运行后信息如下: Starting program: /home/tst/work2/codes/rokid-openvoice-sdk/build/demo [Thread debugging using libthread_db enabled] Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”. [New Thread 0x7ffff5e81700 (LWP 22908)] D 2018-01-07 13:41:21.362544 [speech.Connection] work thread runing [New Thread 0x7ffff5680700 (LWP 22909)] D 2018-01-07 13:41:21.362942 [speech.Connection] work thread: connecting D 2018-01-07 13:41:21.362964 [speech.Connection] server uri is wss://apigwws.open.rokid.com:443/api [New Thread 0x7ffff4e7f700 (LWP 22910)] D 2018-01-07 13:41:21.363254 [speech.tts] thread ‘send_reqs’ begin [New Thread 0x7fffeffff700 (LWP 22911)] D 2018-01-07 13:41:21.363761 [speech.tts] TtsImpl.send_reqs wait req available D 2018-01-07 13:41:21.363762 [speech.tts] thread ‘gen_results’ run [New Thread 0x7fffef7fe700 (LWP 22912)] D 2018-01-07 13:41:21.364148 [speech.tts] TtsImpl.poll wait

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff5e81700 (LWP 22908)] 0x00007ffff6c415cb in std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6


(121749746) #5

(gdb) bt #0 0x00007ffff6c415cb in std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007ffff7bc71cc in uWS::Hub::connect(std::string, void*, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > >, int, uWS::Group) () from /home/tst/work2/codes/uWebSockets/libuWS.so #2 0x00007ffff711496c in rokid::speech::SpeechConnection::connect (this=0x60c540) at /home/tst/work2/codes/rokid-openvoice-sdk/src/common/speech_connection.cc:283 #3 0x00007ffff7113eff in rokid::speech::SpeechConnection::run (this=0x60c540) at /home/tst/work2/codes/rokid-openvoice-sdk/src/common/speech_connection.cc:145 #4 0x00007ffff7113a87 in rokid::speech::SpeechConnection::__lambda6::operator() (__closure=0x611a70) at /home/tst/work2/codes/rokid-openvoice-sdk/src/common/speech_connection.cc:54 #5 0x00007ffff711897a in std::_Bind_simple<rokid::speech::SpeechConnection::initialize(int32_t, const rokid::speech::PrepareOptions&, char const)::__lambda6()>::_M_invoke<>(std::_Index_tuple<>) ( this=0x611a70) at /usr/include/c++/4.8/functional:1732 #6 0x00007ffff7118829 in std::_Bind_simple<rokid::speech::SpeechConnection::initialize(int32_t, const rokid::speech::PrepareOptions&, char const*)::__lambda6()>::operator()(void) (this=0x611a70) at /usr/include/c++/4.8/functional:1720 #7 0x00007ffff711875a in std::thread::_Impl<std::_Bind_simple<rokid::speech::SpeechConnection::initialize(int32_t, const rokid::speech::PrepareOptions&, char const*)::__lambda6()> >::_M_run(void) ( this=0x611a58) at /usr/include/c++/4.8/thread:115 #8 0x00007ffff6c37bf0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x00007ffff6454182 in start_thread (arg=0x7ffff5e81700) at pthread_create.c:312 #10 0x00007ffff618130d in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:111


(chen.zhang) #6

这看不出来是什么问题。 你在执行./config时加上–debug参数,再编译一下,再用gdb运行。 对了,uWebsockets库也要加上调试信息,你要改一下uWebsockets的Makefile,加上-g -O0参数 去掉原来的-O3之类的参数


(121749746) #7
`我这个是已经加了--debug参数的了`

(121749746) #8


(121749746) #9

config配置 ./config --debug --build-demo --uws=/home/tst/work2/codes/uWebSockets uWebSockets的Makefile里面也加了-g -O0


(121749746) #10

你好!还有什么办法排查这个问题吗?


(chen.zhang) #11

这问题很扯啊。没看到可能崩溃的地方。 你写一个最简单的程序,调用uWebsockets的Hub::connect方法试试


(121749746) #12

我是直接在github上下载你们的sdk的,没作修改,就直接报这个错了,uWebsockets这块我不太熟悉,能否给一个示例呢?谢谢!


(chen.zhang) #13

我也是ubuntu,但我运行起来没问题。所以不知道你那边出现了啥问题。 uWebsockets是开源库,在github上的,它有一堆示例和测试用例,你可以参照着写。 我就是看这些示例自己写的。