[asterisk-dev] Asterisk module compile

Matthew Jordan mjordan at digium.com
Sun Jul 8 14:29:31 CDT 2012



----- Original Message ----- 

> From: "Usman Raza" <usman.r123 at gmail.com>
> To: "Asterisk Developers Mailing List"
> <asterisk-dev at lists.digium.com>
> Sent: Sunday, July 8, 2012 12:28:54 PM
> Subject: Re: [asterisk-dev] Asterisk module compile

> I was unable to load the module due to undefined symbol error on
> functions i have defined in ringbuffer.h. Following the asterisk
> build system now, could you tell me about AST_EXT_LIB_CHECK
> arguments in configure.ac file? Thanks.

I'm not entirely sure what you mean by "tell me about AST_EXT_LIB_CHECK".  I'll
try to explain it as best I can using the ALSA example that the wiki page refers
to, but it may not be applicable to your problem.

If we look at a generated makeopts, we may find the following for ALSA:

ALSA_INCLUDE= 
ALSA_LIB= -lasound -lm -ldl

Those two particular definitions come from makeopts.in, which - if you followed
the wiki - were added previously.  But where did the library checks come from?

This is where AST_EXT_LIB_CHECK comes into play.  Going to configure.ac and
searching for ALSA, you'll find the following:

AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])

AST_EXT_LIB_CHECK specifies how the configure script will determine if the
library exists, and, if it does, what additional libraries will be linked during
compilation.  Continuing with the ALSA example, we have the following:

ALSA: The prefix specifier that ties the information in the various build system
      files together
asound: The actual name of the external library to look for
snd_spcm_init: A symbol to look for to verify that the library located is
               correct.  In this case, during execution of the configure script,
               the symbol 'snd_spcm_init' will be looked for in the library
               'asound'.  If the symbol does not exist, the external library
               check will fail.
alsa/asoundlib.h: The header files for the library
-lm -ldl: Optional additional linking flags passed in when the asound library is
          linked

So that explains where ALSA_LIB came from - its the external library to be
linked (asound), plus the extra linking flags specified in AST_EXT_LIB_CHECK
(-lm -ldl).  If you open a generated configure script, you can walk through
exactly how it uses these symbols to perform the external library check for the
Advanced Linux Sound Architecture.

Keep in mind that modules with a dependency (in this case, chan_alsa) should
automatically pick up the required compilation include/linking flags when they
are built, by virtue of the generated Menuselect dependency information.  You
obviously need to specify this in the MODULEINFO section for that module, as
the wiki page notes.

I hope this information is useful for you.  Since you haven't asked specific
questions or provided error messages to go on, it very well may not be what you
were looking for.  In the future, when asking questions on the mailing list,
please try to be as specific as possible, including as much information as
possible.  Otherwise, you may not get the answers you want, if you get an
answer at all.

Thanks,

--
Matthew Jordan
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list