[Home]

Summary:DAHLIN-00052: dahdi-linux does not compile out of the box
Reporter:Nik Soggia (nik soggia)Labels:
Date Opened:2008-10-03 04:41:07Date Closed:2008-10-06 11:46:24
Priority:MajorRegression?No
Status:Closed/CompleteComponents:dahdi (the module)
Versions:2.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:$ tar zxf dahdi-linux-2.0.0.tar.gz
$ cd dahdi-linux-2.0.0/
$ make DYNFS=1
make -C /lib/modules/2.6.26.5/build ARCH=i386 SUBDIRS=/tmp/dahdi-linux-2.0.0/drivers/dahdi DAHDI_INCLUDE=/tmp/dahdi-linux-2.0.0/include DAHDI_MODULES_EXTRA=" " HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
 CC [M]  /tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c: In function 'dahdi_ppp_xmit':
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: implicit declaration of function 'print_debug_writebuf'
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf' undeclared (first use in this function)
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: (Each undeclared identifier is reported only once
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: for each function it appears in.)
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c: In function 'dahdi_chan_ioctl':
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:5009: error: 'struct dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux-2.0.0/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2

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

dahdi-base.c will compile if:

I comment lines 1714 and 1810:
outbuf variable does not exist, and it cannot be passed to print_debug_writebuf(). the function is no-op unless debug is on, so I can live without it for now.

I change line 5009 (if I guessed correctly from kernel.h) from
chan->ec->echo_can_free(tec);
to
chan->ec_current->echo_can_free(tec);

Is the guess correct?
Comments:By: Sean Bright (seanbright) 2008-10-03 15:18:31

I believe a recent commit fixed this.  Could you try to install from subversion and see if that works for you and report back?

 $ svn co http://svn.digium.com/view/dahdi/linux/trunk/
 $ cd trunk
 $ make



By: Tzafrir Cohen (tzafrir) 2008-10-03 15:28:21

Specifically, this looks like a duplicate of issue DAHLIN-44 . Did you enable CONFIG_DAHDI_NET in drivers/dahdi/dahdi_config.h ?

By: Nik Soggia (nik soggia) 2008-10-06 03:08:03

