使用调试标志编译gcc

问题描述 投票:0回答:1

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

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

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

debugging gcc makefile configure libstdc++
1个回答
0
投票

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

使用--prefixconfigure选项指定替代安装位置,以避免替换系统gcc

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

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

© www.soinside.com 2019 - 2024. All rights reserved.