How to build dynamic (shared) libraries of crashpad?

橙三吉。 提交于 2019-12-12 14:56:45

问题


Crashpad is an error reporting system for c++ apps. https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/developing.md

build instructions are

 $ cd ~/crashpad/crashpad
 $ gn gen out/Default
 $ ninja -C out/Default

I can build predefined static libs but I have not found a way how to use gn or ninja to generate the shared libraries.


回答1:


After running gn gen out\Default, you can edit the out\Default\toolchain.ninja file to add extra compiler flags to the command for the cc and cxx rules.

rule cc
  command = ninja -t msvc -e environment.amd64 -- cl.exe ... ${cflags} ${cflags_c} /c ...
                                 add the /MD compiler flag after the others, here ^



回答2:


after you generate ninja files, for each ninja file find the switch /MTd (debug) or /MT (release version) and change it to /MDd or /MD so the dynamic libs will be created

then you can build crashpad with ninja, the output is still lib files so they will be included in the exe file when you link them to your project (you do not have to add them to your project as using dlls).



来源:https://stackoverflow.com/questions/55302553/how-to-build-dynamic-shared-libraries-of-crashpad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!