[Home]

Summary:ASTERISK-13254: r166257 does not compiles reporting error at chan_iax2.c
Reporter:wetwired (wetwired)Labels:
Date Opened:2008-12-22 03:41:39.000-0600Date Closed:2008-12-23 09:41:54.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 14120.patch
Description:chan_iax2.c: In function ‘load_module’:
chan_iax2.c:11238: error: ‘DAHDI_FILE_PSEUDO’ undeclared (first use in this function)
chan_iax2.c:11238: error: (Each undeclared identifier is reported only once
chan_iax2.c:11238: error: for each function it appears in.)



****** ADDITIONAL INFORMATION ******

line 11238:
               timingfd = open(DAHDI_FILE_PSEUDO, O_RDWR);

I guess we must surround this line with something like #ifdef HAVE_DAHDI ... #endif because dahdi_compat.h not included in the beginning of the file

#if defined(HAVE_ZAPTEL) || defined (HAVE_DAHDI)
#include <sys/ioctl.h>
#include "asterisk/dahdi_compat.h"
#endif
Comments:By: wetwired (wetwired) 2008-12-22 03:59:56.000-0600

And this is not the only error:

asterisk.c: In function ‘main’:
asterisk.c:3040: ??????: ‘DAHDI_FILE_TIMER’ undeclared (first use in this function)
asterisk.c:3040: ??????: (Each undeclared identifier is reported only once
asterisk.c:3040: ??????: for each function it appears in.)
asterisk.c:3042: ??????????????: implicit declaration of function ‘ioctl’
asterisk.c:3042: ??????: ‘DAHDI_TIMERCONFIG’ undeclared (first use in this function)
asterisk.c:3043: ??????: expected ‘)’ before ‘DAHDI_NAME’
asterisk.c:3049: ??????: expected ‘)’ before ‘DAHDI_NAME’
asterisk.c:3057: ??????: expected ‘}’ before ‘DAHDI_NAME’

By: Mark Michelson (mmichelson) 2008-12-22 16:44:20.000-0600

If I understand the commit that introduced the DAHDI_FILE_PSEUDO and other such constants, the idea was to include dahdi_compat.h so that those constants would be defined. I also think that dahdi_compat.h is supposed to be unconditionally included.

The developer who committed that work is on vacation right now. I'll try uploading a patch to see if what I think is correct.

By: Mark Michelson (mmichelson) 2008-12-22 16:47:31.000-0600

Try 14120.patch and see if Asterisk compiles correctly now.

By: Mark Michelson (mmichelson) 2008-12-22 16:48:59.000-0600

I just noticed there's an unrelated change to chan_local in the patch I just uploaded. It won't hurt anything (and in fact that change will probably be committed sometime soon), but I thought I'd let you know in case you didn't want to apply it while testing this issue.

By: wetwired (wetwired) 2008-12-23 00:29:24.000-0600

Nope, patch didn't help. Now I have such errors:
chan_iax2.c: In function ‘load_module’:
chan_iax2.c:11238: error: ‘DAHDI_DIR_NAME’ undeclared (first use in this function)
chan_iax2.c:11238: error: (Each undeclared identifier is reported only once
chan_iax2.c:11238: error: for each function it appears in.)
chan_iax2.c:11238: error: expected ‘)’ before string constant
chan_iax2.c:11238: error: too few arguments to function ‘open’

And if I turn off IAX channel compiling:
asterisk.c: In function ‘main’:
asterisk.c:3040: error: ‘DAHDI_DIR_NAME’ undeclared (first use in this function)
asterisk.c:3040: error: (Each undeclared identifier is reported only once
asterisk.c:3040: error: for each function it appears in.)
asterisk.c:3040: error: expected ‘)’ before string constant
asterisk.c:3040: error: too few arguments to function ‘open’
asterisk.c:3042: warning: implicit declaration of function ‘ioctl’
asterisk.c:3042: error: ‘DAHDI_TIMERCONFIG’ undeclared (first use in this function)
asterisk.c:3043: error: expected ‘)’ before ‘DAHDI_NAME’
asterisk.c:3049: error: expected ‘)’ before ‘DAHDI_NAME’
asterisk.c:3057: error: expected ‘}’ before ‘DAHDI_NAME’

I think it caused by this logic in dahdi_compat:

#if defined(HAVE_DAHDI)

#include <dahdi/user.h>

#define DAHDI_DIR_NAME "/dev/dahdi"
#define DAHDI_NAME "DAHDI"

#elif defined(HAVE_ZAPTEL)

#include <zaptel/zaptel.h>

#define DAHDI_DIR_NAME "/dev/zap"
#define DAHDI_NAME "DAHDI"

/* Compiling against Zaptel instead of DAHDI */
...

so if we haven't defined HAVE_DAHDI and HAVE_ZAPTEL,  DAHDI_DIR_NAME would be also undefined. And then we use undefined DAHDI_DIR_NAME:

#define DAHDI_FILE_CHANNEL   DAHDI_DIR_NAME "/channel"
#define DAHDI_FILE_CTL       DAHDI_DIR_NAME "/ctl"
#define DAHDI_FILE_PSEUDO    DAHDI_DIR_NAME "/pseudo"
#define DAHDI_FILE_TIMER     DAHDI_DIR_NAME "/timer"
#define DAHDI_FILE_TRANSCODE DAHDI_DIR_NAME "/transcode"

By: Mark Michelson (mmichelson) 2008-12-23 09:09:43.000-0600

Ah, so it's clear that I did not understand the intent of rev 166257. I'm going to assign this to jpeeler for right now. I'll also take a closer look at things to see if I can understand that commit a bit better.

By: Digium Subversion (svnbot) 2008-12-23 09:35:50.000-0600

Repository: asterisk
Revision: 166592

U   branches/1.4/channels/chan_iax2.c
U   branches/1.4/main/asterisk.c

------------------------------------------------------------------------
r166592 | tilghman | 2008-12-23 09:35:50 -0600 (Tue, 23 Dec 2008) | 3 lines

Compile, even if both DAHDI and Zaptel are not installed.
(Closes issue ASTERISK-13254)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=166592

By: Digium Subversion (svnbot) 2008-12-23 09:41:54.000-0600

Repository: asterisk
Revision: 166601

_U  trunk/

------------------------------------------------------------------------
r166601 | tilghman | 2008-12-23 09:41:53 -0600 (Tue, 23 Dec 2008) | 9 lines

Blocked revisions 166592 via svnmerge

........
 r166592 | tilghman | 2008-12-23 09:35:38 -0600 (Tue, 23 Dec 2008) | 3 lines
 
 Compile, even if both DAHDI and Zaptel are not installed.
 (Closes issue ASTERISK-13254)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=166601