<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 - debug-info tests CMake fails to find python3"
   href="https://bugs.llvm.org/show_bug.cgi?id=44961">44961</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>debug-info tests CMake fails to find python3
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.spickett@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23144" name="attach_23144" title="Full cmake output.">attachment 23144</a> <a href="attachment.cgi?id=23144&action=edit" title="Full cmake output.">[details]</a></span>
Full cmake output.

When configuring llvm for the "debuginfo-tests" target, it will detect whatever
'python' is in the shell.

$ python
Python 2.7.12 (default, Aug 22 2019, 16:36:40) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
<span class="quote">>>></span >
$ cmake -DLLVM_ENABLE_PROJECTS="debuginfo-tests" ../llvm-project/llvm
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- The ASM compiler identification is GNU
<...>
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
<...>
CMake Error at /work/open_source/llvm-project/debuginfo-tests/CMakeLists.txt:30
(message):
  Cannot run debuginfo-tests without python 3


-- Configuring incomplete, errors occurred!
See also "/work/open_source/llvm-project-build/CMakeFiles/CMakeOutput.log".
See also "/work/open_source/llvm-project-build/CMakeFiles/CMakeError.log".

(full output attached)

CMake will pass if you add "-DPYTHON_EXECUTABLE=`which python3`".

However once you do that it will fail with:
CMake Error at
/work/open_source/llvm-project/llvm/cmake/modules/AddLLVM.cmake:1543
(add_dependencies):
  The dependency target "clang" of target "check-debuginfo" does not exist.

Adding clang to LLVM_ENABLE_PROJECTS works around that.

CMake is likely using
<a href="https://cmake.org/cmake/help/v3.0/module/FindPythonInterp.html">https://cmake.org/cmake/help/v3.0/module/FindPythonInterp.html</a> to find Python.
In later versions of CMake there is a Python 3 specific version
<a href="https://cmake.org/cmake/help/v3.12/module/FindPython3.html">https://cmake.org/cmake/help/v3.12/module/FindPython3.html</a>.

Unfortunately this was added in CMake 3.12.4 so not available in LLVM's minimum
of 3.4.3.</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>