[PATCH] use libunwind only when both header and lib available

Rob Latham robl at mcs.anl.gov
Thu Jan 14 12:56:14 CST 2016


libunwind has runtime libraries and compile-time heaers.  Some systems
might provide libunwind without the corresponding -dev package.  Be more
careful about when to choose libunwind.
---
 src/mpl/src/bt/mpl_bt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mpl/src/bt/mpl_bt.c b/src/mpl/src/bt/mpl_bt.c
index 5abd999d..ef10a59a 100644
--- a/src/mpl/src/bt/mpl_bt.c
+++ b/src/mpl/src/bt/mpl_bt.c
@@ -44,7 +44,11 @@ static inline void backtrace_libback(FILE *output)
     btstate = backtrace_create_state(NULL, 1, NULL, NULL);
     backtrace_print(btstate, 0, output);
 }
-#elif defined MPL_HAVE_LIBUNWIND
+/* we need not only the symbols but the header file too (for the cursor and
+ * context), so tighten up when we take the libunwind path.  Thanks
+ * Siegmar.Gross at informatik.hs-fulda.de for the bug report about systems with
+ * libunwind libraries but no libunwind development headers */
+#elif defined MPL_HAVE_LIBUNWIND && defined(MPL_HAVE_LIBUNWIND_H)
 static inline void backtrace_libunwind(FILE *output)
 {
     unw_cursor_t cursor;
@@ -118,7 +122,7 @@ void MPL_backtrace_show(FILE *output)
 {
 #ifdef MPL_HAVE_LIBBACKTRACE
     backtrace_libback(output);
-#elif defined MPL_HAVE_LIBUNWIND
+#elif defined MPL_HAVE_LIBUNWIND && defined(MPL_HAVE_LIBUNWIND_H)
     /* libunwind is not able to get line numbers without forking off to
      * addr2line (?)*/
     backtrace_libunwind(output);
-- 
2.5.0


--------------040008040900080701010307
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss
--------------040008040900080701010307--


More information about the discuss mailing list