ALSA lib confmisc.c:768:(parse_card) cannot find card '0' - linux

I used a virtual machine of Linux to compile and run a C++ game. The compilation process of cmake and make is ok. But when I run the executable file, it indicates problems with ALSA.
enter image description here
So I try to install the relevant ALSA modules by input in terminal:
apt-get install libasound2 alsa-utils alsa-oss
But the problems in the picture remain after inputting the installation command above.
So how to solve this problem? Is there any relevance to the configuration of ALSA?
How to solve the problems of ALSA in the picture? Need to configure some files?

Related

Error while trying to run HRTF example from PyAL (File descriptor in bad state) on Raspberry Pi

I am trying to experiment with HRTF audio spatialization using PyAL library on the Raspberry Pi
https://github.com/NicklasTegner/PyAL/tree/master/examples/HRTF
PyAL depends on OpenAL. I have installed necessary dependencies using sudo apt-get install to ensure the library works: libopenal-dev libopenal1 libopenal-data libmysofa-dev libmysofa0 libmysofa-utils qt5-default alsa-utils alsa-oss alsaplayer-jack g++ gstreamer1.0-python3-plugin-loader gstreamer1.0-alsa
Additionally, I installed pyglet using: sudo pip3 install pyglet
All examples (3D audio, playback, efx, audiplayer, player) work except the HRTF example. When I try to run the HRTF example, I get the following error:
AL lib: (EE) ALCplaybackAlsa_reset: snd_pcm_hw_params(self->pcmHandle, hp) failed: File descriptor in bad state
I know for a fact that this is being caused by PulseAudio not being present in the system (https://unix.stackexchange.com/questions/467193/error-while-running-the-gstreamer-example-on-development-kit-file-descriptor). So I installed pulseaudio and its corresponding tools (e.g. pavucontrol using sudo apt-get install pulseaudio.
After installing pulseaudio and rebooting, when I run that example, the example executes without error. However, I do not hear any audio output in the headphones. In fact, audio output from the entire system stops. I made sure the audio output is headphones from sudo raspi-config and alsamixer does show pulseaudio as a audio driver (when it is installed).
I am getting conflicting information from the Internet. The above link suggests using pulseaudio to mitigate the error (which is correct), whereas this link: https://www.youtube.com/watch?v=stvc7ehCWUU and https://raspberrypi.stackexchange.com/questions/1621/no-sound-output-in-vlc say to remove pulseaudio (which is also correct in the sense it brings my audio back but I can't run the HRTF example).
Any suggestions?
This is very odd, but I solved the problem by connecting a cheap external USB audio card (https://www.amazon.com/gp/product/B00IRVQ0F8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1). Apparently, ALSA keeps control of 3.5mm jack and doesn't surrender control to Pulseaudio of that jack. Simplest solution is to use an external audio card.

How do I build and run qt/qt creator on Odroid XU3?

I want to run QT-Creator on my Odroid XU3 (ARM Architecture with Lubuntu 14.4) and build an application with it. I've read a lot of on the internet to figure out how to do this but haven't been successful yet. I tried to follow these instructions https://wiki.qt.io/ODROID-XU3 but didn't understand few things.
It states that I need to install some dependencies. I followed the given hyperlink on this site and installed the dependencies using following commands:
sudo apt-get build-dep qt5-default
sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev
libxrender-dev libxi-dev
When I searched for my qt5 folder, I could only find qt4 in user/share. What did I do wrong?
It states that I have to setup a toolchain and a sysroot. Do I have to do this only if I want to cross-compile, so compile on a different machine for my Odroid XU3, or also if I just want to compile on Odroid itself?
Let's say I want to setup the toolchain. According to this site I should copy the raspberry pi toolchain (or a different one) into the folder ~/Code/Odroid/toolchain. Problem is I don't see such a folder in my home directory on my Odroid. Should I mkdir one?
Let's also say I want to setup the sysroot, I don't get the part "One is to mount the ODROID-XU3's SD Card or eMMC on your development machine and either make a copy or a link to ~/Code/Odroid/sysroot". Am I right in assuming that I should copy the content of my SD-card to this folder on my developing machine?
Where should I build my QT now - on my development machine or Odroid? (sorry for that stupid question)
What If I want to make it simple and build everything on Adroid XU3 assuming that I have plenty of time and resources. I tried to first install qt and qt creator afterwards but as I started qtcreator, there was no compiler preconfigured and also the QuickView was missing. The terminal was also mentioning that the toolchain is missing. I struggled a lot in order to add these missing components but failed.
Thanks in advance!
to your second point: you can compile it on the Odroid or on your PC. But you should take a look at this: https://wiki.qt.io/Category:QtonPi it should be pretty the same on the Odroid.

OpenCV VideoWriter will not open

I'm having trouble instantiating and opening an OpenCV VideoWriter for recording video on a Raspberry Pi (Raspbian Weezy).
My project is written in C++, but I've written a minimal Python program that demonstrates the problem.
https://gist.github.com/chriscollins/11ff2f43852e1c93dae8
Both my C++ code and the Python code above run without problem on my Windows machine. Sometimes the writer does not open, but that's to be expected - I don't have all of the listed codecs installed (the list of codecs comes from the Open CV source), but a good number of them work correctly. However, on a Raspberry Pi, both the C++ code and the Python code fail with the VideoWriter never being opened. In the above Python code, writer.isOpened() returns false for every single codec, when run on a Raspberry Pi.
I've chowned the destination directory to the user I'm running the Python script as, and chmodded it to 777 so I don't believe that it is a permissions problem. I think it may be connected with how I've installed OpenCV or some of its dependencies, but I'm not sure how to rectify it.
The install process I've used is as follows:
Update firmware/packages via rpi-update, apt-get update and apt-get upgrade.
Install the following dependencies via apt-get:
libjpeg8
libjpeg8-dev
libjpeg8-dbg
libjpeg-progs
ffmpeg
libavcodec-dev
libavcodec53
libavformat53
libavformat-dev
libgstreamer0.10-0-dbg
libgstreamer0.10-0
libgstreamer0.10-dev
libxine1-ffmpeg
libxine-dev
libxine1-bin
libunicap2
libunicap2-dev
swig
libv4l-0
libv4l-dev
python-numpy
libpython2.6
python-dev
python2.6-dev
libgtk2.0-dev
Download and unzip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip to /root/opencv-2.4.9.
cd /root/opencv-2.4.9 and run cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF. Output of cmake is available at https://gist.github.com/chriscollins/d8060e03a6acd6d4336c
make and make install from the same directory.
Various other OpenCV functionality works correctly on the Raspberry Pi (in C++ or in Python) - e.g. viewing a webcam via VideoCapture, but I can't get the VideoWriter to work. I'm tempted to try installing FFMPEG from source instead of via apt-get, but as make takes 5+ hours to run on a Raspberry Pi, I was hoping I'd find the answer here, rather than proceeding with a trial and error approach!
Any advice on how to solve (or debug) this is appreciated.
EDIT: Added output of cmake command (https://gist.github.com/chriscollins/d8060e03a6acd6d4336c)
Looking at the output of make, I've found that it says NO to installation of gstreamer, which is a must for multimedia handling. This is the missing link.
Try
sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev .
This should solve your problem.
I've had similar issue on Mac OS 10.9 (Mavericks). I've solved it be reinstalling Opencv with ffmpeg support (i'm not sure whether i've reinstalled it after manually installing ffmpeg or whether brew handled it). On mac installing OpenCV with ffmpeg support was just one command - brew install opencv --with-ffmpeg (description of this option -> "Build with ffmpeg support"). I'm sure apt-get should have similar option.
You may also try this solution - http://www.ozbotz.org/opencv-installation-2-3-1/ It's quite old, but after small changes should work with current OpenCV version.

Advice regarding installing ARM toolchain on Ubuntu VM (64bit)

Trying to compile Linux kernel for arm platform on a Ubuntu virtual machine
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
It fails as follows
arm-none-linux-gnueabi-gcc: not found
Tried to install
$sudo apt-get install arm-none-linux-gnueabi-gcc
E: unable to locate package arm-none-linux-gnueabi-gcc
Where to find the correct package? how to include it in the system? (I found a couple of links on line that didn't work for me). It would be great if you could provide a correct solution or reference.
The Ubuntu package names are gcc-arm-linux-gnueabi/gcc-arm-linux-gnueabihf.
For building the kernel, which one you use does not make much difference. For building anything else, "gnueabihf" is the hard-float version. For any modern ARM processor (this statement excludes the Raspberry PI), this is the one you would want.
Download arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 from https://sourcery.mentor.com/GNUToolchain/
or https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?#template=lite
Get correct version of the arm-none-linux-gnueabi toolchain (i.e. targetting GNU/Linux rather than EABI).
untar it
tar xvf arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
open bashrc
vi .bashrc
at the end add below comand
export PATH=$PATH:{path to toolchain}arm-2013.05/bin
e.g export PATH=$PATH:/home/vinay/under_linux/arm-2013.05/bin
save it and quit the terminal.
then you can cross-compile without everytime export.
Also take of correct toolchain there are two toolchain available choose according to your requirement.
Cross compile error "arm-none-eabi-g++ cannot find entry symbol"

OpenCV keeps "uninstalling" itself (Linux)

Really annoying issue here. On Linux Mint OS. Every so often, I'll get this error when running OpenCV code:
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /home/ravi/Desktop/opencv/OpenCV-2.1.0/src/highgui/window.cpp, line 180
terminate called after throwing an instance of 'cv::Exception'
what(): /home/ravi/Desktop/opencv/OpenCV-2.1.0/src/highgui/window.cpp:180: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow
The way to fix this, I've found, it to do the following:
cd OpenCV/
cd build/
cmake ..
make
sudo make install
sudo ldconfig
<restart computer>
Then I'll come back, start running my OpenCV code again, and it'll be fine. But then a few hours later, or possibly between turning cpu on/off, I'll be back to the same stupid error!
Does anyone have any idea what's going on here and how I can prevent this? It's frustrating as hell.
It sounds like a general critical error in the program code. Is there a specific task that is done when the error occurs? You might want to use strace to get the output of the program as it runs or enable application memory dumps for the user you are running the process as. This would be passed to the developer for debugging and inspection.
I believe the problem was solved by paying attention to where my USB camera was actually located in /dev/. Giving a faulty path to the get video source functions causes this type of error; restarting my computer occasionally shifted which /dev/video# my device was attached to.
Please do ls /dev/vid* to find out if you're using the right video source!

Resources