首页 文章

在gcc(mingw)配置期间我应该使用哪些选项来构建libstdc .dll而不需要调试信息?

提问于
浏览
1

我配置gcc如下:

../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'&gt> config.my.log

并 Build :

make -j4 BOOT_CFLAGS =' - s -O2'BOOT_CPPFLAGS =' - s -O2'&> make.my.log

除了libstdc -6.dll之外,我已经对所有内容进行了优化 . 它的大小是5Mb!
那么......在gcc(mingw)配置中我应该使用哪些选项来构建没有调试信息的libstdc .dll?

NOTE:
我需要libstdc的调试和发布版本,所以我正在使用
--enable-libstdcxx-debug - 将单独的调试库 in addition 构建为通常构建的 .
这个标志使另一个libstdc -6.dll(lib目录中的somwhere)比bin目录中的dll大 .

1 回答

  • 0

    您应该将strip选项传递给链接器,而不是传递给编译器(-s) . 对于编译器,你应该传递“-g -O0”进行调试构建,这意味着包括调试信息直接代码生成而不进行任何优化(最后一个是为了你读取disasm代码,它使事情更清晰) . 因此,尝试添加LDFLAGS环境变量-s选项以构建时间 .

    作为替代方案,您可以使用“strip”程序(MSYS的一部分)从可执行文件和/或库二进制文件中删除所有调试信息 .

相关问题