适配声学模型时运行sphinx_fe出现Segmentation fault错误求助
sphinx_fe Segmentation Fault on Ubuntu 16.04 Let's work through this segmentation fault step by step—here are the most likely fixes based on your setup and the GDB output pointing to strlen():
Verify the
feat.paramsfile
The error instrlen()suggests the command is trying to process an invalid string, often from a malformed parameter file. Check:- Is the path
en-us/feat.paramscorrect? Make sure you're running the command from the directory where theen-usfolder lives, or use an absolute path (e.g.,/home/your-user/cmusphinx/en-us/feat.params). - Open
feat.paramsand confirm there are no empty lines, missing values, or corrupted entries. It should contain valid feature extraction parameters like-samprate 16000or-winlen 0.025.
- Is the path
Check the
arctic20.fileidsfile
This file lists your WAV files, and invalid entries here can cause string-handling crashes:- Ensure every line in
arctic20.fileidsis a valid, existing path to a WAV file (no typos, no missing files, no trailing spaces). - Remove any empty lines or commented-out lines that aren't properly prefixed with
#.
- Ensure every line in
Validate your WAV files
sphinx_ferequires WAV files to be 16kHz, single-channel (mono), PCM-encoded. Mismatched formats can lead to low-level read errors that trigger segmentation faults:- Use
soxi your-file.wav(install withsudo apt install sox) to check the format. If it's not 16kHz mono, convert it with:sox input.wav -r 16000 -c 1 output.wav
- Use
Reinstall or rebuild SphinxBase
Ubuntu 16.04's default CMUSphinx packages are outdated, which can introduce compatibility bugs. Try:- Uninstalling the existing packages:
sudo apt purge sphinxbase libsphinxbase-dev - Cloning the latest SphinxBase source and compiling it manually (follow the official build instructions tailored to your system).
- Uninstalling the existing packages:
Dig deeper with GDB
To pinpoint exactly which string is causing the crash, rungdb sphinx_feand enter these commands:run -argfile en-us/feat.params -samprate 16000 -c arctic20.fileids -di . -do . -ei wav -eo mfc -mswav yes btThe backtrace (
bt) will show the exact function call that led tostrlen(), which can tell you if it's a parameter file issue, WAV path issue, or library bug.
内容的提问来源于stack exchange,提问作者Alexander Wentz

