admin管理员组

文章数量:1400033

I'm writing a c++ application using cmake / conan / boost on MSVC

I have successfully built an application that print stacktraces using:

auto frames = boost::stacktrace::stacktrace().as_vector();

Output:

Stack Trace:
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.427] [Stack Trace] [error] Function: boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::init, Address: 0x7ff8e9586674, File: stacktrace.hpp, Line: 110
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.429] [Stack Trace] [error] Function: boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::basic_stacktrace<std::allocator<boost::stacktrace::frame> >, Address: 0x7ff8e956fa0a, File: stacktrace.hpp, Line: 162
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.429] [Stack Trace] [error] Function: ControlAPI::printBoostStackTrace, Address: 0x7ff8e954c58e, File: HC_API.build.cpp, Line: 454
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.438] [Stack Trace] [error] Function: ControlAPI::throwLoggerError<>, Address: 0x7ff8e93527e5, File: HC_API_internal.build.h, Line: 264
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.438] [Stack Trace] [error] Function: ControlAPI::ControlInterfaceObjects::debugWindowGui, Address: 0x7ff8e93f109e, File: interface_base_classes_internal.build.h, Line: 409
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.439] [Stack Trace] [error] Function: ControlAPI::ControlInterfaceObjects::gui, Address: 0x7ff8e93e5a6e, File: interface_internal.build.cpp, Line: 30
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Examples::ControlInterfaceApp::ControlGui, Address: 0x7ff8e93f64f5, File: controlInterfaces.build.cpp, Line: 610
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Examples::ControlInterfaceApp::drawEvent, Address: 0x7ff8e93f5fdb, File: controlInterfaces.build.cpp, Line: 523
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Platform::GlfwApplication::mainLoopIteration, Address: 0x7ff8e950035b, File: GlfwApplication.cpp, Line: 784
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.441] [Stack Trace] [error] Function: ControlAPI::controlGuiInterface::update, Address: 0x7ff8e93f20a9, File: controlInterfaces.build.cpp, Line: 659
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.441] [Stack Trace] [error] Function: main, Address: 0x7ff7bdfff3e6, File: main.build.cpp, Line: 30
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: invoke_main, Address: 0x7ff7be08df29, File: exe_common.inl, Line: 79
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: __scrt_common_main_seh, Address: 0x7ff7be08de12, File: exe_common.inl, Line: 288
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: __scrt_common_main, Address: 0x7ff7be08dcce, File: exe_common.inl, Line: 331
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: mainCRTStartup, Address: 0x7ff7be08dfbe, File: exe_main.cpp, Line: 17
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.443] [Stack Trace] [error] Function: BaseThreadInitThunk, Address: 0x7ffa08d3e8d7, File: , Line: 0
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.443] [Stack Trace] [error] Function: RtlUserThreadStart, Address: 0x7ffa09a5bf6c, File: , Line: 0

This works great on the machine I compiled on. I can even move/cmake install the application and dll's to a different location on the same machine and The stack trace still works fine.

However if I run on a different windows machine i get the following output:

[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de86674, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de6fa0a, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de4c58e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dc527e5, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.777] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf109e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dce5a6e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf64f5, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf5fdb, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de0035b, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf20a9, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abdff3e6, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abe8df29, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abe8de12, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: , Address: 0x7ff7abe8dcce, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: , Address: 0x7ff7abe8dfbe, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: BaseThreadInitThunk, Address: 0x7ffde6668d17, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.781] [Stack Trace] [error] Function: RtlUserThreadStart, Address: 0x7ffde77f8260, File: , Line: 0

This is with all my application pdb files present along with the executable.

Is there a missing system dependancy that also needs to be distributed?

I'm writing a c++ application using cmake / conan / boost on MSVC

I have successfully built an application that print stacktraces using:

auto frames = boost::stacktrace::stacktrace().as_vector();

Output:

