Asterisk Installation - DAHDI make error

Greetings.

I am trying to install and Build DAHDI during Asterisk installation on Rocky9.

I have downloaded the binary file via this command.

wget https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

Then extracted the tarball with this command.

tar -xvzf dahdi-linux-complete-current.tar.gz

Then changed to the dahdi directory

 cd dahdi-linux-complete-3.2.0+3.2.0/

But when i make the file as root user, i get the error below.

$ sudo make
[sudo] password for jil:
make -C linux all
make[1]: Entering directory '/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux'
make -C drivers/dahdi/firmware firmware-loaders
make[2]: Entering directory '/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/firmware'
make[2]: Leaving directory '/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/firmware'
make -C /lib/modules/5.14.0-162.23.1.el9_1.x86_64/build M=/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi DAHDI_INCLUDE=/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/include DAHDI_MODULES_EXTRA=" " HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[2]: Entering directory '/usr/src/kernels/5.14.0-162.23.1.el9_1.x86_64'
  CC [M]  /home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.o
/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.c:49:10: fatal error: stdbool.h: No such file or directory
   **49 | #include <stdbool.h>**
      |          ^~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:295: /home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.o] Error 1
make[3]: *** [scripts/Makefile.build:574: /home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp] Error 2
make[2]: *** [Makefile:1915: /home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi] Error 2
make[2]: Leaving directory '/usr/src/kernels/5.14.0-162.23.1.el9_1.x86_64'
make[1]: *** [Makefile:74: modules] Error 2
make[1]: Leaving directory '/home/jil/Downloads/dahdi-linux-complete-3.2.0+3.2.0/linux'
make: *** [Makefile:9: all] Error 2

I have tried to do a simple google search but i seem not to find a way out.

Please assist on what i might be missing.

The log states you are missing this header. Install the appropriate package that has this header and this error will go away.

I have not been lucky with this.

Hello Sir.

I am still trying to crack this one.

Please help me get over this. I have tried a few things.

dnf provides */stdbool.h

This command gives a huge list.

$ dnf list *dahdi*
Last metadata expiration check: 0:57:27 ago on Thu 18 May 2023 09:56:38 PM EAT.
Installed Packages
asterisk-dahdi.x86_64                     18.12.1-1.el9.1                  @epel
dahdi-tools.x86_64                        2.11.1-28.el9                    @epel
dahdi-tools-devel.x86_64                  2.11.1-28.el9                    @epel
dahdi-tools-libs.x86_64                   2.11.1-28.el9                    @epel

Am stuck at this point. Please teach how am to continue from there.
3. If i try to edit the file:

$ sudo vim /usr/local/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.c

Contents of the file

#include <linux/crc32.h>
#include <linux/slab.h>

/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#include <asm/types.h>
#else
#include <stdbool.h>
#endif

#include <dahdi/kernel.h>

#include "wct4xxp.h"
#include "vpm450m.h"

/* Support first generation cards? */
#define SUPPORT_GEN1 

I locate the

#include <stdbool.h>

But i dont know how to treat this. Please show me.

Hi,

A Google search found this:

Suggests there may be a bug the in the current release of dahdi, the link does include some work a rounds though.

Regards Tom.

Hello tjdoyle.

Let me have a look and revert.

Thank you.

I have tried it out. Getting the same error.

Not sure what else am to do.

Let me see if Asterisk has a forum I raise it with them.

The answer is to change the name. From stdbool.h to " linux/types.h " in each of the files with that name.

Hi

I confirmed rppmbuild and run dahdi ok only on Rocky9.2 as kernel-5.14.0-284.11.1.

Patching

Whole sources should be change to #include <linux/types.h> from #include <stdbool.h> as below.
diff -Nurdp dahdi-linux-3.2.0/drivers/dahdi/dahdi-base.c dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/dahdi-base.c
— dahdi-linux-3.2.0/drivers/dahdi/dahdi-base.c 2023-08-15 21:56:09.000000000 +0900
+++ dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/dahdi-base.c 2023-09-19 17:06:50.678162352 +0900
@@ -86,7 +86,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#include <asm/types.h>
#else
-#include <stdbool.h>
+#include <linux/types.h>
#endif

#if defined(EMPULSE) && defined(EMFLASH)
diff -Nurdp dahdi-linux-3.2.0/drivers/dahdi/voicebus/vpmoct.h dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/voicebus/vpmoct.h
— dahdi-linux-3.2.0/drivers/dahdi/voicebus/vpmoct.h 2023-08-15 21:56:09.000000000 +0900
+++ dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/voicebus/vpmoct.h 2023-09-19 17:06:50.678162352 +0900
@@ -34,7 +34,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#include <asm/types.h>
#else
-#include <stdbool.h>
+#include <linux/types.h>
#endif

