Tag Archives: ROS fatal error

[Solved] ROS fatal error: alsa/asoundlib. h: There is no such directory or file

Ubuntu18. 04 + catkin for ROS melody_Make compile robot_Voice, the error message is as follows:,

Scanning dependencies of target iat_publish
[ 12%] Building CXX object robot_voice/CMakeFiles/iat_publish.dir/src/iat_publish.cpp.o
[ 25%] Building C object robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
/home/mc/ros/vision/src/robot_voice/src/linuxrec.c:12:10: fatal error: alsa/asoundlib.h: 没有那个文件或目录
 #include <alsa/asoundlib.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
robot_voice/CMakeFiles/iat_publish.dir/build.make:110: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o' failed
make[2]: *** [robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o] Error 1
CMakeFiles/Makefile2:449: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/all' failed
make[1]: *** [robot_voice/CMakeFiles/iat_publish.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

Solution:

sudo apt-get install libasound2-dev

Or

sudo yum install alsa-lib-devel