This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why cannot the build find the library?

Hi,

I am new to Linux. This is the first time I cross-build the ALSA project. The error message says it cannot find the library: either smixer-sbase.so or smixer-sbase.la. Please see the attached picture to find anything wrong of the settings.

It uses CCS6.1 on 14.04 Ubuntu. The C project is from TI Wiki page of ALSA example.

Thanks.

  • BTW, the first two include paths are strange to me. I don't find any way to delete it. Please see the red bar in the picture. Where does it come from?

    Thanks,

  • Hi Jeff,
    Why do you want to build this audio app through CCS IDE and not with command terminal ?
    Able to build and only getting problem while linking ?
    Or not able to initiate the build ?
    Just give the library name alone in "Libraries (-l)" setting and provide the location of the library in "Library search path (L)"
  • Probably you should point the cross-compiled library within the SDK. ~/ti-processor-sdk-linux-am335x-evm-01.00.00.03/linux-devkit/sysroots/cortexa8t2hf-vfp-neon-linux-gnueabi/usr/lib/alsa-lib/smixer
  • Thanks for your prompt reply.

    I follow the below link on my first cross compiling project, which works well.

    http://processors.wiki.ti.com/index.php/Processor_Linux_SDK_CCS_Installation_Guide#Cross-Compiling_the_Sources

    I didn't anticipate any problem with the new audio cross-compiling project.

    Has TI Wiki a cross-compiling tutorial on command line version?

    Or, is there a thread on the forum appropriate the audio (ALSA) build procedures with command line?

    Regards,

  • /*
     * helloworld.c
     *
     *  Created on: Aug 30, 2015
     *      Author: u64rj
     *      e2e.ti.com/.../291494
     */
    #include <stdio.h>
    #include <stdlib.h>
    #include <alsa/asoundlib.h>
    
    #define BUFF_SIZE 4096
    
    int main (int argc, char *argv[])
    {
      int err;
      short buf[BUFF_SIZE];
      int rate = 44100; /* Sample rate */
      unsigned int exact_rate; /* Sample rate returned by */
      /* Handle for the PCM device */
      snd_pcm_t *playback_handle;
      /* Playback stream */
      snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
      /* This structure contains information about the hardware and can be used to specify the configuration to be used for */
      /* the PCM stream. */
      snd_pcm_hw_params_t *hw_params;
    
      /* Name of the PCM device, like plughw:0,0 */
      /* The first number is the number of the soundcard, the second number is the number of the device. */
    
      static char *device = "default"; /* playback device */
      /* Open PCM. The last parameter of this function is the mode. */
      if ((err = snd_pcm_open (&playback_handle, device, stream, 0)) < 0) {
          fprintf (stderr, "cannot open audio device (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      /* Allocate the snd_pcm_hw_params_t structure on the stack. */
      if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
          fprintf (stderr, "cannot allocate hardware parameters (%s)\n", snd_strerror (err));
          exit (1);
      }
      /* Init hwparams with full configuration space */
      if ((err = snd_pcm_hw_params_any (playback_handle, hw_params)) < 0) {
          fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      /* Set access type. */
      if ((err = snd_pcm_hw_params_set_access (playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
          fprintf (stderr, "cannot set access type (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      /* Set sample format */
      if ((err = snd_pcm_hw_params_set_format (playback_handle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
          fprintf (stderr, "cannot set sample format (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      /* Set sample rate. If the exact rate is not supported by the hardware, use nearest possible rate. */
      exact_rate = rate;
      if ((err = snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, &exact_rate, 0)) < 0) {
          fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      if (rate != exact_rate) {
          fprintf(stderr, "The rate %d Hz is not supported by your hardware.\n ==> Using %d Hz instead.\n", rate, exact_rate);
      }
    
      /* Set number of channels */
      if ((err = snd_pcm_hw_params_set_channels (playback_handle, hw_params, 2)) < 0) {
          fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err));
          exit (1);
      }
      /* Apply HW parameter settings to PCM device and prepare device. */
      if ((err = snd_pcm_hw_params (playback_handle, hw_params)) < 0) {
          fprintf (stderr, "cannot set parameters (%s)\n", snd_strerror (err));
          exit (1);
      }
    
      snd_pcm_hw_params_free (hw_params);
    
      if ((err = snd_pcm_prepare (playback_handle)) < 0) {
          fprintf (stderr, "cannot prepare audio interface for use (%s)\n", snd_strerror (err));
          exit (1);
      }
      /* Write some junk data to produce sound. */
      if ((err = snd_pcm_writei (playback_handle, buf, BUFF_SIZE/2)) != BUFF_SIZE/2) {
          fprintf (stderr, "write to audio interface failed (%s)\n", snd_strerror (err));
          exit (1);
      } else {
          fprintf (stdout, "snd_pcm_writei successful\n");
      }
      snd_pcm_close (playback_handle);
    }
    
    

    There are three libraries: smixer-sbase.so, smixer-hda.so and smixer-ac97.so. Does either one of the .so works for a simple ALSA application project, which is based on web link:

    Thanks,

  • Hi,

    Try to cross compile this ALSA application.

    linux-host$ arm-linux-gnueabihf-gcc -o hello_alsa helloworld.c -lasound


    You would get hello_alsa binary and run this on your target board.

  • Your line does solve the problem, even in CCS IDE it is OK too. The mysterious thing is that asound is under proc/, not like the new ALSA generated library. Could you tell me:

    1. asound is a library or not, although it is set in IDE and command line as a library.

    2. asound is generated by the ALSA 1.0.29 I just download?

    Thanks,