[llvm-dev] Building LLVM so it does not need gcc libraries anymore

Tobias Hieta via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 6 12:50:02 PST 2020


libgcc is the compiler runtime builtins. This defaults to gnu/gcc on linux.
You need to build compiler-rt builtins and crt in your first pass and then
pass --rtlib=compiler-rt in your flags (or maybe there is a
LLVM_USE_COMPILER_RT cmake variable but I can't check currently).

Hopefully this points you in the right direction.

-- Tobias

On Mon, Jan 6, 2020, 21:01 Meisam Fathi via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I am trying to bootstrap LLVM with LLVM so it does not depend on gcc
> libraries anymore, but I had little success. Is it possible to do it? If
> yes, what am I doing wrong?
> I download the llvm-8.0.1 tar.gz and build these llvm projects:
> llmv;libcxx;libcxxabi;clang;clang-tools-extra;compiler-rt;libunwind
> I do two round of building: a bootstrap round, and a final round.
> In the bootstrap round, I build llvm with clang-8 (downloaded form llvm
> apt-repo for ubuntu). I link with lld and I set -I, and -L to /include and
> /lib paths. I also set the rpath.
> In the final round, I copy the llvm binaries from the last round to a new
> and pristine system with nothing but the llvm source code on it (to make
> sure I do not depend on gcc libraries). Here I try to build the source
> code, one more time, with the binaries form the bootstrap round. But my
> bootstrap compiler, among other things, depends on -lgcc, and -lgcc_s. I am
> wondering if it is possible to build llvm/clang so it does not depend on
> them. I fiddled with multiple flags and options, including -nostdinc,
> -nostdinc++, -stdlib=libc++, etc, but with no success.
> Thanks,
> Meisam
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200106/b554a65e/attachment.html>

More information about the llvm-dev mailing list