<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ld.lld --version doesn't show revision info when built in monorepo"
href="https://bugs.llvm.org/show_bug.cgi?id=40780">40780</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ld.lld --version doesn't show revision info when built in monorepo
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>natechancellor@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>ld.lld --version does not show any revision info when using the monorepo.
Cloning the llvm and lld repos standalone side by side and using
LLVM_ENABLE_PROJECTS works.
The root cause is LLD_REVISION and LLD_REPOSITORY don't get properly set
because the helper scripts assume that there will be a .git folder in the lld
folder, which isn't true with the monorepo (it's in ..).
<a href="https://github.com/llvm/llvm-project/blob/c94d393ad52b669/lld/CMakeLists.txt#L137-L141">https://github.com/llvm/llvm-project/blob/c94d393ad52b669/lld/CMakeLists.txt#L137-L141</a>
<a href="https://github.com/llvm/llvm-project/blob/a6822ed91f0e033/llvm/utils/GetRepositoryPath#L21">https://github.com/llvm/llvm-project/blob/a6822ed91f0e033/llvm/utils/GetRepositoryPath#L21</a>
<a href="https://github.com/llvm/llvm-project/blob/bf0bf743d7ed6c2/llvm/utils/GetSourceVersion#L21">https://github.com/llvm/llvm-project/blob/bf0bf743d7ed6c2/llvm/utils/GetSourceVersion#L21</a>
A quick fix would be to check for a .git folder in the parent directory:
elif [ -d .git ] || [ -d ../.git ]; then
I have no idea if that is proper or not. I assume the correct fix would be to
get rid of those scripts (since lld is the only consumer of them) and use the
VCS scripts from <a href="https://github.com/llvm/llvm-project/commit/23fdd5a37ff4e05">https://github.com/llvm/llvm-project/commit/23fdd5a37ff4e05</a>
but I am not familiar enough with cmake to attempt that myself.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>