<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>Many thanks for this advice. I'm just now getting back to this.
      If I solve the libgcc_s problem, I'll let you know.</p>
    <p>Thanks again,</p>
    <p>Chris.<br>
    </p>
    <div class="moz-cite-prefix">On 2/19/20 4:02 PM, Richard Smith
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAOfiQqkKwFgJhgKwUnJbuaD_joW9PUCyky2S+ZYxOcu4PKFT_g@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">On Thu, 23 Jan 2020 at 07:24, Christopher H Green
          via cfe-users <<a href="mailto:cfe-users@lists.llvm.org" moz-do-not-send="true">cfe-users@lists.llvm.org</a>>
          wrote:<br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div>
              <p>Hi,</p>
              <p>I've spent the last several days trying to build a
                fast, full-featured relocatable distribution of
                LLVM/Clang 9.0.1 on Linux RHEL7, which has an older
                native GCC (4.8.5)—I can't require the RH toolset. I
                have access to a modern version of GCC in order to make
                the stage-1 build, but I need the final product not only
                to be relocatable, but also to be free of any dependence
                on that GCC or its libraries. In other words, I want to
                be able to distribute an LLVM/CLang which defaults to
                compiling using libc++, libcxxabi, compiler-rt,
                libunwind, and ldd, and which itself depends neither on
                libstdc++ or  libgcc_s. I'd also like to be able to to
                provide LTO, but whether the compiler is itself the
                beneficiary of LTO is optional. As a final wish, I'd
                like the distribution as installed to serve as an SDK
                against which to build other components such as
                separately packaged lldb and f18. Oh, and I want a pony.</p>
              <p>Here's what I have so far (CMake cache files attached
                for stages 1 and 2). Invoked  in a separate build
                directory with:</p>
              <pre>env CC=gcc-9 CXX=g++-9 \
'CXXFLAGS=-Wno-cast-function-type -Wno-deprecated-copy -Wno-init-list-lifetime -Wno-pessimizing-move -Wno-redundant-move -Wno-uninitialized -Wno-unused-function -Wno-unused-variable' \
cmake -GNinja -C FNAL.cmake -DCMAKE_INSTALL_PREFIX=<install-path> \
-DBOOTSTRAP_LLVM_CXX_STD=c++17 <src-path>
ninja
ninja install
</pre>
              <p>(The <tt>CXXFLAGS</tt> are just to keep the noise down
                during the stage-1 build).<br>
              </p>
              <p>I appear (finally) to have a mostly functioning build <i>in
                  situ</i>, but the installed compiler depends upon
                libstdc++ to be able to run, and I should have put
                <tt>--rtlib=compiler-rt</tt> in <tt>LINKER_FLAGS</tt>
                rather than <tt>CXX_FLAGS</tt>. Additionally, I haven't
                been able to come up with a good set of targets for
                <tt>LLVM_DISTRIBUTION_COMPONENTS</tt>, but when I do I
                think I need to exclude static libraries if I'm doing
                LTO, no?<br>
              </p>
              <p>I suspect I need a three stage build—well, two stage
                2s, at least—but any advice would be appreciated as I'm
                wandering around in the dark at this point.
                <br>
              </p>
            </div>
          </blockquote>
          <div>I have a two-stage setup that builds a GCC-free Clang
            except for libgcc_s (I've not looked at what's pulling that
            in yet, but I expect that's resolvable).<br>
          </div>
          <div><br>
          </div>
          <div>My stage1 cmake setup
            has: -DCLANG_DEFAULT_CXX_STDLIB=libc++
            -DCLANG_DEFAULT_RTLIB=compiler-rt</div>
          <div>My stage2 cmake setup additionally
            has: -DLIBCXXABI_USE_LLVM_UNWINDER=ON
            -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXX_USE_COMPILER_RT=ON</div>
          <div>(and points CMAKE_C_COMPILER and CMAKE_CXX_COMPILER at
            the stage1 clang).</div>
          <div><br>
          </div>
          <div>There might be some other things you need, I'm not sure.
            But it should be doable in two stages.</div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div>
              <p>
              </p>
              <p>Many thanks for any help,</p>
              <p>Chris.</p>
              <p><br>
              </p>
            </div>
            _______________________________________________<br>
            cfe-users mailing list<br>
            <a href="mailto:cfe-users@lists.llvm.org" target="_blank" moz-do-not-send="true">cfe-users@lists.llvm.org</a><br>
            <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dusers&d=DwMFaQ&c=gRgGjJ3BkIsb5y6s49QqsA&r=kj1IkzpbbOO6DafO4zbQ7w&m=FIIJJm01Dy-T_1Fy2242m46OGICK9DChJUP91xh3UXg&s=2qYj-B0uBuvWEJmOP60fqRlTLu-3sXE_Va_7usXqMtQ&e=" rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>