从 Windows 上的 libgrpc_csharp_ext.x64.so 剥离调试信息 [英] Strip debug information from libgrpc_csharp_ext.x64.so on Windows

查看:41
本文介绍了从 Windows 上的 libgrpc_csharp_ext.x64.so 剥离调试信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队最近开始在我们基于 .Net Framework 构建的产品中使用 gRPC.由于主要是 libgrpc_csharp_ext.x64.so 中的大量调试符号,因此我们的构建工件已从 50 MB 激增至 400 MB.由于互联网带宽较低,这给我们的 CI/CD 环境以及我们的交付链带来了一些问题.

My team has recently started using gRPC in our product built on .Net Framework. Due to the high volume of debug symbols in mainly libgrpc_csharp_ext.x64.so our build artifact has exploded from 50 MB to 400 MB. This introduced some problems in our CI/CD environment and also in our delivery chain due to low Internet bandwidth.

我想减小构建工件的大小.我知道可以使用 binutils/strip 命令从 libgrpc_csharp_ext.x64.so 中剥离调试符号.

I would like to reduce the size of our build artifact. I know that debug symbols can be stripped from libgrpc_csharp_ext.x64.so using binutils/strip command.

这是最好的方法吗?或者在 Visual Studio(csproj、sln)、Nuget 或 MSBuild 中是否有一些设置可用于从继承的 gRPC so 文件中删除调试信息?

Is that the best way? Or are there some settings in Visual Studio (csproj, sln), Nuget or MSBuild that can be applied to remove debug information from the inherited gRPC so files?

在 Windows 上使用 binutils/strip 的最简单方法是什么?

What is the easiest way to use binutils/strip on Windows?

推荐答案

恐怕 msbuild 无法做到这一点.so 文件是基于linux 的,VS IDE 是基于Windows 的,无法处理so 文件.它不是由 MSBuild、VS IDE 生成的,而是根据 RuntimeIdentifier 从 nuget 包复制到您的输出文件中.

I am afraid that msbuild cannot get that. so file is bases on linux and VS IDE is based on Windows and cannot handle the so file. And it is not generated by MSBuild, VS IDE and is copied from nuget package into your output files based on the RuntimeIdentifier.

但是该文件是由其他工具生成的,而不是 VS IDE,而 VS IDE 和 MSBuild 无法处理它,它只是从第三个工具复制到您的 VS IDE 中.

But the file is generated by other tool rather VS IDE and VS IDE and MSBuild cannot handle it and it is just copied from the third tool into your VS IDE.

其实,如果是dll类型(Windows),并且你有libgrpc_csharp_ext.x64项目的开源代码.

In fact, if it is dll type(Windows) and you have the open source code of the libgrpc_csharp_ext.x64 project.

注意:你必须在一开始就通过MSBuild修改开源代码,然后你才能生成没有dll信息的文件.并且没有其他选项可以在重新生成过程后删除调试信息.

Note: you have to modify the open source code by MSBuild at the very beginning and then you could generate the file without dll info. And there is no other option to remove the debug info after the re-generate process.

然后然后您可以将这些添加到 csproj 文件的底部:

And then you could add these at the bottom of the csproj file:

<PropertyGroup>

<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>

</PropertyGroup>

然后然后重建源代码以生成没有调试信息的dll.那就是 MSBuild 函数.

And then rebuild the source code to generate the dll without debug info. That is MSBuild function.

但是这是针对 Windows 的.它不适合您的 linux 文件.并且在 MSBuild、Nuget、csproj 文件上没有关于它的选项.

But that is for Windows. And it is not suitable for your linux file. And there is no option about it on MSBuild, Nuget, csproj file.

所以最好的功能是使用你的方法,使用 binutils/strip 命令的第三方剥离工具.而且更容易、更合适.

So the best function is use your method, third party stripping tool that uses binutils/strip command. And it is more easier and suitable.

这篇关于从 Windows 上的 libgrpc_csharp_ext.x64.so 剥离调试信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