<div><div dir="auto">I don’t personally develop on Mac (i use Windows), but I have an analogous setup there where i use ninja to build and Visual Studio for editing, debugging, etc.</div></div><div dir="auto"><br></div><div dir="auto">What i do, and I assume it will be the same or very similar for Xcode, is to run cmake twice, once with Ninja, and once with VS (Xcode for you), from separate directories.  I build with the ninja one (“ninja clang” on command line), and I change  the debugger target from the default to point directly into my ninja directory , so VS is debugging the thing that was built with ninja.</div><div dir="auto"><br></div><div dir="auto">Hopefully that makes sense</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 7, 2019 at 11:59 AM Joan Lluch <<a href="mailto:joan.lluch@icloud.com">joan.lluch@icloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi zturner<div><br></div><div>Please, would you describe me step by step how do I get both a Xcode project and a Ninja setup for compiling the same?<div><br></div><div>I have downloaded the Ninja-mac binary from here <a href="https://github.com/ninja-build/ninja/releases" target="_blank">https://github.com/ninja-build/ninja/releases</a> and have setup system path to it.  What’s next?</div><div><br></div><div>Thanks</div></div></div><div style="word-wrap:break-word"><div><div><br></div><div><br><div><br></div><div><br><div><blockquote type="cite"><div>On 7 Jul 2019, at 19:23, Zachary Turner <<a href="mailto:zturner@roblox.com" target="_blank">zturner@roblox.com</a>> wrote:</div><br class="m_-6233973605883749661Apple-interchange-newline"><div><div><div dir="auto">I’m not saying you can’t use Xcode, I’m just saying that instead of *building* in Xcode, just type “ninja” on the command line to do your build and then use Xcode as you normally would.</div></div><div dir="auto"><br></div><div dir="auto">I don’t think it’s the case that LLVM does not intend to support Xcode, just that its a community driven project, so unless someone is sufficiently motivated to fix whatever this problem is, it might stay this way for some time.  On that note, patches are certainly welcome, but if you just want to unblock yourself, the easiest way is going to be to type a command on the command line to do your build instead of pressing a button in the UI (and you could still use the UI for everything else)</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 7, 2019 at 9:40 AM Joan Lluch <<a href="mailto:joan.lluch@icloud.com" target="_blank">joan.lluch@icloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><br>Hi zturner,<div><br></div><div>I understand what you say and I have been suggested this a couple of times, but I really don’t want to make the switch to ninja. I’m a retired senior software developer and I just use LLVM for a custom backend that I have already almost completed in LLVM 7.0. I’m not really into LLVM-project development, and Xcode is both familiar and fast enough for incremental builds of ‘llc’ or ‘clang’ alone including my target backend, (or it used to be in 7.0). It’s just the right tool for me. </div><div><br></div><div>On the other hand I think that in case there’s no intention to fully support Xcode in the future, then it should be removed from de doc descriptions to prevent deceptive information. Otherwise, at least major issues like this one, should be taken care of. </div><div><br></div><div>John</div></div><div dir="auto"><div><br></div><div><br><div dir="ltr"><br>On 7 Jul 2019, at 17:08, Zachary Turner <<a href="mailto:zturner@roblox.com" target="_blank">zturner@roblox.com</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><div><div dir="auto">Try using ninja generator, most people do not use Xcode for building, so since it lesser-used, it also lesser tested.  Note that it’s perfectly possible to use Xcode for code browsing, debugging, editing while using ninja for building, which is what I think most people do</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 7, 2019 at 4:20 AM Joan Lluch via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I also filled a bug report. I think this is actually a bug<div><br></div><div><a href="https://bugs.llvm.org/show_bug.cgi?id=42528" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=42528</a></div><div><br></div><div>John</div></div><div style="word-wrap:break-word"><div><br></div><div><br></div><div><blockquote type="cite"><div>On 7 Jul 2019, at 09:27, Joan Lluch via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519Apple-interchange-newline"><div><div style="word-wrap:break-word"><div>I understand that a difference between ninja and xcode is they use a different way to determine code dependencies. So to my understanding xcode needs dependencies to be properly created whereas ninja just doesn’t care. Maybe this is why ninja is able to find what it needs for the compilation to succeed, but not xcode.</div><div><br></div><div>So I have now looked at the CMakeLists.txt files and found that all the missing libraries are defined in files under the ‘clang’ directory. </div><div><br></div><div>The llvm_project clone has the following structure:</div><div><br></div><div>llvm-project</div><div><span class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519Apple-tab-span" style="white-space:pre-wrap"> </span>llvm</div><div><span class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519Apple-tab-span" style="white-space:pre-wrap">   </span>clang</div><div><span class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519Apple-tab-span" style="white-space:pre-wrap">  </span>(others)</div><div><br></div><div>Everything  under ‘llvm’ is properly compiled with no issues, however what is under ‘clang’ fails to compile (with linker errors) even if -DLLVM_ENABLE_PROJECTS=“clang” is specified.</div><div><br></div><div>I suspect now that there may be some kind of bug in the llvm project that prevents this to work properly, or maybe something else needs to be done to get clang compiled on xcode. I also suspect that this may pass unnoticed when using ninja because it simply uses it’s own way to find dependencies (but I don’t really know anything about ninja). </div><div><br></div><div>Maybe this may help somebody to figure out what could be happening and hopefully help me to narrow the issue? I honestly am totally lost on what to try next. This is kind of ridiculous.</div><div><br></div><div>Thanks</div><div><br></div><br><div><blockquote type="cite"><div>On 6 Jul 2019, at 23:49, Neil Nelson <<a href="mailto:nnelson@infowest.com" target="_blank">nnelson@infowest.com</a>> wrote:</div><br class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519Apple-interchange-newline"><div>
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><p><font size="-1">Joan,</font></p><p><font size="-1">Just completed a good clang compile built from a
        mostly vanilla Xubuntu 19.04 VM, installed the llvm-needed
        Ubuntu packages, downloaded a new copy of llvm using the noted
        llvm install page, configured using</font></p><p><font size="-1">cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang"
        -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE="Release"
        -DCMAKE_INSTALL_PREFIX=/home/nnelson/Documents/llvm/install
        ../llvm &> cmake.log</font></p><p><font size="-1">which is primarily different from yours where I
        am using a 'Release' build to avoid the much larger memory and
        disk usage of a 'Debug' build. The 'ninja install' command put
        everything in </font><font size="-1"><font size="-1">llvm/install
          as expected including clang. I look through </font></font><font size="-1"><font size="-1"><font size="-1">cmake.log to see if
            there are errors that need to be corrected.<br>
          </font></font></font></p><p><font size="-1">My differences appear to be Xubuntu, the
        packages, ninja, and the cmake line.</font></p><p><font size="-1">On Linux I can use</font></p><p><font size="-1">ninja &> ninja_compile.log</font></p><p><font size="-1">to look at the compile history and see if
        something went wrong.</font></p><p><font size="-1">Neil<br>
      </font></p>
    <div class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519moz-cite-prefix"><font size="-1">On 7/6/19 12:00 AM,
        Joan Lluch wrote:<br>
      </font></div>
    <blockquote type="cite">
      
      <div><font size="-1">Hi Nelson,</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">Thanks for your reply. </font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">The “build/Debug/lib” and
          "build/Release/lib” directories is where all the libraries go.
          Similarly, the executables go to “build/Debug/bin” and
          “build/Release/bin” before they are moved to the install
          directory. This is expected and normal. However, the problem
          is that a small number of libraries (exactly 20 in total) are
          not created at all for the LLVM 9.0 version that I cloned from
          gitHub. These libraries are in fact not created anywhere!.</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">I still have LLVM 7.0 installed in
          my computer and the libraries for that version are all there
          in the right places under the LLMV 7.0 directory, but in that
          case I installed it all in a different way as I said, loosing
          the benefits of git.</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">I forgot to mention that “llc” alone
          compiles and links correctly without any issue. The problem is
          only when I try to get ‘clang’ compiled.</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">You mention that you enabled a lot
          of projects:
 "clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llvm;openmp;parallel-libs;polly;pstl”.
          I only really need the basic installation of “clang”, and I do
          not need any testing tools because all I want is to add my
          custom target to it. I also tried "clang;libclc;libcxx” but
          the problem with the missing libraries is exactly the same.</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">Just as a matter of information: I
          successfully implemented a custom target backend, and have it
          almost finished and running perfectly on LLVM 7.0. Now, I just
          want to move it to LLVM 9.0, but got stuck in what is supposed
          to be the easiest part which is just compiling it (??), but I
          do not understand why it doesn’t compile!</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">Any ideas?</font></div>
      <div><font size="-1"><br>
        </font></div>
      <div><font size="-1">Joan</font></div>
      <div><br>
      </div>
      <blockquote type="cite">
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">John, I compiled and installed to
            /usr/local all the projects under llvm except llgo
            yesterday. The three files you noted are in</font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">../llvm-project/build/lib<br>
          </font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">I do not have a llvm-project/build/Debug
            directory.</font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">Xubuntu 19.04. llvm downloaded from
            github on 6/18 using instructions from the page you note.</font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">cmake -G Ninja
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llvm;openmp;parallel-libs;polly;pstl"
            -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE="Release" ../llvm</font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">Installed additional packages as needed.<br>
          </font></div>
        <div style="margin-top:0px;margin-bottom:0px"><font size="-1">Neil<br>
          </font></div>
        <div class="m_-6233973605883749661m_1660482493497528008m_-2932764727722687519moz-cite-prefix"><font size="-1">On 7/5/19
            6:46 AM, Joan Lluch via llvm-dev wrote:<br>
          </font></div>
        <blockquote type="cite">
          <div dir="auto" style="word-wrap:break-word"><font size="-1">Hi All,</font>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">I am looking for the
                best way to install LLVM+clang,  but I do not seem to
                find a way that works for me.</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">I followed the steps
                in this document <a href="https://llvm.org/docs/GettingStarted.html" target="_blank">Getting Started with
                  the LLVM System — LLVM 9 documentation</a> except that
                I created the following folder structure as I do not
                want clang and llc to go to /usr/local</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">LLVM-9</font></div>
            <div><font size="-1">   llvm-project
                 (cloned from github)</font></div>
            <div><font size="-1">   install</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">I ran the following
                command line from the build directory in llvm-project as
                described in the doc, but added the
                DLLVM_OPTIMIZED_TABLEGEN=On variable :</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div>
              <div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><font size="-1"><span style="font-variant-ligatures:no-common-ligatures">cmake
                    -G Xcode -DLLVM_ENABLE_PROJECTS=clang
                    -DCMAKE_INSTALL_PREFIX=/Users/joan/LLVM-9/install
                    -DLLVM_OPTIMIZED_TABLEGEN=On ../llvm</span></font></div>
            </div>
            <div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><font size="-1"><br>
              </font></div>
            <div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font size="-1">The cmake command above seems to work ok, but
                after that, when I compile the “install” or “build_all”
                schemes I get a lot of linker errors. Such as these ones
                and more:</font></div>
            <div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font size="-1"><br>
              </font></div>
            <div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)">
              <div style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:Menlo"><font size="-1">clang:
                  error: no such file or directory:
                  '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangAST.a'</font></div>
              <div style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:Menlo"><font size="-1">clang:
                  error: no such file or directory:
                  '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangLex.a'</font></div>
              <div style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:Menlo"><font size="-1">clang:
                  error: no such file or directory:
                  '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangBasic.a'</font></div>
            </div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">Up until recently, I
                have worked with LLVM 7.0 and all what I did was
                downloading both llvm and clang from <a href="http://llvm.org/" target="_blank">llvm.org</a>,
                copied clang into llvm/tools, and ran the cmake
                application (not command line).  That kind of worked
                except for some minor glitches but of course I didn’t
                get the benefits of git.</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">So what am I doing
                wrong now? Why I’m getting such linker errors?</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">It seems that a few
                required libraries are not created, but I do not
                understand why. Any ideas?</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">Thanks,</font></div>
            <div><font size="-1"><br>
              </font></div>
            <div><font size="-1">John</font></div>
          </div>
        </blockquote>
      </blockquote>
      <div>
        <div dir="auto" style="word-wrap:break-word">
          <div><font size="-1"><br>
            </font></div>
        </div>
      </div>
    </blockquote>
  </div>

</div></blockquote></div><br></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>
</div></blockquote></div></div></blockquote></div></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div></div>