dahdi-linux icon indicating copy to clipboard operation
dahdi-linux copied to clipboard

In Rocky Linux 9.2 got "Fatal error: stdbool.h: No such file or directory"

Open rodolfojcj opened this issue 2 years ago • 4 comments

When using the DAHDI linux complete 3.2.0 tar.gz file, trying to compile on Rocky Linux 9.2 fails with error messages like these:

make all
make -C linux all
make[1]: Entering directory '/usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux'
make -C drivers/dahdi/firmware firmware-loaders
make[2]: Entering directory '/usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/firmware'
make[2]: Leaving directory '/usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/firmware'
make -C /lib/modules/5.14.0-284.25.1.el9_2.x86_64/build M=/usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi DAHDI_INCLUDE=/usr/src/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-284.25.1.el9_2.x86_64'
  CC [M] /usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.o
/usr/src/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:321: /usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp/base.o] Error 1
make[3]: *** [scripts/Makefile.build:607: /usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi/wct4xxp] Error 2
make[2]: *** [Makefile:1923: /usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux/drivers/dahdi] Error 2
make[2]: Leaving directory '/usr/src/kernels/5.14.0-284.25.1.el9_2.x86_64'
make[1]: *** [Makefile:74: modules] Error 2
make[1]: Leaving directory '/usr/src/dahdi-linux-complete-3.2.0+3.2.0/linux'
make: *** [Makefile:9: all] Error 2
'make all' failed with 512.

The running Linux kernel version looks like this:

Linux localhost.localdomain 5.14.0-284.25.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 2 14:53:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

rodolfojcj avatar Sep 24 '23 23:09 rodolfojcj

Don't use the tarballs, those are all woefully obsolete and not up to date.

I'd recommend either installing from Git (master branch), and if that still doesn't work, you could try installing using PhreakScript: https://github.com/InterLinked1/phreakscript

InterLinked1 avatar Sep 24 '23 23:09 InterLinked1

I have the hypothesis that Red Hat backported some Linux kernel changes from upstream version 5.16 to its long supported RHEL 5.14 version, which means that it has some functionalities of 5.16, like not including the stdbool.h file when compiling Linux kernel modules, but the DAHDI 3.2.0+3.2.0 building process "thinks" that the running kernel is 5.14 and will insist in using stdbool.h.

That hypothesis is based on these:

  • RHEL backporting approach: https://www.redhat.com/en/blog/what-backporting-and-how-does-it-apply-rhel-and-other-red-hat-products

  • This comment:

    This is due to an intentional change in Linux 5.16 removing user-space headers from the kernel include path:
    <https://git.kernel.org/linus/04e85bbf71c9072dcf0ad9a7150495d72461105c>.
    Kernel code must use <linux/types.h> instead of <stdbool.h>
    

    found at https://groups.google.com/g/linux.debian.bugs.dist/c/NQP3JCZN3qc and its related links https://17797152399858172281.googlegroups.com/attach/4ddc51bad3099/dahdi-do-not-use-stdbool.h-in-kernel-modules.patch?part=0.1&view=1&vt=ANaJVrEuBiYFknoIoIGYSMOsAuIxwr1nvzttLqLid73ViGt9_e4PKyGzqF2xJlipN5ClZEWf8EQw-EDwnXLzQ15Sc0PNfcStM8dUMXGqNnwlZo_Nheo9NMQ , https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=04e85bbf71c9072dcf0ad9a7150495d72461105c , https://github.com/torvalds/linux/commit/6060a6cb05e3223146a3c30a1977f136da6c85e7 and https://github.com/torvalds/linux/commit/04e85bbf71c9072dcf0ad9a7150495d72461105c

  • The RHEL release dates published at https://access.redhat.com/articles/3078 shows:

    Red Hat Enterprise Linux 9
    Release General Availability Date redhat-release Errata Date* Kernel Version
    RHEL 9.2 2023-05-10 2023-05-09 RHBA-2023:2455 5.14.0-284.11.1.el9_2
    RHEL 9.1 2022-11-15 2022-11-15 RHBA-2022:8264 5.14.0-162.6.1.el9_1
    RHEL 9.0 2022-05-17 2022-05-17 RHBA-2022:3893 5.14.0-70.13.1.el9_0
    

From them I found this Rocky Linux 9.0, 9.1 and 9.2 kernel-devel packages:

  https://download.rockylinux.org/vault/rocky/9.0/devel/x86_64/os/Packages/k/kernel-devel-5.14.0-70.30.1.el9_0.x86_64.rpm
  https://download.rockylinux.org/vault/rocky/9.1/devel/x86_64/os/Packages/k/kernel-devel-5.14.0-162.23.1.el9_1.x86_64.rpm
  https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/k/kernel-devel-5.14.0-284.25.1.el9_2.x86_64.rpm # this is 9.2 as of August 2023

I reviewed their contents, observing that for RL 9.0 its file /usr/src/kernels/5.14.0-70.30.1.el9_0.x86_64/Makefile does not have the Linux kernel change mentioned before, but RL 9.1 file /usr/src/kernels/5.14.0-162.23.1.el9_1.x86_64/Makefile and RL 9.2 file /usr/src/kernels/5.14.0-284.25.1.el9_2.x86_64/Makefile have it. Given this difference, I pressume that compiling DAHDI 3.2.0 on RL 9.0 will not give the stdbool.h related error.

rodolfojcj avatar Sep 24 '23 23:09 rodolfojcj

I have the hypothesis that Red Hat backported some Linux kernel changes from upstream version 5.16 to its long supported RHEL 5.14 version, which means that it has some functionalities of 5.16, like not including the stdbool.h file when compiling Linux kernel modules, but the DAHDI 3.2.0+3.2.0 building process "thinks" that the running kernel is 5.14 and will insist in using stdbool.h.

This was already fixed for 5.16+ kernels[1], I just don't think there's a tarball that includes this change, hence my previous comment.

The check is simply #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) so it'd be odd if anything funky was going on.

[1] https://github.com/asterisk/dahdi-linux/commit/ca23e736942c53a621dad1bbb57dc4c966d6a84a

InterLinked1 avatar Sep 24 '23 23:09 InterLinked1

The attached file dahdi-linux-issue-36-fix-24sept2023.zip has a possible fix to this issue.

I tested it with:

  • Ubuntu 23.04, kernel 6.2.0-20-generic
  • Ubuntu 22.10, kernel 5.19.0-43-generic
  • Ubuntu 22.04, kernel 5.15.0-73-generic
  • Ubuntu 20.04, kernel 5.4.0-150-generic
  • Ubuntu 18.04, kernel 4.15.0-212-generic
  • Ubuntu 16.04, kernel 4.4.0-210-generic
  • Debian 12, kernel 6.1.0-10-amd64
  • Debian 11, kernel 5.10.0-23-amd64
  • Debian 10, kernel 4.19.0-24-amd64
  • CentOS 7.9.2009 3.10.0-1160.95.1.el7.x86_64
  • Rocky Linux 9.2, kernel 5.14.0-284.25.1.el9_2.x86_64
  • Rocky Linux 8.8, kernel 4.18.0-477.21.1.el8_8.x86_64

In all those cases the compilation is successful.

Thanks in advance for any developer of this project that may review and possibly apply this fix for the master branch.

rodolfojcj avatar Sep 24 '23 23:09 rodolfojcj

@push143smart Looks like this was addressed in https://github.com/asterisk/dahdi-linux/commit/08fda500eda8893fddb269e07e3b1eaafd0a684b and this issue can now be closed.

InterLinked1 avatar Sep 18 '24 12:09 InterLinked1