Sudo apt-get update sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev sudo apt-get install libboost-all-dev sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler imagemagick librsvg2-bin sudo apt-get install libqrencode-dev autoconf. I'm trying to install libaio with following command line: sudo apt-get install libaio. Sudo apt-get install automake libtool autoconf gcc-g gcc libaio libaio-dev make but both of them doesn't work for me. How do I install libaio?
š Hi, itās Josh here. Iām writing you this note in 2021: the world of speech technology has changed dramatically since CMU-Sphinx. Before devoting significant time to deploying CMU-Sphinx, take a look at šø Coqui Speech-to-Text. It takes minutes to deploy an off-the-shelf šø STT model, and itās open source on Github. Iām on the Coqui founding team so Iām admittedly biased. However, you can tell from this blog that Iāve spent years working with speech technologies like CMU-Sphinx, so I understand the headaches.
With šø STT, weāve removed the headaches and streamlined for production settings. You can train and deploy state-of-the-art šø Speech-to-Text models in just minutes, not weeks. Check out the šø Model Zoo for open, pre-trained models in different languages. Try it out for yourself, and come join our friendly chatroom š
Some Background
I recently installed Ubuntu 14.04 on my Lenovo Yoga, and itās time to reinstall SPHINX.
When I installed SPHINX for the first time in September 2015, it was not a fun experience. I originally followed the instructions on CMUās website, but I couldnāt seem to get it right. I tried a number of different approaches, using different blogs as guides, but I got nowhere. I first tried downloading Pocketsphinx, Sphinxtrain, Sphinxbase and Sphinx4 from CMUās downloads page, but that didnāt work. I also tried installing the version hosted on SourceForge, but no luck there either. I finally decided to try cloning and installing the version on GitHub, and that seemed to do the trick. However, at the end of this post I show how to install CMUCLMTK from SourceForge, because they donāt have it on GitHub.
So, Iām going to go through installation process again here.
First, in case itās relevant for others Iām going to show a little info about my current setup.
You can see the exact kernel on my version of Ubuntu below:
Installing Dependencies
To install on Ubuntu (or any other unix-like system), we first need to install a few dependencies. Hereās the list:
Name | Homepage | Description |
---|---|---|
gcc | GNU Compiler Collection | GCC development is a part of the GNU Project, aiming to improve the compiler used in the GNU system including the GNU/Linux variant. |
automake | Automake | Tool for generating GNU Standards-compliant Makefiles. |
autoconf | Autoconf | Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. |
libtool | GNU Libtool | GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. |
bison | GNU Bison | Bison is a general-purpose parser generator that converts an annotated context-free grammar into a deterministic LR or generalized LR (GLR) parser employing LALR(1) parser tables. |
swig | SWIG | SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. |
python-dev | Python Development Package | Header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. |
libpulse-dev | PulseAudio Development Package | Headers and libraries for developing applications that access a PulseAudio sound server via PulseAudioās native interface. |
Hereās the command to get everything at once:
Installing CMU-SPHINX
Installing sphinxbase
Whether youāre using pocketsphinx or sphinx4, youāre going to need to install sphinxbase first.
The README for the sphinxbase repository says:
This package contains the basic libraries shared by the CMU Sphinx trainer and all the Sphinx decoders (Sphinx-II, Sphinx-III, and PocketSphinx), as well as some common utilities for manipulating acoustic feature and audio files.
To get sphinxbase running, we need to clone the repository from GitHub and then run a few commands to configure and install it in the right spot.
I usually make a folder on my desktop to store the source code, and then when itās all been installed you can just throw away all those extra files.
So, first we need to get to the Desktop, make a new directory and cd into it.
Now we can clone the source from GitHub, and you should get something like this:
Now can see that our once empty dir sphinx-source now has a new directory, sphinxbase:
Letās look at whatās inside this new dir, sphinxbase:
Now we need to run the autogen.sh shell script you can see in the sphinxbase directory. This will generate our Makefiles and other important scripts for compiling and installing. Weāre going to get a long output here, so I only show some of it here:
Before we charge right ahead to compilation with the make command, lets take a look at what new files were generated from running autogen.sh.
You can see that we now have the scripts needed for compiling, configuring, and installing sphinxbase. Now we can run make to do our installation. As nicely summarized on Wikipedia, āMake is a utility that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program.ā
When you run the make command without any arguments (still in the local version of the cloned sphinxbase repository), you will get a long output that ends something like this:
The next step is the last step. Run the command sudo make install. Root permission is important, because otherwise you will get some error without any Permision Denied warning.
You will see a good amount of output with some sections that look like this:
Thatās it! You should have successfully installed sphinxbase. To check if youāve actually installed it, just go to the terminal and do a tab-completion for sphinx_. You will see all the options of what youāve just installed.
At this point, if you try to run any one of these by entering it at the command line, you get an error:
This error has been answered by Nikolay Shmyrev on stackoverflow already, and the reason for this error is the following:
This error means that system fails to find the shared library in the location where it is installed. Most likely you installed it with default prefix /usr/local/lib which is not included into the library search path.
Thereās a few ways to solve this problem. You may have come across this one which doesnāt work well:
The problem is, this solution will work for as long as youāre in the same session in your terminal. When you logout and log back in, you will have to reset the variable again.
Rather, we can edit the file /etc/ld.so.conf so we always look into the right directory when we need to. If you take a look at the Linux Programmerās Manual you find the following description:
/etc/ld.so.conf: File containing a list of directories, one per line, in which to search for libraries.
So, this is the right place to make a change.
If you take a look into the config file right now, you will probably just see one line:
We want to add /usr/local/lib to the file. So, you can use nano to open it up, and add a new line that just says /usr/local/lib. Thatās it. Donāt delete anything else or add anything else or you might get some headaches.
If youāve added that new line in via nano, you should see something like this:
Now save the modified file (CTRL+o) and exit (CTRL+x).
Re-configure with the following command:
Now you can check that your computer is finding the shared libraries with the following:
Now you should be able to run the sphinxbase executables, and get a more reasonable error:
Installing pocketsphinx
Now that weāve got sphinxbase installed successfully, we can move onto installing pocketsphinx. According to the description on the pocketsphinx GitHub repository:
PocketSphinx is a lightweight speech recognition engine, specifically tuned for handheld and mobile devices, though it works equally well on the desktop.
Still using sphinx-source as our current working directory, we can clone pocketsphinx from GitHub with the following command:
If we peek inside the current working directory, we will see we have a new directory:
Sudo Apt-get Install Libtool
Now lets take a look at all the stuff weāve just cloned:
Looks pretty similar to what we found in our sphinxbase source directory, right?
It basically is, and we can run the same installation procedure as we did above. So now we cd into the dir itself and run autogen.sh. We get some output that looks like the following (again, Iāve truncated the output here).
Now weāve made all our necessary Makefiles, and we can see them in the pocketsphinx directory.
Same as we did above for sphinxbase, we run make now.
And now we can actually do the installation with make install and root privledges.
Letās see if we got something. If you type in pocketsphinx_ and do a tab completion to list all options, you should see something like this:
Now if you try to run one of them, we get a sensible error that says we didnāt supply any of the needed arguments.
Huzzah! We now have a functional version of pocketsphinx installed with all itās sphinxbase dependencies (if you followed the first section). If you already have a language model, an acoustic model, and a phonetic dictionary, youāre good to go!
However, if youād like to train or adapt an acoustic model, you need to install sphinxtrain as shown below.
Installing sphinxtrain
Letās clone sphinxtrain into the temporary directory weāve been using to store our source code (sphinx-source):
If we look inside the temorary directory, we see sphinxtrain right where it should be, alongside our other directories of source code.
Now, if we look inside this new sourcecode, we will see something pretty familiar.
Letās cd into sphinxtrain and run the script which generates the Makefiles.
Letās take a look at what we just did.
As with all the other installations, we now compile with make.
Moving right along, we can run make install to seal the deal.
Hopefully now you can try out sphinxtrain and get some sensible output:
You should be ready to go now!
Hopefully this was helpful for you. If you ran into issues or have suggestions on how to make this better, be sure to leave a comment!
Installing cmuclmtk
I canāt seem to find the code on CMU-Sphinxās GitHub account, so Iām just went through sourceforge instead. Stronger than you midi.
Air pc. NB A reader recommended to try this link from svn instead: svn://svn.code.sf.net/p/cmusphinx/code/trunk/cmuclmtk
As you can see below, we just downloaded pretty much everything theyāve got. Importantly, cmuclmtk is there, too.
Letās cd into cmuclmtk and take a look:
Familiar set up, right? We do the same steps as before, starting with ./autogen.sh.
Hereās all the things weāve just generated:
Now we run make.
And finally, sudo make install.
Now we can see a couple of the executables if we do a tab completion as such:
And if we run one without input, it hangs up and runs for a while, but works.
- 8Building and installing UHD from source code
Application Note Number
AN-445
Revision History
Date | Author | Details |
---|---|---|
2016-05-01 | Neel Pandeya | Initial creation |
Abstract
This Application Note provides a comprehensive guide for building, installing, and maintaining the open-source toolchain for the USRP (UHD and GNU Radio) from source code on the Linux platform. The Ubuntu and Fedora distributions are specifically discussed. Several other alternate installation methods are also discussed.
UHD on Linux
UHD is fully supported on Linux, using the GCC compiler, and should work on most major Linux distributions.
Devices
This document applies only to the USRP X300, X310, B200, B210, B200mini, N200, N210 devices. The E310 and E312 devices are embedded devices, and are fundamentally different from the other non-embedded USRP devices, and are not addressed by this document.
Install Linux
If you already have a recent version of Linux installed, then you may be able to skip this section. If you are starting from scratch, or simply want to start with a fresh new installation of Linux, then please follow the instructions and recommendations in this section.
We suggest that you use either Ubuntu 16.04.5, Ubuntu 18.04, Ubuntu 18.10, Fedora 27, 28, 29, and that you use a 64-bit architecture, not a 32-bit architecture. There are several re-spins of Ubuntu, such as Xubuntu, Lubuntu, Kubuntu, Linux Mint, all of which should also work. For the purposes of this document, these re-spins can be considered equivalent. Both Ubuntu and Fedora are known to work well with UHD and GNU Radio.
Download and install Ubuntu, Xubuntu, Linux Mint, or Fedora from the links below. Download the appropriate ISO image, and write it to a USB flash drive. Be sure to verify that the ISO file was not corrupted during the download process by checking the MD5 and/or SHA1 hash.
You can learn more about Ubuntu, Xubuntu, Linux Mint, and Fedora at the links below.
There are many tools for writing an ISO image to a USB flash drive. In Linux, you can use the 'dd' utility, or the UNetbootin utility. On Ubuntu systems, there is also the Startup Disk Creator utility as well.
Be sure to use a USB flash drive with at least 8 GB capacity, and use a USB 3.0 flash drive, not a USB 2.0 flash drive. If you use a slower USB 2.0 flash drive, then the install process will take significantly longer.
Update and Install dependencies
Before building UHD and GNU Radio, you need to make sure that all the dependencies are first installed.
However, before installing any dependencies, you should first make sure that all the packages that are already installed on your system are up-to-date. You can do this from a GUI, or from the command-line, as shown below.
On Ubuntu systems, run:
On Fedora 21 systems, run:
On Fedora 22, 23, 24 and 25 systems, run:
Once the system has been updated, then install the required dependencies for UHD and GNU Radio.
On Ubuntu 20.04 systems, run:
On Ubuntu 18.10 systems, run:
On Ubuntu 18.04 systems, run:
On Ubuntu 17.04 systems, run:
On Ubuntu 16.04 systems, run:
On Ubuntu 15.04 and 15.10 systems, run:
On Ubuntu 14.04 and 14.10 systems, run:
On Fedora 21 systems, run:
On Fedora 22, 23, 24 and 25 systems, run:
After installing the dependencies, you should reboot the system.
If the installation of the dependencies completes without any errors, then you can proceed to build and install UHD and GNU Radio.
Building and installing UHD from source code
UHD is open-source, and is hosted on GitHub. You can browse the code online at the link below, which points to version 3.14.0.0, which is the the latest release at the time of this writing.
There are several good reasons to build GNU Radio from source code, especially for doing development and prototyping. It it enables an easy way to customize the location of the installation, and to install multiple UHD versions in parallel, and switch between them. It also provides much more flexibility in upgrading and downgrading versions, and allows the user to modify the code and create customized versions, which could possibly include a patch or other bug-fix.
To build UHD from source code, clone the GitHub repository, check out a branch or tagged release of the repository, and build and install. Please follow the steps below. Make sure that no USRP device is connected to the system at this point.
First, make a folder to hold the repository.
Next, clone the repository and change into the cloned directory.
Next, checkout the desired UHD version. You can get a full listing of tagged releases by running the command:
Example truncated output of git tag -l
:
Note: As of UHD Version 3.10.0.0, the versioning scheme has changed to be a quadruplet format. Each element and version will follow the format of: Major.API.ABI.Patch. Additional details on this versioning change can be found here.
After identifying the version and corresponding release tag you need, check it out:
Next, create a build folder within the repository, invoke CMake and build UHD.
Next, you can optionally run some basic tests to verify that the build process completed properly.
Next, install UHD, using the default install prefix, which will install UHD under the /usr/local/lib folder. You need to run this as root due to the permissions on that folder.
Next, update the system's shared library cache.
Finally, make sure that the LD_LIBRARY_PATH
environment variable is defined and includes the folder under which UHD was installed. Most commonly, you can add the line below to the end of your $HOME/.bashrc
file:
On Fedora 22/23/24/25 you will need to set the LD_LIBRARY_PATH
to /usr/local/lib64
.
If the LD_LIBRARY_PATH
environment variable is already defined with other folders in your $HOME/.bashrc
file, then add the line below to the end of your $HOME/.bashrc
file to preserve the current settings.
For Fedora 21/22/23/24/25
For this change to take effect, you will need to close the current terminal window, and open a new terminal.
At this point, UHD should be installed and ready to use. You can quickly test this, with no USRP device attached, by running uhd_find_devices
. You should see something similar to the following.
Downloading the UHD FPGA Images
You can now download the UHD FPGA Images for this installation. This can be done by running the command uhd_images_downloader
.
Note: Since this installation is being installed to a system level directory (e.g. /usr/local
), the uhd_images_downloader
command requires sudo
privileges.
Sudo Apt-get Install Autoconf Automake Libtool
Example ouput for UHD 3.13.3.0:
Example output for UHD 3.13:
Building and installing GNU Radio from source code
As with UHD, GNU Radio is open-source and is hosted on GitHub. You can browse the code online at the link below, which points to version v3.7.13.4
, which is the the latest release at the time of this writing.
Note: GNU Radio is currently transitioning from major branches of 3.7.x.x to 3.8.x.x. It is generally recommend at this time to use either the v3.7.13.4
or maint-3.7
branch of GNU Radio. The master
branch includes many major changes such as converting to use Python 3 and may be unstable.
As with UHD, there are several good reasons to build GNU Radio from source code, especially for doing development and prototyping. It it enables an easy way to customize the location of the installation, and to install multiple GNU Radio versions in parallel, and switch between them. It also provides much more flexibility in upgrading and downgrading versions, and allows the user to modify the code and create customized versions, which could possibly include a patch or other bug-fix.
Similar to the process for UHD, to build GNU Radio from source code, clone the GitHub repository, check out a branch or tagged release of the repository, and build and install. Please follow the steps below. Make sure that no USRP device is connected to the system at this point.
First, make a folder to hold the repository.
Next, clone the repository.
Next, go into the repository and check out the desired GNU Radio version.
To checkout the v3.7.13.4
branch:
Or to checkout the maint-3.7
branch:
Next, update the submodules:
Next, create a build folder within the repository, invoke CMake, and build GNU Radio:
Next, you can optionally run some basic tests to verify that the build process completed properly.
Next, install GNU Radio, using the default install prefix, which will install GNU Radio under the /usr/local/lib folder. You need to run this as root due to the permissions on that folder.
Finally, update the system's shared library cache.
At this point, GNU Radio should be installed and ready to use. You can quickly test this, with no USRP device attached, by running the following quick tests.
There is a simple flowgraph that you can run that does not require any USRP hardware. It's called the dialtone test, and it produces a PSTN dial tone on the computer's speakers. Running it verifies that all the libraries can be found, and that the GNU Radio run-time is working.
You can try launching the GNU Radio Companion (GRC) tool, a visual tool for building and running GNU Radio flowgraphs.
If 'gnuradio-companion' does not start and complains about the PYTHONPATH
environment variable, then you may have to set this in your $HOME/.bashrc
file, as shown below.
On Fedora 21/22/23/24, the PYTHONPATH
environment variable will need to be set to:
Configuring USB
On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device. This step is only necessary for devices that use USB to connect to the host computer, such as the B200, B210, and B200mini. This setting should take effect immediately and does not require a reboot or logout/login. Be sure that no USRP device is connected via USB when running these commands.
Configuring Ethernet
For USRP devices that use Ethernet to connect to the host computer, such as the N200, N210, X300, X310, set a static IP address for your system of 192.168.10.1, with a netmask of 255.255.255.0. The default IP address of the USRP is 192.168.10.2, with a netmask of 255.255.255.0. You should probably set the IP address using the graphical Network Manager. If you set the IP address from the command line with ifconfig
, Network Manager will probably overwrite these settings.
Connect the USRP
The installation of UHD and GNU Radio should now be complete. At this point, connect the USRP to the host computer.
If the interface is Ethernet, then open a terminal window, and try to ping the USRP with 'ping 192.168.10.2'. The USRP should respond to the ping requests.
If the interface is USB, then open a terminal window, and run 'lsusb
'. You should see the USRP listed on the USB bus with a VID of 2500
and PID of 0020
, 0021
, 0022
, for B200, B210, B200mini, respectively.
Also try running 'uhd_find_devices
' and 'uhd_usrp_probe
'.
Thread priority scheduling
When UHD spawns a new thread, it may try to boost the thread's scheduling priority. If setting the new priority fails, the UHD software prints a warning to the console, as shown below. This warning is harmless; it simply means that the thread will retain a normal or default scheduling priority.
To address this issue, non-privileged (non-root) users need to be given special permission to change the scheduling priority. This can be enabled by creating a group usrp
, adding your user to it, and then appending the line @usrp - rtprio 99
to the file /etc/security/limits.conf
.
Then add the line below to end of the file /etc/security/limits.conf
:
You must log out and log back into the account for the settings to take effect. In most Linux distributions, a list of groups and group members can be found in the /etc/group
file.
There is further documentation about this in the User Manual at the link below.