Ubuntu

在 AWS EC2 ubuntu 實例上安裝 cmu-sphinxbase

  • June 29, 2016

我已經使用 Elastic Beanstalk 在 EC2 上設置了一個應用程序。這是一個 Ubuntu 實例,我在它上面執行一個 Rails 應用程序,它依賴於sphinxbasepocketsphinx. 我已經通過 ssh 進入 EC2 實例來安裝 sphinxbase 及其依賴項:

sudo yum install autoconf libtool bison swig git
git clone https://github.com/cmusphinx/sphinxbase.git
cd sphinxbase/
./autogen.sh
./configure
make
make check
sudo make install
# Libraries have been installed in:
#   /usr/local/lib64/python2.7/dist-packages/sphinxbase

重新啟動後,我導航到我的應用程序的 url,我得到一個 Rails 錯誤頁面,查看伺服器日誌:

Could not open library 'libsphinxbase.so': libsphinxbase.so: cannot open shared object file: No such file or directory (LoadError)
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `map'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `ffi_lib'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx/api/sphinxbase.rb:5:in `<module:Sphinxbase>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx/api/sphinxbase.rb:3:in `<module:API>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx/api/sphinxbase.rb:2:in `<module:Pocketsphinx>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx/api/sphinxbase.rb:1:in `<top (required)>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx.rb:6:in `require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx.rb:6:in `<top (required)>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx-ruby.rb:1:in `require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/pocketsphinx-ruby-0.3.0/lib/pocketsphinx-ruby.rb:1:in `<top (required)>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:76:in `require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:72:in `each'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:72:in `block in require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:61:in `each'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:61:in `require'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.9.6/lib/bundler.rb:134:in `require'
 /var/app/current/config/application.rb:7:in `<top (required)>'
 /var/app/current/config/environment.rb:2:in `require'
 /var/app/current/config/environment.rb:2:in `<top (required)>'
 config.ru:3:in `require'
 config.ru:3:in `block in <main>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
 config.ru:1:in `new'
 config.ru:1:in `<main>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:112:in `eval'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:112:in `preload_app'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:158:in `<module:App>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
 /opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:28:in `<main>'

所以找不到libsphinxbase.so

我現在不知道該怎麼做,也找不到相關資訊。

有小費嗎?謝謝你。

一位同事向我指出了這篇博文,它幫助正確安裝了 cmu sphinx 及其依賴項。

http://jrmeyer.github.io/installation/2016/01/09/Installing-CMU-Sphinx-on-Ubuntu.html

引用自:https://serverfault.com/questions/786297