Skip to contentSkip to conversation

domoticz: fix build with uClibc

PATCH New Rahul Bedarkar 4 participants 6 messages Aug 25, 2016 – Aug 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 domoticz: fix build with uClibc

domoticz.cpp currently assumes that on GNU/Linux systems header <execinfo.h> is available. But that is not true. Since it provided by C library and uClibc can be built without backtrace support. And in such cases we get following build error.

domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory

   #include <execinfo.h>
                        ^

compilation terminated.

This commit adds patch for detecting presence of <execinfo.h> and guards code accordingly.

Fixes:

http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/

---
 ...per-check-for-detecting-header-execinfo.h.patch | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch
package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch new file +61 -0
new file mode 100644
index 0000000..2e07abe
@@ -0,0 +1,61 @@
+From 5409696dfcbb05d6e4e67e74c97487b1987639e1 Mon Sep 17 00:00:00 2001
+From: Rahul Bedarkar <[email protected]>
+Date: Thu, 25 Aug 2016 17:23:38 +0530
+Subject: [PATCH 1/1] add proper check for detecting header <execinfo.h>
+
+domoticz.cpp currently assumes that on GNU/Linux systems header
+<execinfo.h> is available. But that is not true. Since it provided by
+C library and uClibc can be built without backtrace support. And in
+such cases we get following build error.
+
+  domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory
+   #include <execinfo.h>
+                        ^
+  compilation terminated.
+
+Instead of depending on __gnu_linux__, add check for detecting
+presence of <execinfo.h> and guard code for dumpstack accordingly.
+
+This build failure is detected by Buildroot autobuilder.
+http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/
+
+Signed-off-by: Rahul Bedarkar <[email protected]>
+---
+ CMakeLists.txt    | 7 +++++++
+ main/domoticz.cpp | 2 +-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d3113f4..ef32f7b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -61,6 +61,13 @@ SET(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL
+   "Where to put the executables for Domoticz"
+   )
+ 
++INCLUDE(CheckIncludeFiles)
++CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
++
++IF(HAVE_EXECINFO_H)
++  ADD_DEFINITIONS(-DHAVE_EXECINFO_H)
++ENDIF(HAVE_EXECINFO_H)
++
+ #set(CMAKE_EXE_LINKER_FLAGS "-static")
+ 
+ # Macro for setting up precompiled headers. Usage:
+diff --git a/main/domoticz.cpp b/main/domoticz.cpp
+index 69d2ef6..c52e5ac 100644
+--- a/main/domoticz.cpp
++++ b/main/domoticz.cpp
+@@ -44,7 +44,7 @@
+ 	#include <string.h> 
+ #endif
+ 
+-#ifdef __gnu_linux__
++#ifdef HAVE_EXECINFO_H
+ #include <execinfo.h>
+ static void dumpstack(void) {
+ 	// Notes :
+-- 
+2.6.2
+
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 domoticz: fix build with uClibc

Hi Rahul, all,

Quoted 56 lines · Rahul Bedarkar

domoticz.cpp currently assumes that on GNU/Linux systems header <execinfo.h> is available. But that is not true. Since it provided by C library and uClibc can be built without backtrace support. And in such cases we get following build error.

domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory

   #include <execinfo.h>
                        ^

compilation terminated.

This commit adds patch for detecting presence of <execinfo.h> and guards code accordingly.

Fixes:

http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/

---
 ...per-check-for-detecting-header-execinfo.h.patch | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch
package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch new file +27 -0
new file mode 100644
index 0000000..2e07abe
@@ -0,0 +1,61 @@
+From 5409696dfcbb05d6e4e67e74c97487b1987639e1 Mon Sep 17 00:00:00 2001
+From: Rahul Bedarkar <[email protected]>
+Date: Thu, 25 Aug 2016 17:23:38 +0530
+Subject: [PATCH 1/1] add proper check for detecting header <execinfo.h>
+
+domoticz.cpp currently assumes that on GNU/Linux systems header
+<execinfo.h> is available. But that is not true. Since it provided by
+C library and uClibc can be built without backtrace support. And in
+such cases we get following build error.
+
+  domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory
+   #include <execinfo.h>
+                        ^
+  compilation terminated.
+
+Instead of depending on __gnu_linux__, add check for detecting
+presence of <execinfo.h> and guard code for dumpstack accordingly.
+
+This build failure is detected by Buildroot autobuilder.
+http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/
+
+Signed-off-by: Rahul Bedarkar <[email protected]>
+---
+ CMakeLists.txt    | 7 +++++++
+ main/domoticz.cpp | 2 +-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+

package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch line 37

Quoted 10 lines
package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch new file +10 -0
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d3113f4..ef32f7b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -61,6 +61,13 @@ SET(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL
+   "Where to put the executables for Domoticz"
+   )
+
++INCLUDE(CheckIncludeFiles)
++CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)

