2

I am trying to create a PortAudio application on Debian Wheezy 64 bit GNU/Linux. I read the documentation on how to do add the library and it compiles without errors.

Now when I want to initialize PortAudio using this script:

#include <stdio.h>
#include "portaudio.h"

int main(){
    PaError err = Pa_Initialize();
    if(err != paNoError){
        fprintf(stderr, "Pa_Initialize error: %s\n", Pa_GetErrorText(err));
        return 1;
    }
    return 0;
}

I get the following output: Pa_Initialize error: Host error.

When I try to run Audacity, which is also based on PortAudio I get the following errors:

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
audacity: symbol lookup error: audacity: undefined symbol: Pa_GetStreamHostApiType

And when I try to call this function:

const PaHostErrorInfo* hostError;
hostError = Pa_GetLastHostErrorInfo();

I get the following error: Undefined reference to 'Pa_GetLastHostErrorInfo'

How can I initialize PortAudio the correct way, and what is wrong with my host; does PortAudio requires me to do something with PulseAudio?

I already tried the bottom solution of this topic http://ubuntuforums.org/showthread.php?t=1756822, because I thought it had something to do with the configuration of the library files. But that also didn't work and it doesn't change the error.

tversteeg
  • 4,717
  • 10
  • 42
  • 77
  • have you gone through [Pa_Initialize documentation first](http://audacity.sourcearchive.com/documentation/1.3.12-16/pa__front_8c_a0db317604e916e8bd6098e60e6237221.html#a0db317604e916e8bd6098e60e6237221) – Grijesh Chauhan Mar 09 '13 at 19:38
  • Yes I did but it didn't help me solve the problem, it doesn't clarify the error. – tversteeg Mar 09 '13 at 19:40
  • Reading `symbol lookup error: audacity: undefined symbol̀, it sounds like there is a problem with library files - like if audacity was compiled with PortAudio headers which don't match the .so files in /usr/lib (maybe a different version ?)... – neodelphi Mar 09 '13 at 20:08
  • @Thomas Sorry I wish I could help you but I have no idea I search in documentation but impossible to me...You can mail them. – Grijesh Chauhan Mar 09 '13 at 20:08
  • @GrijeshChauhan No problem, I will mail them if I can't find an answer myself. @neodelphi It indeed sounds like a library issue, but I used the default Debian `apt-get install` method to install Audacity so any errors in incompatible versions should be raised that way. – tversteeg Mar 09 '13 at 20:11

2 Answers2

2

The audacty error looks like something is misconfigured. To get to the bottom of your issue, try calling this function to find out what the host error was:

const PaHostErrorInfo* Pa_GetLastHostErrorInfo ( void )

http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html#aad573f208b60577f21d2777a7c5054e0

Bjorn Roche
  • 11,279
  • 6
  • 36
  • 58
  • When I try to call this: `const PaHostErrorInfo* hostError = Pa_GetLastHostErrorInfo();` I get the following error: `Undefined reference to 'Pa_GetLastHostErrorInfo'`, it indeed looks like something is mis-configured. – tversteeg Mar 10 '13 at 10:59
  • Looks like a dynamic linking issue both here and with audacity. Like it can't find the PortAudio libraries. – Bjorn Roche Mar 10 '13 at 16:32
  • Well yeah you would think that but I can call the function as described in my question. – tversteeg Mar 10 '13 at 17:31
1

After some time researching the problem I gave up, and tried reinstalling PortAudio from source by removing it and building it again. And thankfully this time it worked!

So I guess it was a bug by that got resolved in the new version.

tversteeg
  • 4,717
  • 10
  • 42
  • 77