asterisk / dahdi-tools

This is the official dahdi-tools repository. All issues and PR should be raised here.
GNU General Public License v2.0
16 stars 30 forks source link

In Rocky Linux 9.2 got error "unknown type name ‘bool’" #17

Open rodolfojcj opened 11 months ago

rodolfojcj commented 11 months ago

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

dahdi_cfg.c:148:8: error: unknown type name ‘bool’
  148 | static bool _are_all_spans_assigned(const char *device_path)
      |        ^~~~
dahdi_cfg.c: In function ‘_are_all_spans_assigned’:
dahdi_cfg.c:162:24: error: ‘false’ undeclared (first use in this function)
  162 |                 return false;
      |                        ^~~~~
dahdi_cfg.c:53:1: note: ‘false’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
   52 | #include "dahdi_tools_version.h"
  +++ |+#include <stdbool.h>
   53 | 
dahdi_cfg.c:162:24: note: each undeclared identifier is reported only once for each function it appears in
  162 |                 return false;
      |                        ^~~~~
dahdi_cfg.c:182:43: error: ‘true’ undeclared (first use in this function)
  182 |         return (span_count > 0) ? false : true;
      |                                           ^~~~
dahdi_cfg.c:182:43: note: ‘true’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
dahdi_cfg.c: At top level:
dahdi_cfg.c:191:8: error: unknown type name ‘bool’
  191 | static bool are_all_spans_assigned(void)
      |        ^~~~
dahdi_cfg.c: In function ‘are_all_spans_assigned’:
dahdi_cfg.c:195:9: error: unknown type name ‘bool’
  195 |         bool res = true;
      |         ^~~~
dahdi_cfg.c:195:9: note: ‘bool’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
dahdi_cfg.c:195:20: error: ‘true’ undeclared (first use in this function)
  195 |         bool res = true;
      |                    ^~~~
dahdi_cfg.c:195:20: note: ‘true’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
dahdi_cfg.c: At top level:
dahdi_cfg.c:226:8: error: unknown type name ‘bool’
  226 | static bool wait_for_all_spans_assigned(unsigned long timeout_sec)
      |        ^~~~
dahdi_cfg.c: In function ‘wait_for_all_spans_assigned’:
dahdi_cfg.c:228:9: error: unknown type name ‘bool’
  228 |         bool all_assigned = are_all_spans_assigned();
      |         ^~~~
dahdi_cfg.c:228:9: note: ‘bool’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
dahdi_cfg.c: In function ‘main’:
dahdi_cfg.c:1596:17: error: unknown type name ‘bool’
 1596 |                 bool all_assigned = wait_for_all_spans_assigned(5);
      |                 ^~~~
dahdi_cfg.c:1596:17: note: ‘bool’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
make[3]: *** [Makefile:985: dahdi_cfg.o] Error 1

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 commented 11 months ago

The possible cause of the error is the same already detailed in the comment at https://github.com/asterisk/dahdi-linux/issues/36#issuecomment-1732695490 for the related dahdi-linux component.

rodolfojcj commented 11 months ago

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

I tested it with:

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.