<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">You can run `ninja -t commands <target>` to get all the commands that are needed to build a particular target.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of David Blaikie via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Reply-To: </b>David Blaikie <dblaikie@gmail.com><br>
<b>Date: </b>Thursday, August 16, 2018 at 1:37 PM<br>
<b>To: </b>Douglas Parker <dgp1130422@gmail.com><br>
<b>Cc: </b>llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [llvm-dev] Building LLVM through Bazel<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Yeah, compile_commands.json would be insufficient - it's just the compile commands, not tblgen. (compile_commands is for clang tools to consume so they know what command line arguments are used for a given source
file, so they can reproduce that build to show clang-tidy tips, etc)<br>
<br>
A log output from something like ninja would likely be complete, I think.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Thu, Aug 16, 2018 at 1:28 PM Douglas Parker <<a href="mailto:dgp1130422@gmail.com">dgp1130422@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">I tried running all the commands in the compile_commands.json (thanks for pointing that out), but it runs into the same "No such file or directory: *.inc". I don't see those files built anywhere in that list. Does
it take tblgen into account? <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Doug<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Thu, Aug 16, 2018, 1:02 PM Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-left:.5in">TensorFlow uses bazel to build LLVM:<br>
<a href="https://github.com/tensorflow/tensorflow/tree/master/third_party/llvm" target="_blank">https://github.com/tensorflow/tensorflow/tree/master/third_party/llvm</a><br>
The script that generates llvm.autogenerated.BUILD is not open sourced<br>
yet unfortunately but looking skimming through the generated file<br>
should give you a rough idea of what's involved.<br>
<br>
-- Sanjoy<br>
On Thu, Aug 16, 2018 at 11:16 AM Isaiah Norton via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> You could look at the cmake+ninja (or other build system) build and dump the commands it executes (I think ninja produces a log, or can do so) which should show you all the commands needed to build any part of LLVM.<br>
><br>
><br>
> There's a switch to dump all compiler commands as a JSON file:<br>
><br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cmake.org_cmake_help_v3.12_variable_CMAKE-5FEXPORT-5FCOMPILE-5FCOMMANDS.html&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=SwZE6EeUcW5DXygSPrhf28SPBqr6MEBEg6ZpVmaiHW4&s=c8dWQO0-w6fpxbQnWt2kW-MbFgN21WE9iAM550QSS34&e=" target="_blank">
https://cmake.org/cmake/help/v3.12/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html</a><br>
><br>
> On Wed, Aug 15, 2018 at 8:30 PM David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Wed, Aug 15, 2018 at 2:05 PM Douglas Parker <<a href="mailto:dgp1130422@gmail.com" target="_blank">dgp1130422@gmail.com</a>> wrote:<br>
>>><br>
>>> I believe it would be possible to run a cmake command to generate a BUILD file, though I don't know if that would be easier to maintain on the LLVM side. Would definitely be happy to see direct support, though I was just trying to figure out what's needed
to hack this together on my end.<br>
>>><br>
>>> I guess my real question is what underlying commands are necessary to build all the source files (without actually compiling the C/C++)? If I can understand how to do this manually with terminal/cmake/tblgen, then I could probably get it to work with Bazel.<br>
>>><br>
>>> Looking at TensorFlow's setup, it looks like tblgen has dependencies on support which goes down to zlib and gets a lot of complexity there. I get the impression that tblgen isn't so complicated as to require all that. What would be the minimum steps to
build tblgen from source?<br>
>><br>
>><br>
>> You could look at the cmake+ninja (or other build system) build and dump the commands it executes (I think ninja produces a log, or can do so) which should show you all the commands needed to build any part of LLVM.<br>
>><br>
>> But yeah, I think you do have to build support to build tblgen, to run tblgen to generate the rest of the files to continue the build.<br>
>><br>
>> - Dave<br>
>><br>
>>><br>
>>><br>
>>> Doug<br>
>>><br>
>>> On Wed, Aug 15, 2018 at 1:28 PM Chris Bieneman <<a href="mailto:chris.bieneman@me.com" target="_blank">chris.bieneman@me.com</a>> wrote:<br>
>>>><br>
>>>> There have been discussions about adding a Bazel generator before:<br>
>>>> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cmake.org_pipermail_cmake-2Ddevelopers_2017-2DJuly_030144.html&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=SwZE6EeUcW5DXygSPrhf28SPBqr6MEBEg6ZpVmaiHW4&s=oAWAXGa5gSeVOQMHrVG3qZOYnIK3P2Imys327wAyKEs&e=" target="_blank">
https://cmake.org/pipermail/cmake-developers/2017-July/030144.html</a><br>
>>>><br>
>>>> There does seem to be interest in having that support in CMake, and I can't imagine any insurmountable reason why it couldn't be done. The real issue is that nobody has put in the time to do it.<br>
>>>><br>
>>>> -Chris<br>
>>>><br>
>>>> On Aug 15, 2018, at 11:21 AM, David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>>><br>
>>>><br>
>>>><br>
>>>> On Wed, Aug 15, 2018 at 10:04 AM Chris Lattner <<a href="mailto:clattner@nondot.org" target="_blank">clattner@nondot.org</a>> wrote:<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> > On Aug 14, 2018, at 2:43 PM, David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>>>> ><br>
>>>>> > Yeah - not sure we're quite at the point where LLVM wants to start supporting two build systems again (used to be Configure+Make and the CMake system, now it's just the Cmake system), but if you want to make it work out-of-tree it shouldn't be too difficult
(Google does this internally with the internal version of Bazel). Writing a short BUILD extension for running tblgen should be possible without too much complexity - not sure what Tensorflow is doing that makes its solution so complicated, it doesn't seem
like it should be terribly hard, just a genrule to run tblgen and generate the appropriate files from the td files.<br>
>>>>><br>
>>>>> Would it be technically possible for cmake to generate bazel files? If so, it seems that that could be a great bridge, and useful to other projects as well.<br>
>>>><br>
>>>><br>
>>>> /maybe/? It's an interesting thought - not sure I know enough about either build system to have a very informed opinion here, though.<br>
>>>><br>
>>>> - Dave<br>
>>>><br>
>>>>><br>
>>>>><br>
>>>>> -Chris<br>
>>>>><br>
>>>> _______________________________________________<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://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=SwZE6EeUcW5DXygSPrhf28SPBqr6MEBEg6ZpVmaiHW4&s=1avnocVwELxhTKAmvxuCATIih1jPSzAfvHvCtT5K2u4&e=" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>>>><br>
>>>><br>
>> _______________________________________________<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://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=SwZE6EeUcW5DXygSPrhf28SPBqr6MEBEg6ZpVmaiHW4&s=1avnocVwELxhTKAmvxuCATIih1jPSzAfvHvCtT5K2u4&e=" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<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://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=SwZE6EeUcW5DXygSPrhf28SPBqr6MEBEg6ZpVmaiHW4&s=1avnocVwELxhTKAmvxuCATIih1jPSzAfvHvCtT5K2u4&e=" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
</blockquote>
</div>
</div>
</body>
</html>