Can not compile DAHDI 3.1.0 or 3.0.0 or 2.11.11 under Ubuntu 20.04

kernel is 5.4.0-70-generic

For 3.1.0 I get

In file included from /usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux/drivers/da                                hdi/oct612x/oct612x-user.c:28:
/usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux/include/dahdi/kernel.h:62:10: fa
tal error: linux/pci-aspm.h: No such file or directory
   62 | #include <linux/pci-aspm.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:271: /usr/src/dahdi-linux-complete-3.1.0+3.                                1.0/linux/drivers/dahdi/oct612x/oct612x-user.o] Error 1
make[3]: *** [scripts/Makefile.build:518: /usr/src/dahdi-linux-complete-3.1.0+3.                                1

For 3.0.0-rc1 I get

make[2]: Entering directory '/usr/src/linux-headers-5.4.0-70-generic'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig
make[3]: *** No rule to make target 'arch/x86/tools/relocs_32.c', needed by 'arch/x86/tools/relocs_32.o'.  Stop.
make[2]: *** [arch/x86/Makefile:232: archscripts] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.4.0-70-generic'
make[1]: *** [Makefile:74: modules] Error 2
make[1]: Leaving directory '/usr/src/dahdi-linux-complete-3.0.0-rc1+3.0.0-rc1/linux'
make: *** [Makefile:9: all] Error 2
root@asterisk:/usr/src/dahdi-linux-complete-3.0.0-rc1+3.0.0-rc1#

For 2.11.11 I get

make[2]: Entering directory '/usr/src/linux-headers-5.4.0-70-generic'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig
make[3]: *** No rule to make target 'arch/x86/tools/relocs_32.c', needed by 'arch/x86/tools/relocs_32.o'.  Stop.
make[2]: *** [arch/x86/Makefile:232: archscripts] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.4.0-70-generic'
make[1]: *** [Makefile:74: modules] Error 2
make[1]: Leaving directory '/usr/src/dahdi-linux-complete-2.11.1+2.11.1/linux'
make: *** [Makefile:9: all] Error 2
root@asterisk:/usr/src/dahdi-linux-complete-2.11.1+2.11.1#

Built for what architecture? (Two of your errors seem to relate to i386 support.)

Google suggests that the following will help, and that is likely still the case, as the article postdates the tar ball for 3.1.0:

It is an old Intel Quad Q6600. The same box ran Asterisk 11 before. It is a home machine forgotten in a shelf, Until the hd broke.

I assume that is amd64 architecture, so you are doing a 64 bit build and probably don’t need the 32 bit support. I assume 32 bit support was ended between 3.0.0 and 3.1.0.

yes, no need for 32-bit. It is a home machine for personal use, just a TDM800 card and some IAX clients and :slight_smile: 2 SIP phones.

Ran ok under Centos 7 but until now I could not get it to run on current sw.

Using dahdi 3.1.0-12 download from github it builds ok.

But dahdi_genconf says


root@asterisk:/etc/dahdi# dahdi_genconf
Empty configuration -- no spans
Empty configuration -- no spans
Empty configuration -- no spans

But on the same machine Centos7 and dahdi 2.11.1 shows

[root@asterisk dahdi]# cat assigned-spans.conf
#
# Autogenerated by /usr/sbin/dahdi_span_assignments on Fri Mar 26 11:52:32 -03 2021
# Map devices + local spans to span + base channel number

# Device: [] @PCI_Bus_04_Slot_02 /sys/devices/pci0000:00/0000:00:1e.0/0000:04:01.0/pci:0000:04:01.0
/sys/devices/pci0000:00/0000:00:1e.0/0000:04:01.0/pci:0000:04:01.0 1:1:1
```

Ubuntu 20.04 with DAHDI 3.1.0 shows the TDM800 using  dahdi_hardware
but dahdi_genconf does not see the TDM800

BTOH Centos7 on boot sees the board, loads asterisk and we can use 2 of the 4 FXS ports

```
   18.598401] dahdi: loading out-of-tree module taints kernel.
[   18.599727] dahdi: module verification failed: signature and/or required key missing - tainting kernel
[   18.602138] dahdi: Version: 2.11.1
[   18.602943] dahdi: Telephony Interface Registered on major 196
[   20.712118] wctdm24xxp 0000:04:01.0: ProSLIC on module 4 failed to powerup within 502 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM CARD??
[   20.712127] wctdm24xxp 0000:04:01.0: Unable to do INITIAL ProSLIC powerup on module 4
[   21.408113] wctdm24xxp 0000:04:01.0: ProSLIC on module 4 failed to powerup within 501 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM CARD??
[   21.408122] wctdm24xxp 0000:04:01.0: Unable to do INITIAL ProSLIC powerup on module 4
[   21.408126] wctdm24xxp 0000:04:01.0: Port 5: FAILED FXS (FCC)
[   22.125107] wctdm24xxp 0000:04:01.0: ProSLIC on module 5 failed to powerup within 504 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM CARD??
[   22.125116] wctdm24xxp 0000:04:01.0: Unable to do INITIAL ProSLIC powerup on module 5
[   22.820099] wctdm24xxp 0000:04:01.0: ProSLIC on module 5 failed to powerup within 501 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM CARD??
[   22.820107] wctdm24xxp 0000:04:01.0: Unable to do INITIAL ProSLIC powerup on module 5
[   22.820111] wctdm24xxp 0000:04:01.0: Port 6: FAILED FXS (FCC)
[   25.255115] wctdm24xxp 0000:04:01.0: Port 1: Installed -- AUTO FXO (FCC mode)
[   25.255121] wctdm24xxp 0000:04:01.0: Port 2: Installed -- AUTO FXO (FCC mode)
[   25.255125] wctdm24xxp 0000:04:01.0: Port 3: Installed -- AUTO FXO (FCC mode)
[   25.255129] wctdm24xxp 0000:04:01.0: Port 4: Installed -- AUTO FXO (FCC mode)
[   25.255133] wctdm24xxp 0000:04:01.0: Port 5: Installed -- AUTO FXS/DPO
[   25.255136] wctdm24xxp 0000:04:01.0: Port 6: Installed -- AUTO FXS/DPO
[   25.255140] wctdm24xxp 0000:04:01.0: Port 7: Installed -- AUTO FXS/DPO
[   25.255144] wctdm24xxp 0000:04:01.0: Port 8: Installed -- AUTO FXS/DPO
[   25.255912] wctdm24xxp 0000:04:01.0: Found a Wildcard TDM: Wildcard TDM800P (0 BRI spans, 8 analog channels)
[   25.451090] dahdi_devices pci:0000:04:01.0: local span 1 is already assigned span 1
[   25.517486] dahdi_echocan_mg2: Registered echo canceler 'MG2'
```

I am not sure on how to proceed.