diff -Nurdp dahdi-linux-3.2.0/drivers/dahdi/wctc4xxp/base.c dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/wctc4xxp/base.c
— dahdi-linux-3.2.0/drivers/dahdi/wctc4xxp/base.c 2023-08-15 21:56:09.000000000 +0900
+++ dahdi-linux-3.2.0_kernel-5.14.0-284.11.1.el9_2/drivers/dahdi/wctc4xxp/base.c 2023-09-19 17:06:50.681162256 +0900
@@ -44,7 +44,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#include <asm/types.h>
#else
-#include <stdbool.h>
+#include <linux/types.h>
#endif

netif_napi_add needs change the param.
@@ -658,7 +658,7 @@ wctc4xxp_net_register(struct wcdte *wc)
netdev->promiscuity = 0;
netdev->flags |= IFF_NOARP;

  • netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll, 64);
  • netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll);

    res = register_netdev(netdev);
    if (res) {

I hope this helps for you.

nolix

Just built DAHDI under Rocky 9.3, kernel 5.14.0. I experienced both
of the problems mentioned here but in more files than those noted.
Also, I experienced the problem (noted elsewhere) with PDE_DATA.
To summarize, here are all of the fixes that I made to the DAHDI
source to get the build to work:

The kernel build files are missing “stdbool.h” so all of the DAHDI
sources that include it must be changed to include “linux/types.h”
instead. Begin by finding them all. Then hack them with your
favorite text editor:

find . -type f -exec grep stdbool.h -H {} ;

linux/drivers/dahdi/wcaxx-base.c:#include <stdbool.h>
linux/drivers/dahdi/wctdm24xxp/base.c:#include <stdbool.h>
linux/drivers/dahdi/wctc4xxp/base.c:#include <stdbool.h>
linux/drivers/dahdi/wcte13xp-base.c:#include <stdbool.h>
linux/drivers/dahdi/wcxb.c:#include <stdbool.h>
linux/drivers/dahdi/dahdi-base.c:#include <stdbool.h>
linux/drivers/dahdi/wcxb_spi.h:#include <stdbool.h>
linux/drivers/dahdi/wcte43x-base.c:#include <stdbool.h>
linux/drivers/dahdi/voicebus/vpmoct.h:#include <stdbool.h>
linux/drivers/dahdi/wct4xxp/base.c:#include <stdbool.h>
linux/drivers/dahdi/wct4xxp/vpm450m.c:#include <stdbool.h>

The patch is to include “linux/types.h” for kernel versions between
5.14.0 and 5.15.x:

  #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
  #include <asm/types.h>
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
+ #include <linux/types.h>
  #else
  #include <stdbool.h>
  #endif

The prototype for “netif_napi_add” has changed to use only three
arguments instead of four so all of the DAHDI sources that call this
function must be changed. Begin by finding them all. Then hack
them with your favorite text editor:

find . -type f -exec grep netif_napi_add -H {} ;

linux/drivers/dahdi/wctc4xxp/base.c:#netif_napi_add(netdev, …

The patch is to remove the fourth parameter in the function call:

  netdev->promiscuity = 0;
  netdev->flags |= IFF_NOARP;

- netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll, 64);
+ netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll);

  res = register_netdev(netdev);
  if (res) {

The “PDE_DATA()” function has been renamed “pde_data()” so,
everywhere that it is called, you could rename it. But, there is an
easier solution. This function was formerly inlined in the local header
file linux/include/dahdi/kernel.h for earlier kernel versions. Then, at
some point it seems to have been subsumed by another component.
Following that, someone seems to have decided that it should be
arbitrarily renamed from all caps to all lowercase. When this
stopped DAHDI from compiling, someone added a fix (an inline
function to remap the call to the lower case function) for kernel
versions 5.17.0 and up. My guess is that they did not check lower
kernel versions, so 5.14.0 was missed. The fix is to change the
criteria for the “#if”:

linux/include/dahdi/kernel.h

  #endif /* 4.15.0 */
  #endif /* 5.6 */

- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
  #ifdef CONFIG_PROC_FS
  #define PDE_DATA(i)     pde_data(i)
  #endif
  #endif

For me, these changes were sufficient to make and install DAHDI.

This is it. Thank you so much. all good now.

Hey, sorry to pop up on this thread, instead of creating a new one; but, I’m running into this problem (I think its the same) with this on Rocky Linux 8.9

Linux rocky 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 10 22:58:54 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I have to run this kernel version because my hardware is older and can’t run Rocky Linux 9. It won’t even boot if I use a newer kernel.

The card I am using is:

02:08.0 Ethernet controller: Digium, Inc. Wildcard AEX410 4-port analog card (PCI-Express) (rev 11)


I run:

git clone git@github.com:asterisk/dahdi-linux.git
cd dahdi-linux
make 2>&1 | tee make_log.txt

Here are the results.

dahdi-linux commit d885c82 build log

Is there any change for a patch that will let it compile on my system?


I implemented the suggested changes from the post above. It seems it now builds. As to it actually working, I have yet to test and verify it. Here is the code I changed.

GitHub - cjemorton/dahdi-linux at rocky89-mods

I am unsure if this is a “Correct” way to implement these changes, however make did complete. So as to getting a “fix” merged back into the source. A more experienced coder should probably review the changes.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.