Imho, this can't be a duplicate of issue 0013542, these errors complain about using three variables that really aren't declared (and not simply ifdef'ed out).
I think that, since you include "dahdi/kernel.h" using angle brackets and not double quotes, some old header file in /usr/include (note the leading slash) is taking precedence over the "local" one and since it still contains a dahdi_chan struct member called "ec", your compiler is happy.

Here I tried to compile a fresh svn co, then I defined CONFIG_DAHDI_NET in drivers/dahdi/dahdi_config.h and tried to compile again (no difference).

$ svn co http://svn.digium.com/view/dahdi/linux/trunk/
svn: PROPFIND request failed on '/view/dahdi/linux/trunk'
svn: PROPFIND of '/view/dahdi/linux/trunk': 301 Moved (http://svn.digium.com)
$ svn co http://svn.digium.com/svn/dahdi/linux/trunk dahdi-kernel
$ cd dahdi-linux
$ ls -la /usr/include/dahdi
ls: cannot access /usr/include/dahdi: No such file or directory
$ grep -F '*ec;' ./include/dahdi/*
$ grep -F '*ec_current;' ./include/dahdi/*
./include/dahdi/kernel.h: const struct dahdi_echocan *ec_current;
$ make | tee pass1
make -C /lib/modules/2.6.26.5/build ARCH=i386 SUBDIRS=/tmp/dahdi-linux/drivers/dahdi DAHDI_INCLUDE=/tmp/dahdi-linux/include DAHDI_MODULES_EXTRA=" " HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
 CC [M]  /tmp/dahdi-linux/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function 'dahdi_ppp_xmit':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: implicit declaration of function 'print_debug_writebuf'
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf' undeclared (first use in this function)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: (Each undeclared identifier is reported only once
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: for each function it appears in.)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function 'dahdi_chan_ioctl':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:5014: error: 'struct dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2
$ echo '#define CONFIG_DAHDI_NET 1' >>drivers/dahdi/dahdi_config.h
$ make | tee pass 2
make -C /lib/modules/2.6.26.5/build ARCH=i386 SUBDIRS=/tmp/dahdi-linux/drivers/dahdi DAHDI_INCLUDE=/tmp/dahdi-linux/include DAHDI_MODULES_EXTRA=" " HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
 CC [M]  /tmp/dahdi-linux/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function 'dahdi_ppp_xmit':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf' undeclared (first use in this function)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: (Each undeclared identifier is reported only once
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: for each function it appears in.)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function 'dahdi_chan_ioctl':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:5014: error: 'struct dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2
$ cd ..
$ wget -q http://downloads.digium.com/pub/telephony/dahdi-linux/dahdi-linux-2.0.0.tar.gz
$ tar zxf dahdi-linux-2.0.0.tar.gz
$ ls -la dahdi-linux*/drivers/dahdi/dahdi-base.c
-rw-r--r-- 1 dahdi users 228021 2008-09-28 08:43 dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c
-rw-r--r-- 1 dahdi users 228297 2008-10-06 09:29 dahdi-linux/drivers/dahdi/dahdi-base.c
$ diff -Naub dahdi-linux*/drivers/dahdi/dahdi-base.c
--- dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c 2008-09-28 08:43:51.000000000 +0200
+++ dahdi-linux/drivers/dahdi/dahdi-base.c 2008-10-06 09:29:23.000000000 +0200
@@ -1532,8 +1532,8 @@
if (res)
return res;

- fasthdlc_init(&ms->rxhdlc, (chan->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
- fasthdlc_init(&ms->txhdlc, (chan->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
+ fasthdlc_init(&ms->rxhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
+ fasthdlc_init(&ms->txhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
ms->infcs = PPP_INITFCS;

netif_start_queue(ztchan_to_dev(ms));
@@ -1637,7 +1637,7 @@
return kzalloc(sizeof(struct dahdi_hdlc), GFP_KERNEL);
}

-static inline print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff *skb,
+static inline void print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff *skb,
int oldbuf)
{
#ifdef CONFIG_DAHDI_DEBUG
@@ -1711,7 +1711,7 @@
dev->trans_start = jiffies;
stats->tx_packets++;
stats->tx_bytes += ss->writen[oldbuf];
- print_debug_writebuf(ss, skb, outbuf);
+ print_debug_writebuf(ss, skb, oldbuf);
retval = 0;
/* Free the SKB */
dev_kfree_skb_any(skb);
@@ -2042,7 +2042,7 @@

#ifdef CONFIG_DAHDI_DEBUG
module_printk(KERN_NOTICE, "dahdi_chan_write(unit: %d, res: %d, outwritebuf: %d amnt: %d\n",
-      unit, chan->res, chan->outwritebuf, amnt);
+      unit, res, chan->outwritebuf, amnt);
#endif
#if 0
  if ((unit == 24) || (unit == 48) || (unit == 16) || (unit == 47)) {
@@ -3675,7 +3675,7 @@
if (chan->span->chans[x]->master == chan) {
#ifdef CONFIG_DAHDI_DEBUG
module_printk(KERN_NOTICE, "Channel %s, slave to %s, last is %s, its next will be %d\n",
-      chan->span->chans[x].name, chan->name, last->name, x);
+      chan->span->chans[x]->name, chan->name, last->name, x);
#endif
last->nextslave = x;
last = chan->span->chans[x];
@@ -3966,7 +3966,7 @@
chans[ch.chan]->rxhooksig = DAHDI_RXSIG_INITIAL;
}
#ifdef CONFIG_DAHDI_DEBUG
- module_printk(KERN_NOTICE, "Configured channel %s, flags %04x, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig);
+ module_printk(KERN_NOTICE, "Configured channel %s, flags %04lx, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig);
#endif
spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);

@@ -4274,7 +4274,12 @@
return -EINVAL;
if (stack.bi.bufsize * stack.bi.numbufs > DAHDI_MAX_BUF_SPACE)
return -EINVAL;
- chan->rxbufpolicy = stack.bi.rxbufpolicy & 0x1;
+ /* It does not make sense to allow user mode to change the
+ * receive buffering policy.  DAHDI always provides received
+ * buffers to upper layers immediately.  Transmission is
+ * different since we might want to allow the kernel to build
+ * up a buffer in order to prevent underruns from the
+ * interrupt context. */
chan->txbufpolicy = stack.bi.txbufpolicy & 0x1;
if ((rv = dahdi_reallocbufs(chan,  stack.bi.bufsize, stack.bi.numbufs)))
return (rv);
@@ -7060,7 +7065,7 @@
if (skb && (ms->flags & DAHDI_FLAG_NETDEV))
#ifdef NEW_HDLC_INTERFACE
{
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
skb->mac.raw = skb->data;
#else
skb_reset_mac_header(skb);
$ ### END OF LONG NOTE ###

By: Sean Bright (seanbright) 2008-10-06 08:57:27

From your note:
<pre>
 $ svn co http://svn.digium.com/svn/dahdi/linux/trunk dahdi-kernel
 $ cd dahdi-linux
</pre>
Did you mean to 'cd dahdi-kernel' instead?

By: Nik Soggia (nik soggia) 2008-10-06 09:56:18

sorry, I copy-pasted the wrong line starting with "svn co...".
also, "tee pass1" and "tee pass2" weren't meant to show up in the report.

By: Sean Bright (seanbright) 2008-10-06 11:33:40

I just tried from a fresh checkout and it worked here.  Here is a full log of what I just tried, please try the same thing and see what happens for you:

<pre>
[sbright@elixer development]$ svn -q co http://svn.digium.com/svn/dahdi/linux/trunk dahdi-linux-trunk
[sbright@elixer development]$ cd dahdi-linux-trunk/
[sbright@elixer dahdi-linux-trunk]$ echo "#define CONFIG_DAHDI_NET 1" >> drivers/dahdi/dahdi_config.h
[sbright@elixer dahdi-linux-trunk]$ gmake
gmake -C /lib/modules/2.6.18-92.1.6.el5/build ARCH=i386 SUBDIRS=/home/sbright/development/dahdi-linux-trunk/drivers/dahdi DAHDI_INCLUDE=/home/sbright/development/dahdi-linux-trunk/include DAHDI_MODULES_EXTRA=" " HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
gmake[1]: Entering directory `/usr/src/kernels/2.6.18-92.1.6.el5-i686'
 CC [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi-base.o
 LD [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi.o
 CC [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi_dummy.o
 CC [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi_dynamic.o
 CC [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi_dynamic_loc.o
 CC [M]  /home/sbright/development/dahdi-linux-trunk/drivers/dahdi/dahdi_dynamic_eth.o
... etc, etc. ...
</pre>

(Yes, I know you have probably already done this, but please try one more time.)

If it still fails, then it's probably the version of the kernel you are running and will need to be addressed.

Thanks

By: Sean Bright (seanbright) 2008-10-06 11:38:38

Nevermind.  I think I see the problem.  Hold.

By: Digium Subversion (svnbot) 2008-10-06 11:45:17

Repository: dahdi
Revision: 5056

U   linux/trunk/drivers/dahdi/dahdi-base.c

------------------------------------------------------------------------
r5056 | seanbright | 2008-10-06 11:45:16 -0500 (Mon, 06 Oct 2008) | 8 lines

Fix a few compile errors that only show up when CONFIG_DAHDI_PPP is
defined.

(closes issue DAHLIN-52)
Reported by: Nik Soggia
Fix suggested by: Nik Soggia
Tested by: seanbright

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

http://svn.digium.com/view/dahdi?view=rev&revision=5056

By: Sean Bright (seanbright) 2008-10-06 11:46:24

Well, you were absolutely right.  I didn't realize you were compiling with CONFIG_DAHDI_PPP defined (you may not be doing it explicitly, it pulls from the kernel headers if it's there) which is why I wasn't seeing the problem here.  Thanks for the report and the suggested fixes!