<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 - rerunning cmake causes binaries to be relinked regardless of repo changes"
   href="https://bugs.llvm.org/show_bug.cgi?id=33717">33717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>rerunning cmake causes binaries to be relinked regardless of repo changes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matthias.krueger@famsik.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Running cmake causes binaries to be relinked even if neither repo files nor
cmake config changed since last build, this is quite strange and a huge time
sink in case of LTO builds.

I don't clearly remember this behaviour being present a week or two ago. 

I can repro like this:

After doing an initial build:

cd build_dir
ninja-build clang LLVMgold llvm-ar llvm-ranlib lld
=> no files are rebuilt, everything ok

However if I run cmake before (as part my build script):

cd build_dir
cmake ../llvm -G "Ninja" \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_BINUTILS_INCDIR=/usr/include \
        -DCMAKE_C_FLAGS="-march=native -O3 -g0 -DNDEBUG" \
        -DCMAKE_CXX_FLAGS="-march=native -O3 -g0 -DNDEBUG" \
        -DLLVM_PARALLEL_LINK_JOBS=1 \
        -DLLVM_TARGETS_TO_BUILD="X86" \
        -DLLVM_OPTIMIZED_TABLEGEN=1 \
        -DLLVM_BUILD_TOOLS=0 
ninja-build clang LLVMgold llvm-ar llvm-ranlib lld

=> these 12 files will be rebuilt:
lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
lib/libLLVMObject.a
bin/llvm-ar
bin/llvm-ranlib
bin/clang-offload-bundler
lib/LTO/CMakeFiles/LLVMLTO.dir/ThinLTOCodeGenerator.cpp.o
lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
lib/libLLVMLTO.a
lib/LLVMgold.so
bin/clang-5.0
bin/clang
bin/lld


In case of tests (check-llvm check-clang check-lld), 72 targets are being
rebuilt every time 

Now for "normal" builds this is not a huge issue but in case of lto, this can
prolong subsequent builds by several hours. :/

Did anyone else run into this?


Said script:
<a href="https://github.com/matthiaskrgr/llvm_bootstrap/blob/master/build_git.sh">https://github.com/matthiaskrgr/llvm_bootstrap/blob/master/build_git.sh</a>

cmake 3.5
ninja-build 1.7.2</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>