c++qtstatic-librarieschromiumgn

How to build crashpad for Qt application


I am developing Qt application and I would like to use crashpad to report crashes. I have downloaded sources and built them.

Now I would like to link those statically to my application.

When I go to out folder I see a lot of .a files. Which one should I choose?

> find ./out -name *.a 
./obj/handler/libhandler.a
./obj/snapshot/libsnapshot.a
./obj/snapshot/libtest_support.a
./obj/test/libtest.a
./obj/test/libgtest_main.a
./obj/test/libgmock_main.a
./obj/util/libutil.a
./obj/third_party/mini_chromium/mini_chromium/base/libbase.a
./obj/third_party/gtest/libgtest_main.a
./obj/third_party/gtest/libgtest.a
./obj/third_party/gtest/libgmock.a
./obj/third_party/gtest/libgmock_main.a
./obj/minidump/libminidump.a
./obj/minidump/libtest_support.a
./obj/client/libclient.a

Also I have built it using this command:

build/gyp_crashpad.py -Dmac_deployment_target=10.12

I do not know if I should add some parameters

Could someone please help?

Thanks in advance


Solution

  • Build Crashpad via gn and ninja, where gn generates a build configuration, and ninja does the actual building.

    For a macOS Qt application to generate minidumps and upload them to a remote server it will need to be linked with the Crashpad libraries libcommon.a, libclient.a, libutil.a, libbase.a, mig_output.a:

    # Crashpad libraries
    LIBS += -L$$PWD/Crashpad/Libraries/MacOS/$$ARCH -lcommon
    LIBS += -L$$PWD/Crashpad/Libraries/MacOS/$$ARCH -lclient
    LIBS += -L$$PWD/Crashpad/Libraries/MacOS/$$ARCH -lbase
    LIBS += -L$$PWD/Crashpad/Libraries/MacOS/$$ARCH -lutil
    LIBS += -L$$PWD/Crashpad/Libraries/MacOS/$$ARCH -lmig_output
    

    The application will also need to be linked with the system library bsm, and frameworks AppKit and Security:

    # System libraries
    LIBS += -L/usr/lib/ -lbsm
    LIBS += -framework AppKit
    LIBS += -framework Security
    

    Additionally, you'll need to package crashpad_handler with your application and ensure that it is available at runtime.

    More information about building Crashpad can be found here.

    An example macOS Qt application that has been integrated with Crashpad can be found here.