backward-cpp icon indicating copy to clipboard operation
backward-cpp copied to clipboard

Failure to link with clang (`_Unwind_GetIPInfo` not resolved), needs `-lunwind`

Open eudoxos opened this issue 6 years ago • 1 comments

For the record (might go to the docs?), compiling with clang 7 on arm (armv6k-unknown-linux-gnueabihf) resulted in undefined symbol _Unwind_GetIPInfo; this was solved by linking against -lunwind from llvm. Feel free to add somewhere or just close the issue. Thanks for backward!

eudoxos avatar Jun 14 '19 10:06 eudoxos

On arm, _Unwind_GetIPInfo is defined inline in unwind-arm-common.h (as a stub) for gcc. The symbol is not present in libgcc (except for FreeBSD).

But both clang and libunwind (www.nongnu.org/libunwind) have the prototype in their unwind.h, so there are link failures with either :

  • clang with libgcc (using the libunwind from llvm means overwriting parts of libgcc, this is usually meant to be used with compiler-rt only)
  • libunwind (with either gcc, or clang with libgcc), unless explicitly configured with --enable-cxx-exceptions

hwti avatar Jan 18 '22 01:01 hwti