Skip to content

Vendored libunwind clashes with -static-libgcc when linking statically on Linux #1543

@limbonaut

Description

@limbonaut

In sentry-godot, we build sentry-native as a static library (SENTRY_BUILD_SHARED_LIBS=OFF) and link it into a shared GDExtension library. Our toolchain (godot-cpp) uses -static-libgcc -static-libstdc++ for portability.

After upgrading to 0.13.0, the Linux build fails with:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/libgcc_eh.a(unwind-dw2.o): in function `_Unwind_Resume':
(.text+0x2b40): multiple definition of `_Unwind_Resume'; install/lib/libunwind.a(Resume.c.o): first defined here
collect2: error: ld returned 1 exit status

Without libunwind.a in the link, we get undefined symbols instead:

undefined symbol: _ULx86_64_init_local   (x86_64)
undefined symbol: _ULx86_init_local2     (x86_32)

The vendored libunwind.a includes C++ exception ABI symbols (_Unwind_Resume, etc.) that conflict with libgcc_eh.a (pulled in by -static-libgcc).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions