On 03/20/2017 03:33 PM, Jonathan Roelofs wrote:> On 3/20/17 1:47 PM, Evandro Menezes via llvm-dev wrote: >> Folks, >> >> I'm at a loss trying to add Compiler-RT to an LLVM build, even after >> checking out the instructions at http://compiler-rt.llvm.org, so I'd >> appreciate your help. >> >> I've tried adding the CMake options LLVM_ENABLE_PROJECTS, >> LLVM_BUILD_EXTERNAL_COMPILER_RT, LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR, >> CLANG_DEFAULT_RTLIB. All to no avail. > > You'll need to give a lot more details on what you tried, and how it > failed. Without that information, nobody can really help you.OK, what else can I say? I checked out the projects side by side, as I usually do: ~/src/llvm.tip $ ls clang compiler-rt klee libcxx lld llvm clang-tools-extra dragonegg libclc libcxxabi lldb polly So I expected that setting LLVM_ENABLE_PROJECTS="clang;compiler-rt" would be enough to get Compiler-RT added to a functional build tree, since setting it to just "clang" does result in Clang being built. I tired the other variables above for good measure, alas unsuccessfully. In the end, everything gets built as before, except for Compiler-RT, which I expect to be any built-in and sanitizer libraries. Thank you, -- Evandro Menezes
On 3/20/17 3:21 PM, Evandro Menezes via llvm-dev wrote:> On 03/20/2017 03:33 PM, Jonathan Roelofs wrote: >> On 3/20/17 1:47 PM, Evandro Menezes via llvm-dev wrote: >>> Folks, >>> >>> I'm at a loss trying to add Compiler-RT to an LLVM build, even after >>> checking out the instructions at http://compiler-rt.llvm.org, so I'd >>> appreciate your help. >>> >>> I've tried adding the CMake options LLVM_ENABLE_PROJECTS, >>> LLVM_BUILD_EXTERNAL_COMPILER_RT, LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR, >>> CLANG_DEFAULT_RTLIB. All to no avail. >> >> You'll need to give a lot more details on what you tried, and how it >> failed. Without that information, nobody can really help you. > > OK, what else can I say? > > I checked out the projects side by side, as I usually do: > > ~/src/llvm.tip $ ls > clang compiler-rt klee libcxx lld llvm > clang-tools-extra dragonegg libclc libcxxabi lldb pollyThe instructions on http://compiler-rt.llvm.org are for building compiler-rt separately from llvm, which is not how most people build it. If you're just getting started with it, I'd recommend doing it the other way, and that is to do a combined-tree build. For that you'll want: * symlinks in llvm/runtimes to each of libcxx, libcxxabi, compiler-rt respectively * symlinks in llvm/tools to clang, lld, and lldb respectively * symlink from llvm/tools/clang/tools/extra to clang-tools-extra Dragonegg is dead, and you probably don't want klee / polly unless you know what you're doing.> > So I expected that setting LLVM_ENABLE_PROJECTS="clang;compiler-rt" > would be enough to get Compiler-RT added to a functional build tree, > since setting it to just "clang" does result in Clang being built.Interesting. Didn't know the build would do that (assuming you didn't already have the symlink in place for clang). Jon> I tired the other variables above for good measure, alas unsuccessfully. > > In the end, everything gets built as before, except for Compiler-RT, > which I expect to be any built-in and sanitizer libraries. > > Thank you, >-- Jon Roelofs jonathan at codesourcery.com CodeSourcery / Mentor Embedded
On 03/20/2017 04:33 PM, Jonathan Roelofs wrote:> On 3/20/17 3:21 PM, Evandro Menezes via llvm-dev wrote: >> On 03/20/2017 03:33 PM, Jonathan Roelofs wrote: >>> On 3/20/17 1:47 PM, Evandro Menezes via llvm-dev wrote: >>>> Folks, >>>> >>>> I'm at a loss trying to add Compiler-RT to an LLVM build, even after >>>> checking out the instructions at http://compiler-rt.llvm.org, so I'd >>>> appreciate your help. >>>> >>>> I've tried adding the CMake options LLVM_ENABLE_PROJECTS, >>>> LLVM_BUILD_EXTERNAL_COMPILER_RT, LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR, >>>> CLANG_DEFAULT_RTLIB. All to no avail. >>> >>> You'll need to give a lot more details on what you tried, and how it >>> failed. Without that information, nobody can really help you. >> >> OK, what else can I say? >> >> I checked out the projects side by side, as I usually do: >> >> ~/src/llvm.tip $ ls >> clang compiler-rt klee libcxx lld llvm >> clang-tools-extra dragonegg libclc libcxxabi lldb polly > > The instructions on http://compiler-rt.llvm.org are for building > compiler-rt separately from llvm, which is not how most people build > it. If you're just getting started with it, I'd recommend doing it the > other way, and that is to do a combined-tree build. For that you'll want: > > * symlinks in llvm/runtimes to each of libcxx, libcxxabi, > compiler-rt respectively > * symlinks in llvm/tools to clang, lld, and lldb respectively > * symlink from llvm/tools/clang/tools/extra to clang-tools-extracompiler-rt needs clang to be able to generate the code for the intended targets. The suggestion above finally worked, but got stopped at the lack of a multiarch linker and archiver. And the build files of compiler-rt don't seem to provide a way to specify either for specific targets. Building compiler-rt separately from clang might allow one to specify ancillary tools used just for its build. Thank you, -- /Evandro Menezes/