0001-add-proper-check-for-detecting-header-execinfo.h.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From f0da50118f7bd01ed7fa97e75b790a8232d8d4dc Mon Sep 17 00:00:00 2001
  2. From: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
  3. Date: Thu, 25 Aug 2016 17:23:38 +0530
  4. Subject: [PATCH] add proper check for detecting header <execinfo.h>
  5. domoticz.cpp currently assumes that on GNU/Linux systems header
  6. <execinfo.h> is available. But that is not true. Since it provided by
  7. C library and uClibc can be built without backtrace support. And in
  8. such cases we get following build error.
  9. domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory
  10. #include <execinfo.h>
  11. ^
  12. compilation terminated.
  13. Instead of depending on __gnu_linux__, add check for detecting
  14. presence of <execinfo.h> and guard code for dumpstack accordingly.
  15. This build failure is detected by Buildroot autobuilder.
  16. http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/
  17. Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
  18. ---
  19. CMakeLists.txt | 7 +++++++
  20. main/domoticz.cpp | 2 +-
  21. 2 files changed, 8 insertions(+), 1 deletion(-)
  22. Index: b/CMakeLists.txt
  23. ===================================================================
  24. --- a/CMakeLists.txt
  25. +++ b/CMakeLists.txt
  26. @@ -61,6 +61,13 @@
  27. "Where to put the executables for Domoticz"
  28. )
  29. +INCLUDE(CheckIncludeFiles)
  30. +CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
  31. +
  32. +IF(HAVE_EXECINFO_H)
  33. + ADD_DEFINITIONS(-DHAVE_EXECINFO_H)
  34. +ENDIF(HAVE_EXECINFO_H)
  35. +
  36. #set(CMAKE_EXE_LINKER_FLAGS "-static")
  37. # Macro for setting up precompiled headers. Usage:
  38. Index: b/main/domoticz.cpp
  39. ===================================================================
  40. --- a/main/domoticz.cpp
  41. +++ b/main/domoticz.cpp
  42. @@ -44,7 +44,7 @@
  43. #include <string.h>
  44. #endif
  45. -#ifdef __gnu_linux__
  46. +#ifdef HAVE_EXECINFO_H
  47. #include <execinfo.h>
  48. static void dumpstack(void) {
  49. // Notes :