gpt4 book ai didi

c++ - 将 Crashpad 与 MacOS Qt 应用程序集成

转载 作者:行者123 更新时间:2023-12-01 14:07:38 47 4
gpt4 key购买 nike

我们的 Qt 应用程序是使用 qmake 构建的。我们已经从这个 commit 构建了 Crashpad这是目前大师的提示。我们已将 Qt 应用程序与 libclient.a 相关联, libbase.a , libhandler.a , libutil.a , Security.FrameworkAppKit.Framework并添加了相关的包含目录。当我们构建我们的应用程序时,我们从链接器收到以下错误:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names  -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/Users/bobby/Qt/5.14.2/clang_64/lib -o myQtCrasher.app/Contents/MacOS/myQtCrasher main.o mainwindow.o qrc_myQtCrasher.o moc_mainwindow.o   -F/Users/bobby/Qt/5.14.2/clang_64/lib -framework Security -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/client/ -lclient -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/handler/ -lhandler -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/minidump/ -lformat -lminidump -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/snapshot/ -lcontext -lsnapshot -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/third_party/mini_chromium/mini_chromium/base/ -lbase -L/Users/bobby/Documents/Qt/myQtCrasher/../../../Desktop/bugsplat/crashpad/crashpad/out/Default/obj/util/ -lutil -framework QtWidgets -framework QtGui -framework AppKit -framework Metal -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL   
Undefined symbols for architecture x86_64:
"___MIG_check__Request__child_port_check_in_t", referenced from:
crashpad::ChildPortServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.child_port_server.o)
"___MIG_check__Request__mach_notify_dead_name_t", referenced from:
crashpad::NotifyServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.notify_server.o)
"___MIG_check__Request__mach_notify_no_senders_t", referenced from:
crashpad::NotifyServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.notify_server.o)
"___MIG_check__Request__mach_notify_port_deleted_t", referenced from:
crashpad::NotifyServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.notify_server.o)
"___MIG_check__Request__mach_notify_port_destroyed_t", referenced from:
crashpad::NotifyServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.notify_server.o)
"___MIG_check__Request__mach_notify_send_once_t", referenced from:
crashpad::NotifyServer::MachMessageServerFunction(mach_msg_header_t const*, mach_msg_header_t*, bool*) in libutil.a(util.notify_server.o)
"_audit_token_to_pid", referenced from:
crashpad::AuditPIDFromMachMessageTrailer(mach_msg_trailer_t const*) in libutil.a(util.mach_message.o)
"_child_port_check_in", referenced from:
crashpad::ChildPortHandshake::RunClientInternal_SendCheckIn(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long long, unsigned int, unsigned int) in libutil.a(util.child_port_handshake.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [myQtCrasher.app/Contents/MacOS/myQtCrasher] Error 1
11:18:12: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project myQtCrasher (kit: Desktop Qt 5.14.2 clang 64bit)
When executing step "Make"
11:18:12: Elapsed time: 00:02.

当我们调查 child_port_server.o (使用 nm)我们发现符号 ___MIG_check__Request__child_port_check_in_t未定义。这让我们回到 out/Default/gen/util/mach/child_port_server.c我们发现以下内容:
#if !defined(__MigTypeCheck) && defined(TypeCheck)
#define __MigTypeCheck TypeCheck /* Legacy setting */
#endif /* !defined(__MigTypeCheck) */

...

#if ( __MigTypeCheck )
#if __MIG_check__Request__child_port_subsystem__
#if !defined(__MIG_check__Request__child_port_check_in_t__defined)
#define __MIG_check__Request__child_port_check_in_t__defined

mig_external kern_return_t __MIG_check__Request__child_port_check_in_t(__attribute__((__unused__)) __Request__child_port_check_in_t *In0P)
{

typedef __Request__child_port_check_in_t __Request;
#if __MigTypeCheck
if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
(In0P->msgh_body.msgh_descriptor_count != 1) ||
(In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
return MIG_BAD_ARGUMENTS;
#endif /* __MigTypeCheck */

#if __MigTypeCheck
if (In0P->port.type != MACH_MSG_PORT_DESCRIPTOR)
return MIG_TYPE_ERROR;
#endif /* __MigTypeCheck */

return MACH_MSG_SUCCESS;
}
#endif /* !defined(__MIG_check__Request__child_port_check_in_t__defined) */
#endif /* __MIG_check__Request__child_port_subsystem__ */
#endif /* ( __MigTypeCheck ) */

由于对 gen 和 ninja 的了解有限,我们试图通过 -DTypeCheck通过修改标志 util.ninja但这破坏了编译。我们被困住了,如果社区愿意提供任何帮助,我们将不胜感激!

我们如何修复链接器错误的其余部分?

最佳答案

由于对我们的 post 的回复,我们能够解决这个问题在 Crashpad-dev

将 libbsm 添加到您的 .pro 文件

macx: LIBS += -lbsm

将 out/Default/obj/out/Default/gen/util/mach 中的所有 .o 文件添加到您的 .pro 文件中
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.child_portServer.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.child_portUser.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.excServer.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.excUser.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.mach_excServer.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.mach_excUser.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.notifyServer.o
macx: LIBS += /path/to/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/mig_output.notifyUser.o

关于c++ - 将 Crashpad 与 MacOS Qt 应用程序集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61346222/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com