How to edit and re-build the GCC libstdc++ C++ standard library source?(如何编辑和重新构建 GCC libstdc++ C++ 标准库源代码?)
问题描述
我正在进行一些研究,想编辑 libstdc++ 库中的一些源代码以进行实验.我特别有兴趣尝试并行排序算法.有没有地方可以找到文档来轻松编辑和构建源代码?
I am working on some research and would like to edit some of the source code in the libstdc++ library for experimentation. I am, specifically, interested in experimenting with the parallel sorting algorithms. Is there a place I can find documentation to easily edit and build the source code?
我尝试构建各种版本的 libstdc++ 库,但没有成功.似乎大多数新版本都需要构建整个 gcc 包,这是一个漫长得多的过程,尤其是当我要在 libstdc++ 中编辑和试验一些文件时.
I have tried, unsuccessfully, to build various versions of the libstdc++ library. It seems like most new versions require building the entire gcc package, which is a much more lengthy process, especially if I am going to be editing and experimenting with a few files in libstdc++.
我也找不到包含并行排序算法的源文件.我似乎只能找到定义函数的头文件,而不是源代码本身.任何建议或文档链接将不胜感激.
I have also been unable to find the source files that contain the parallel sorting algorithms. I can only seem to find the header files that define the functions, and not the source code itself. Any advice or links to documentation would be greatly appreciated.
推荐答案
是的,您必须构建整个 GCC,但是一旦完成,您只需要重新构建 libstdc++ 部分.
Yes, you have to build the whole of GCC, but once you've done that you only need to rebuild the libstdc++ part.
在http://gcc.gnu.org/wiki/InstallingGCC
libstdc++ 源代码位于 libstdc++-v3
目录中.并行算法在 libstdc++-v3/include/parallel
中,它们是模板,因此所有代码都在标题中.少量非头代码在libstdc++-v3/src/c++98/parallel-settings.cc
The libstdc++ sources are in the libstdc++-v3
directory. The parallel algorithms are in libstdc++-v3/include/parallel
, they are templates so all the code is in headers. The small amount of non-header code is in libstdc++-v3/src/c++98/parallel-settings.cc
在正常配置和构建整个 GCC 后,您可以通过在 $TARGET/libstdc++-v3
目录(其中 $TARGET
类似于 x86_64-pc-linux-gnu
).
After configuring and building the whole of GCC as normal, you can rebuild libstdc++ by running make
in the $TARGET/libstdc++-v3
directory (where $TARGET
is something like x86_64-pc-linux-gnu
).
默认情况下,makefile 没有正确的依赖关系,导致对象在标头更改后重建,因此您可能需要执行 make clean
然后再次执行 make
以获得您的更改将被接受.
By default the makefiles don't have proper dependencies that cause objects to be rebuilt after headers change, so you might need to do make clean
then make
again to get your changes to be picked up.
这篇关于如何编辑和重新构建 GCC libstdc++ C++ 标准库源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何编辑和重新构建 GCC libstdc++ C++ 标准库源代码?
基础教程推荐
- 使用从字符串中提取的参数调用函数 2022-01-01
- 从 std::cin 读取密码 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01