在 gcc (mingw) 配置期间应该使用哪些选项来构建 libstdc++.dll 而不需要调试信息?
我配置gcc如下:
../配置 --prefix=/c/mbuild/release --enable-shared=libstdc++ --enable-threads --enable-version-specific-runtime-libs --enable-languages=c,c++ - -with-dwarf2 --disable-sjlj-exceptions --disable-win32-registry --disable-werror --disable-nls --disable-multilib --with-gmp=/c/mbuild/release --with-ppl =/c/mbuild/release --disable-ppl-version-check --with-cloog=/c/mbuild/release --disable-cloog-version-check --with-mpfr=/c/mbuild/release - -with-mpc=/c/mbuild/release --enable-libgomp --with-libiconv-prefix=/c/mbuild/release --enable-libstdcxx-debug --enable-cxx-flags='-s -O2' *--with-boot-ldflags='-s'* < strong>--with-boot-cflags='-s -O2' --with-boot-cxxflags='-s -O2' &>config.my.log
并构建:
make -j4 BOOT_CFLAGS='-s -O2' BOOT_CPPFLAGS='-s -O2' &>make.my.log
除了 libstdc++-6.dll 之外,我已经对所有内容进行了优化。它的大小是5Mb!
那么...在 gcc (mingw) 配置过程中我应该使用哪些选项来构建 libstdc++.dll 而不需要调试信息?
注意:
我需要 libstdc++ 的调试和发布版本,因此我使用
--enable-libstdcxx-debug - 除了正常构建的库之外,还构建单独的调试库。
该标志生成另一个 libstdc++-6.dll(lib 目录中的某个位置),它比 bin 目录中的 dll 更大。
I configured gcc as follows:
../configure
--prefix=/c/mbuild/release --enable-shared=libstdc++ --enable-threads --enable-version-specific-runtime-libs --enable-languages=c,c++ --with-dwarf2 --disable-sjlj-exceptions --disable-win32-registry --disable-werror --disable-nls --disable-multilib --with-gmp=/c/mbuild/release --with-ppl=/c/mbuild/release --disable-ppl-version-check --with-cloog=/c/mbuild/release --disable-cloog-version-check --with-mpfr=/c/mbuild/release --with-mpc=/c/mbuild/release --enable-libgomp --with-libiconv-prefix=/c/mbuild/release
--enable-libstdcxx-debug --enable-cxx-flags='-s -O2' *--with-boot-ldflags='-s'* --with-boot-cflags='-s -O2' --with-boot-cxxflags='-s -O2' &>config.my.log
and build:
make -j4 BOOT_CFLAGS='-s -O2'
BOOT_CPPFLAGS='-s -O2' &>make.my.log
I've got everything optimized, except libstdc++-6.dll. It size is 5Mb!
So... What options should i use during gcc (mingw) configuration to build libstdc++.dll without debugging information?
NOTE:
I need debug and release versions of libstdc++, so I'm using
--enable-libstdcxx-debug - Build separate debug libraries in addition to what is normally built.
This flag makes another libstdc++-6.dll (somwhere in lib dir), wich is larger, than dll in the bin dir.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将 strip 选项传递给链接器,而不是编译器 (-s)。对于编译器,您应该传递“-g -O0”进行调试构建,这意味着包括调试信息+直接代码生成,无需任何优化(最后一个是针对您阅读 disasm 代码的情况,它使内容更清晰)。因此,尝试在构建时添加 LDFLAGS 环境变量 -s 选项。
作为替代方案,您可以使用“strip”程序(MSYS 的一部分)从可执行文件和/或库二进制文件中删除所有调试信息。
You should pass strip option to linker, not to compiler (-s). And to compiler you should pass "-g -O0" for debug build, which means include debug information + stright code generation without any optimization (the last one is for case you read disasm code, it makes stuff clearer). So, try adding to LDFLAGS environment variable -s option for build time.
As an alternative, you could use "strip" program (part of MSYS) to strip all debug info from executable and/or library binary file.