Memory run out problem
When I tried to build this repo as the README file, it always use out all of my memory. Even When I allocate another 100GB swapfile when ninja is using all the cores to run the build. For this kind of issue, I highly recommand here for anyone who wants to build this to speicify clang as the compiler using -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER and lld as the linker. Hope this will help.
Yes, maybe we can submit a pull...
Well, it's better using these with any project which takes llvm-project as a sub-module. Also if one wants to build llvm itself.
Well, it's better using these with any project which takes
llvm-projectas a sub-module. Also if one wants to buildllvmitself.
There maybe someone without Clang wants to build clang. So I think use comments just like mlir build process is fine...
Well, it's better using these with any project which takes
llvm-projectas a sub-module. Also if one wants to buildllvmitself.There maybe someone without Clang wants to build clang. So I think use comments just like mlir build process is fine...
Actually it's ok, anyone can use a pre-built clang binary provided by llvm under lots of linux distribution to build the clang inside the llvm-project. Say you want to build the latest version of clang, you can use a pre-built clang-14 or whatever. It's kinda weird but it works haha;)
Most of the memory is consumed by the linker. Changing the compiler is unlikely to have big impact, but changing the linker will. lld has a lower memory footprint, but there are two major cmake flags that help overall:
-
-DCMAKE_BUILD_TYPE=Releaseor-DCMAKE_BUILD_TYPE=RelWithDebInfoif you need debug symbols, debug builds consume a lot more when linking -
-DLLVM_PARALLEL_LINK_JOBS=1prevents the build system from running multiple linkers in parallel, each of which consumes memory.
Most of the memory is consumed by the linker. Changing the compiler is unlikely to have big impact, but changing the linker will.
lldhas a lower memory footprint, but there are two major cmake flags that help overall:
-DCMAKE_BUILD_TYPE=Releaseor-DCMAKE_BUILD_TYPE=RelWithDebInfoif you need debug symbols, debug builds consume a lot more when linking-DLLVM_PARALLEL_LINK_JOBS=1prevents the build system from running multiple linkers in parallel, each of which consumes memory.
Thanks! That's why I'm using lld wherever there is llvm ;)
Thanks, I will try. Building it is so slow and my memory is exhausted.