Since only 1 header is checked, CHECK_INCLUDE_FILE (from the CheckIncludeFile module) could be used.
But this is nitpicking ;)

Quoted 27 lines
package/domoticz/0001-add-proper-check-for-detecting-header-execinfo.h.patch new file +24 -1
++
++IF(HAVE_EXECINFO_H)
++  ADD_DEFINITIONS(-DHAVE_EXECINFO_H)
++ENDIF(HAVE_EXECINFO_H)
++
+ #set(CMAKE_EXE_LINKER_FLAGS "-static")
+
+ # Macro for setting up precompiled headers. Usage:
+diff --git a/main/domoticz.cpp b/main/domoticz.cpp
+index 69d2ef6..c52e5ac 100644
+--- a/main/domoticz.cpp
++++ b/main/domoticz.cpp
+@@ -44,7 +44,7 @@
+       #include <string.h>
+ #endif
+
+-#ifdef __gnu_linux__
++#ifdef HAVE_EXECINFO_H
+ #include <execinfo.h>
+ static void dumpstack(void) {
+       // Notes :
+--
+2.6.2
+
--

2.6.2

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

BTW, it'd be great to submit upstream this patch.

Regards,

Signature · 1 line
Samuel
#2 lore raw

PATCH 1/1 domoticz: fix build with uClibc

In reply to Rahul Bedarkar
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Rahul" == Rahul Bedarkar <[email protected]> writes:

domoticz.cpp currently assumes that on GNU/Linux systems header <execinfo.h> is available. But that is not true. Since it provided by C library and uClibc can be built without backtrace support. And in such cases we get following build error.

domoticz-3.4834/main/domoticz.cpp:48:22: fatal error: execinfo.h: No such file or directory

   #include <execinfo.h>
                        ^

compilation terminated.

Quoted 8 lines

This commit adds patch for detecting presence of <execinfo.h> and guards code accordingly.

Fixes:

http://autobuild.buildroot.net/results/393/393f839e160b51ca12ac36058718ad2f0c1b50a6/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 domoticz: fix build with uClibc

Hello,

Quoted 3 lines · Peter Korsgaard
Quoted 1 line

Committed, thanks.

And actually I had to fix up the patch, because it was not applying properly. See
https://git.buildroot.org/buildroot/commit/?id=397962ce1737ba0f920ffc1d3a3ea2bc08b28270
for all the details.

Rahul, did you actually test the patch? It didn't apply to the domoticz source code extracted from the tarball, causing an immediate build failure.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 domoticz: fix build with uClibc

Hi Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello,

Quoted 3 lines · Peter Korsgaard
Quoted 1 line

Committed, thanks.

Quoted 9 lines

And actually I had to fix up the patch, because it was not applying properly. See
https://git.buildroot.org/buildroot/commit/?id=397962ce1737ba0f920ffc1d3a3ea2bc08b28270
for all the details.

Rahul, did you actually test the patch? It didn't apply to the domoticz source code extracted from the tarball, causing an immediate build failure.

Yes, I had tested patch. It was applied cleanly in my case. Not sure why it hasn't failed for me.

Thanks for fix.

Regards,
Rahul

#5 lore raw

PATCH 1/1 domoticz: fix build with uClibc

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Rahul" == Rahul Bedarkar <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 5 lines

And actually I had to fix up the patch, because it was not applying properly. See
https://git.buildroot.org/buildroot/commit/?id=397962ce1737ba0f920ffc1d3a3ea2bc08b28270
for all the details.

Quoted 7 lines
Quoted 4 lines

Rahul, did you actually test the patch? It didn't apply to the domoticz source code extracted from the tarball, causing an immediate build failure.

Yes, I had tested patch. It was applied cleanly in my case. Not sure why it hasn't failed for me.

I think the dos newlines got dropped by patchwork. We had similar issues in the past.

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard