【问题标题】:Compiling gcc with debug flags使用调试标志编译 gcc
【发布时间】:2020-02-19 18:27:06
【问题描述】:

我正在尝试从带有调试标志的源代码构建 gcc 版本 10.00.1,以使某些功能(例如来自 STL 的方法)能够在 GDB 中打印。现在 GDB 会说诸如“找不到方法 std::stringstream::str”之类的东西,即使我在编译程序时打开了 -g3 标志。

gcc 的文档说使用--enable-libstdcxx-debug 标志配置应用程序以启用此支持。我决定使用与我的发行版配置的 gcc 相同的标志来构建应用程序,这些标志是

-v --with-pkgversion='Debian 9.2.1-28' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex

在成功make 和make install 之后,我仍然遇到 GDB 找不到方法的相同问题。我决定只用--enable-libstdc++-debug 标志自己构建libstdc++。但是我在构建中的任何地方都找不到 libstdc++.so.6 文件的位置。我还没有运行make install,因为我不想破坏我的系统。 libstdc++.so.6 应该位于构建中的什么位置?谢谢

【问题讨论】:

标签: debugging gcc makefile configure libstdc++


【解决方案1】:

我还没有运行make install,因为我不想破坏我的系统。

使用--prefix 选项到configure 指定备用安装位置以避免替换您的系统gcc。

我决定仅使用 --enable-libstdc++-debug 标志自行构建 libstdc++。

确保在重新configure 之后make clean,以便make 使用新的编译器和链接器标志重建它。

【讨论】:

    猜你喜欢
    • 2017-02-27
    • 1970-01-01
    • 2017-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多