libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH] Fix compilation of tests on alpine linux (musl


From: Tony Kelman
Subject: [Libunwind-devel] [PATCH] Fix compilation of tests on alpine linux (musl libc)
Date: Sun, 31 Jan 2016 08:45:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

commit 4e2e930bbe82b04b75a9a1519906908e657de218
Author: Tony Kelman <address@hidden>
Date:   Sun Jan 31 08:31:04 2016 +0000

    Fix compilation of tests on alpine linux (musl libc)

    If we don't link to libexecinfo, as detected by the
    AC_SEARCH_LIBS(backtrace, execinfo) configure probe, we get

    ```
    test-coredump-unwind.o: In function `handle_sigsegv':
    /home/libunwind/tests/test-coredump-unwind.c:246: undefined reference to
    `backtrace_symbols_fd'
    collect2: error: ld returned 1 exit status
    Makefile:1187: recipe for target 'test-coredump-unwind' failed
    ```

    and

    ```
    Gtest-init.o: In function `do_backtrace()':
    Gtest-init.cxx:(.text+0x2f): undefined reference to 
`_Ux86_64_getcontext'
    Gtest-init.cxx:(.text+0x48): undefined reference to 
`_Ux86_64_init_local'
    Gtest-init.cxx:(.text+0x63): undefined reference to `_Ux86_64_get_reg'
    Gtest-init.cxx:(.text+0x96): undefined reference to 
`_Ux86_64_get_proc_name'
    Gtest-init.cxx:(.text+0x171): undefined reference to `_Ux86_64_step'
    collect2: error: ld returned 1 exit status
    Makefile:1063: recipe for target 'Gtest-init' failed
    ```

    There are 2 XFAIL and 6 FAIL tests, but it's a start
    (log available at 
https://github.com/tkelman/libunwind/commit/a0c3dddba8a478c3fe75e7478b3bfd8d
6ec68cfd )

diff --git a/configure.ac b/configure.ac
index 85d78f8..69ae7a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -369,6 +369,10 @@ old_LIBS="$LIBS"
 LIBS=""
 AC_SEARCH_LIBS(backtrace, execinfo)
 LIBS="$old_LIBS"
+case "$ac_cv_search_backtrace" in
+  -l*) BACKTRACELIB=$ac_cv_search_backtrace;;
+  *) BACKTRACELIB="";;
+esac

 AC_SUBST(build_arch)
 AC_SUBST(target_os)
@@ -384,6 +388,7 @@ AC_SUBST(PKG_MAINTAINER)
 AC_SUBST(enable_cxx_exceptions)
 AC_SUBST(enable_debug_frame)
 AC_SUBST(DLLIB)
+AC_SUBST(BACKTRACELIB)

 AC_PATH_PROG([LATEX2MAN],[latex2man])
 if test "x$LATEX2MAN" = "x"; then
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fe2dba8..ad4cb1c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -178,7 +178,7 @@ Gtest_bt_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
 Gtest_concurrent_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) -lpthread
 Gtest_dyn1_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
 Gtest_exc_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
-Gtest_init_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_init_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) @BACKTRACELIB@
 Gtest_resume_sig_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
 Gtest_resume_sig_rt_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
 Gperf_simple_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
@@ -202,7 +202,7 @@ test_setjmp_LDADD = $(LIBUNWIND_setjmp)
 ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp)

 if BUILD_COREDUMP
-test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND)
+test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND) 
@BACKTRACELIB@
 endif

 Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]