Stack Trace:
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.427] [Stack Trace] [error] Function: boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::init, Address: 0x7ff8e9586674, File: stacktrace.hpp, Line: 110
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.429] [Stack Trace] [error] Function: boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::basic_stacktrace<std::allocator<boost::stacktrace::frame> >, Address: 0x7ff8e956fa0a, File: stacktrace.hpp, Line: 162
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.429] [Stack Trace] [error] Function: ControlAPI::printBoostStackTrace, Address: 0x7ff8e954c58e, File: HC_API.build.cpp, Line: 454
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.438] [Stack Trace] [error] Function: ControlAPI::throwLoggerError<>, Address: 0x7ff8e93527e5, File: HC_API_internal.build.h, Line: 264
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.438] [Stack Trace] [error] Function: ControlAPI::ControlInterfaceObjects::debugWindowGui, Address: 0x7ff8e93f109e, File: interface_base_classes_internal.build.h, Line: 409
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.439] [Stack Trace] [error] Function: ControlAPI::ControlInterfaceObjects::gui, Address: 0x7ff8e93e5a6e, File: interface_internal.build.cpp, Line: 30
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Examples::ControlInterfaceApp::ControlGui, Address: 0x7ff8e93f64f5, File: controlInterfaces.build.cpp, Line: 610
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Examples::ControlInterfaceApp::drawEvent, Address: 0x7ff8e93f5fdb, File: controlInterfaces.build.cpp, Line: 523
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.440] [Stack Trace] [error] Function: Magnum::Platform::GlfwApplication::mainLoopIteration, Address: 0x7ff8e950035b, File: GlfwApplication.cpp, Line: 784
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.441] [Stack Trace] [error] Function: ControlAPI::controlGuiInterface::update, Address: 0x7ff8e93f20a9, File: controlInterfaces.build.cpp, Line: 659
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.441] [Stack Trace] [error] Function: main, Address: 0x7ff7bdfff3e6, File: main.build.cpp, Line: 30
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: invoke_main, Address: 0x7ff7be08df29, File: exe_common.inl, Line: 79
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: __scrt_common_main_seh, Address: 0x7ff7be08de12, File: exe_common.inl, Line: 288
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: __scrt_common_main, Address: 0x7ff7be08dcce, File: exe_common.inl, Line: 331
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.442] [Stack Trace] [error] Function: mainCRTStartup, Address: 0x7ff7be08dfbe, File: exe_main.cpp, Line: 17
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.443] [Stack Trace] [error] Function: BaseThreadInitThunk, Address: 0x7ffa08d3e8d7, File: , Line: 0
[HC_API][THREAD: 12320] [2025-03-25 11:33:47.443] [Stack Trace] [error] Function: RtlUserThreadStart, Address: 0x7ffa09a5bf6c, File: , Line: 0

This works great on the machine I compiled on. I can even move/cmake install the application and dll's to a different location on the same machine and The stack trace still works fine.

However if I run on a different windows machine i get the following output:

[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de86674, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de6fa0a, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de4c58e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.776] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dc527e5, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.777] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf109e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dce5a6e, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf64f5, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf5fdb, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.778] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0de0035b, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: ControlAPI::SpectralSensorCommandStatus::operator=, Address: 0x7ffd0dcf20a9, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abdff3e6, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abe8df29, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.779] [Stack Trace] [error] Function: , Address: 0x7ff7abe8de12, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: , Address: 0x7ff7abe8dcce, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: , Address: 0x7ff7abe8dfbe, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.780] [Stack Trace] [error] Function: BaseThreadInitThunk, Address: 0x7ffde6668d17, File: , Line: 0
[HC_API][THREAD: 54112] [2025-03-25 11:36:50.781] [Stack Trace] [error] Function: RtlUserThreadStart, Address: 0x7ffde77f8260, File: , Line: 0

This is with all my application pdb files present along with the executable.

Is there a missing system dependancy that also needs to be distributed?

Share Improve this question edited Mar 25 at 22:57 Alan Birtles 36.7k4 gold badges37 silver badges68 bronze badges asked Mar 25 at 17:53 T. CashT. Cash 314 bronze badges 4
  • 1 github/boost/stacktrace/issues/55 – Alan Birtles Commented Mar 25 at 18:03
  • thanks for linking the issue. my solution added above. – T. Cash Commented Mar 25 at 20:03
  • 5 @T.Cash: No, do not add a solution to the question post. Instead post a solution as an answer post. On Stack Overflow it is perfectly allowed to write an answer for your own question: stackoverflow/help/self-answer – Tsyvarev Commented Mar 25 at 20:37
  • Solution was to update /PDBALTPATH to an explicit pdb path. – T. Cash Commented Mar 26 at 23:36
Add a comment  | 

1 Answer 1

Reset to default 1

My solution was to use

target_link_options(${TARGET_NAME} PRIVATE "/PDBALTPATH:$<TARGET_PROPERTY:${TARGET_NAME},NAME>.pdb")

To specify the link options on the target to use the full path to the pdb file.

本文标签: cHow to deploy MSVC applications that use boost stacktraceStack Overflow