[llvm-dev] (Thin)LTO llvm build

Xinliang David Li via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 27 15:56:58 PDT 2016


If you have recent host binutils (e.g, under /usr/bin), you can create a
symlink to LLVMgold.so in /usr/lib/bfd-plugins dir. With that setup, the
host ar/ranlib/nm can be used for thinLTO/LTO build without the need to set
CMAKE_RANLIB etc.

David

On Tue, Sep 27, 2016 at 9:33 AM, Teresa Johnson via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I can't reproduce the failure. I am building with a clang built Release
> from recent source as my stage-1 bootstrap compiler:
>    clang version 4.0.0 (trunk 282322) (llvm/trunk 282341)
>
> I am configuring the stage-2 bootstrap compiler with the following
> command, which largely is copied from your earlier email with your cmake
> command (changes noted below):
>
>   lto=Thin
>   type=Release
>   cflgs=-w
>   INSTALL_PREFIX=$HOME/llvm/${build_dir_name}/clang-install
>   BUILD_COMPILER=$HOME/llvm/llvm_10_release_build
>   SRC=$HOME/llvm/llvm_head
>   BINUTILS=$HOME/binutils/binutils
>   env DYLD_LIBRARY_PATH=$BUILD_COMPILER/lib/ \
>   cmake \
>     -G Ninja \
>     -DCMAKE_BUILD_TYPE=${type} \
>     -DLLVM_BINUTILS_INCDIR=$BINUTILS/include \
>     -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
>     -DLLVM_TARGETS_TO_BUILD="X86" \
>     -DLLVM_ENABLE_BACKTRACES=OFF \
>     -DLLVM_BUILD_EXAMPLES=OFF \
>     -DLLVM_INCLUDE_EXAMPLES=OFF \
>     -DLLVM_BUILD_TESTS=OFF \
>     -DLLVM_INCLUDE_TESTS=OFF \
>     -DLLVM_BUILD_DOCS=OFF \
>     -DLLVM_INCLUDE_DOCS=OFF \
>     -DLLVM_ENABLE_DOXYGEN=OFF \
>     -DLLVM_ENABLE_SPHINX=OFF \
>     -DLLDB_DISABLE_PYTHON=ON \
>     -DCLANG_PLUGIN_SUPPORT=OFF \
>     -DLLVM_ENABLE_LTO=${lto} \
>     -DCMAKE_C_COMPILER=$BUILD_COMPILER/bin/clang \
>     -DCMAKE_CXX_COMPILER=$BUILD_COMPILER/bin/clang++ \
>     -DCMAKE_AR=$BUILD_COMPILER/bin/llvm-ar \
>     -DCMAKE_RANLIB=$BUILD_COMPILER/bin/llvm-ranlib \
>     -DLLVM_PARALLEL_LINK_JOBS=1 \
>     -DBUILD_SHARED_LIBS=ON \
>     -DCMAKE_C_FLAGS=${cflgs} \
>     -DCMAKE_CXX_FLAGS=${cflgs} \
>     -DCMAKE_EXE_LINKER_FLAGS=${linkflgs} \
>     $SRC
>
> The changes from your config:
> 1) Used llvm-ar and llvm-nm from the build compiler. I noticed that you
> are specifying those as coming from the same directory used for
> CMAKE_INSTALL_PREFIX, which seems wrong - that is where the compiler built
> here will be installed.
> 2) Used my own binutils checkout as I don't have plugin-api.h installed in
> /usr/include
> 3) Set BUILD_SHARED_LIBS=ON (which I don't see in your earlier config, did
> you add that later?)
> 4) Set LLVM_PARALLEL_LINK_JOBS=1 (probably not needed)
> 5) Build with -w, to avoid occasional issues with warnings only emitted by
> clang (probably not needed)
> 6) Specified CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly (you might
> have had the right versions in your path?)
>
> I did an nm on the .so libraries to see where __morestack was referenced
> and its linkage. No surprise, it is coming from libLLVMRuntimeDyld.so, and
> I do see it as weak as expected:
>
> $ nm lib/libLLVMRuntimeDyld.so | grep morestack
>                  w __morestack
>
> Can you do the above nm on your lib/libLLVMRuntimeDyld.so and send me the
> output?
>
> Thanks,
> Teresa
>
> On Tue, Sep 27, 2016 at 7:00 AM, Teresa Johnson <tejohnson at google.com>
> wrote:
>
>>
>>
>> On Tue, Sep 27, 2016 at 6:53 AM, Mehdi Amini <mehdi.amini at apple.com>
>> wrote:
>>
>>>
>>>
>>> > On Sep 27, 2016, at 2:18 AM, Carsten Mattner <carstenmattner at gmail.com>
>>> wrote:
>>> >
>>> >> On Mon, Sep 26, 2016 at 11:02 PM, Teresa Johnson <
>>> tejohnson at google.com> wrote:
>>> >> I'll either need to get a reproducer from you and/or try to repro it
>>> myself.
>>> >
>>> > Assuming I run into this with BUILD_SHARED_LIBS=OFF, which seems
>>> unlikely,
>>> > what kind of reproducer data would you need from me?
>>>
>>
>> Let me see if I can reproduce it first. Probably a zip of all the inputs
>> to the link and the link command line. Another option would be to save the
>> temp files, but it would require some work to find the one producing the
>> error and I might need all the inputs anyway...
>>
>>
>>> >
>>> >> I usually don't check out and build lldb, so perhaps I will start
>>> with that.
>>> >
>>> > I must say I'm surprised a ThinLTO build of all of LLVM svn isn't part
>>> of
>>> > the periodic builders.
>>>
>>>
>>> I have one, it just does include LLDB.
>>>
>>
>> Great, I was going to ask how to get one set up. Is it an official build
>> bot? And I assume you meant it just does "not" include LLDB?
>>
>> Working getting a shared build of LLDB right now...
>>
>> Teresa
>>
>>
>>> Mehdi
>>> >
>>> >> As a workaround you could try -DBUILD_SHARED_LIBS=OFF.
>>> >
>>> > Thanks, will do, but probably not before Wednesday because it looks
>>> like
>>> > this requires a full rebuild, if my interpretation of the cmake
>>> warning/error
>>> > is correct.
>>>
>>
>>
>>
>> --
>> Teresa Johnson |  Software Engineer |  tejohnson at google.com |
>> 408-460-2413
>>
>
>
>
> --
> Teresa Johnson |  Software Engineer |  tejohnson at google.com |
> 408-460-2413
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://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/20160927/95eb2c21/attachment.html>


More information about the llvm-dev mailing list