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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Alex Brachet-Mialot via llvm-dev
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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

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

Alex Brachet-Mialot via llvm-dev
Hello,

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 <[hidden email]> 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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev