建造LLVM吞噬了所有的公羊

发布于 2025-01-24 05:33:39 字数 223 浏览 0 评论 0原文

我一直在尝试在系统[i7 + 16GB RAM]上安装LLVM。我一直在关注本教程:。但是在建筑物中,它会自动吞噬所有RAM,并且终端会自动关闭。有什么办法解决这个问题吗?

谢谢。

I have been trying to install LLVM on my system [i7 + 16GB RAM]. I have been following this tutorial : LLVM Install. But in building, it eats up all the RAM and the terminal closes automatically. Is there any way to solve this?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黄昏下泛黄的笔记 2025-01-31 05:33:39

构建过程中消耗的资源可能取决于各种因素:

  • 您要构建的构建目标数量。通常,您应该能够跳过一堆构建目标(Compiler-rt,libcxx等)
  • 将生成的二进制类型。我的意思是,共享与静态。启用共享库(build_shared_libs:on)将减少内存的方式。
  • 优化标志的类型。调试,发行,RelwithDebinfo也将产生效果。调试构建将具有较大的二进制尺寸,因此在链接步骤中可能会消耗更多内存。但是,由于启用了很少的优化,构建时间将更快。在链接步骤中,发布构建可能会减少RAM。
  • 线程数-jn

用于降低RAM压力的TLDR:

  1. 启用共享库
  2. 使用版本构建构建构建
  3. 数量的并行线程数量低(而不是Max Jn尝试,-J(J)( n-2))。使用-J1可能会使用较少的RAM,但需要很长时间才能构建。
  4. 跳过构建作为许多库(例如,llvm_enable_runtimes)和目标(例如,llvm_targets_to_build)。这可能并不是微不足道的,因为它需要花费时间与cmakecache.txt文件。
  5. 仅构建您想要的东西,例如ninja,而是调用ninja clangninja opt等。

The resources consumed during build can depend on various factors:

  • Number of build targets that you are building. In general you should be able to skip a bunch of build targets (compiler-rt, libcxx etc)
  • The type of binaries that will be generated. I mean, shared vs. static. Enabling shared libraries (BUILD_SHARED_LIBS:ON) will consume way less memory.
  • The type of optimization flag. Debug, Release, RelWithDebInfo will also have an effect. The Debug build will have larger binary size so it may consume more memory during the link step. But the build time will be faster as few optimizations are enabled. Release build may consume less RAM during the link step.
  • Number of threads -jN

TLDR for reducing RAM pressure:

  1. Enable shared libraries
  2. Use Release builds
  3. Keep number of parallel threads low (Instead of max jN try, -j(N-2)). Using -j1 may use less RAM but would take long time to build.
  4. Skip building as many libraries (e.g., LLVM_ENABLE_RUNTIMES) and targets (e.g., LLVM_TARGETS_TO_BUILD) as you can. This may not be trivial as it requires spending time with the CMakeCache.txt file.
  5. Build only what you want e.g., instead of invoking just ninja, invoke ninja clang, or ninja opt etc.
楠木可依 2025-01-31 05:33:39

我在这个项目上度过了半天。
我有一台PC i7,带有24GB的RAM基unubuntu 22.04。我尝试过(很多次),但不可能用GCC编译(我不是为什么)。
系统监视器有时显示20GB RAM的使用情况,无法达到汇编结束。构建系统(我选择的忍者)崩溃了很多次。

最后,我安装了Clang。
RAM使用率从未超过8GB。
我报告了我所做的事情(如果可以帮助任何人)

preesion ninja warree ninja conter以下链接如何用clang构建clang?

I've spent half day on this item.
I've a PC i7 with 24GB of RAM based un Ubuntu 22.04. I tried (many times) but was not possible to compile with gcc (and I don't why).
The system monitor sometimes shown 20GB ram usage and wasn't possible to reach the end of the compilation. The build system (I choosen ninja) crashed many times.

At the end I installed clang.
The ram usage never gone over 8GB.
I report what I did (if can help anyone)

follow this link How to build clang with clang?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文