Closed HybridEidolon closed 8 months ago
Thank you! This is a super helpful report, I’ll look into it.
Seems to also affect x64-mingw-static, but neither mingw dynamic triplet, so I'll add that to the description. It might be that the portfile for libdwarf is set up incorrectly.
cpptrace seems to output object files which link against the libdwarf symbols with the _imp_
prefix, but libdwarf.a
does not have that prefix. e.g. _dwarf_get_ranges_b
vs _imp__dwarf_get_ranges_b
libdwarf's cmake config output does not specify LIBDWARF_STATIC
as a public definition of libdwarf::dwarf-static, so if cpptrace is statically linking against libdwarf, it needs to define it itself. That macro causes libdwarf not to export symbols with declspec(dllexport). Either libdwarf should be patched upstream or cpptrace's cmakelists should be patched, but I'm not sure which would be correct here. I have a port overlay of cpptrace which just adds the definition if dwarf-static is available, and it links correctly.
I now have a different issue in that it is unable to fully resolve symbols with libdwarf if the binary has had its symbols stripped... however mgwhelp has the same problem, so I'm not worried about it here.
I tested locally and this seems to be resolved as of libdwarf 0.9.1
When using the cpptrace port in vcpkg on
x86-mingw-static
orx64-mingw-static
(and not the dynamic triplets), libdwarf does not seem to be linked correctly, despite libdwarf.a showing up in the vcpkg_installed directory.Even if I link libdwarf::dwarf-static directly in my own CMake target, cpptrace still references symbols that aren't resolved for some reason.
CMakeLists.txt
main.cpp
vcpkg.json
configure and build line
build output