<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - the test for PYTHON_EXECUTABLE doesn't take custom python installations and environment variables into account"
   href="http://llvm.org/bugs/show_bug.cgi?id=19527">19527</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>the test for PYTHON_EXECUTABLE doesn't take custom python installations and environment variables into account
          </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>release blocker
          </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>emanuelecestari@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If you consider the file CMakeLists.txt that it's in the llvm root, at the line
349 you have some code that uses the PYTHON_EXECUTABLE

[ code ]
...
  COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
            --native-target "${LLVM_NATIVE_ARCH}"
            --enable-targets "${LLVM_TARGETS_TO_BUILD}"
            --enable-optional-components "${LLVMOPTIONALCOMPONENTS}"

...

[ /code ]

This test fails under a customized python installation, furthermore the
deduction of the right value for PYTHON_EXECUTABLE is subject to the
FindPythonInterp builtin cmake module which is basically not documented and if
you use cmake you have no clue and no guarantees about what steps and processes
are activated by cmake the "right" Python installation. For example there are
expansion rules that have effect on the value that the user is giving to the
related cmake cache entry ? The Python interpreter it's just a valid file with
a valid "pythonish" name ? Cmake is testing this hypothetically valid python
executable with some module-specific tests or it takes for granted that
something that looks like a binary will work ? And bla bla, plus other
dissertations about the fact that this module gives no insights and
informations.
You are probably thinking that you can inspect the source code for the right
cmake module to know what cmake is really doing but this way of thinking
doesn't really take into account the fact that something really critical as the
location of the right python executable ( since llvm/clang is using python a
lot and relying heavily on it ) it's not an invariance, it's not even something
with a consistent behaviour .

As I mentioned there is also an extra problem with this approach, python, and
this is even more popular for many custom python installations, often relies on
some special environemnt variables like PYTHONHOME and PYTHONPATH (
<a href="https://docs.python.org/2/using/cmdline.html">https://docs.python.org/2/using/cmdline.html</a> for more ), you can't just use the
full path to the python executable and feed some scripts and flags to it, it's
not going to work out that well.

Also many GNU/Linux distributions provide a default python installation, so if
you have 1 system-wide python installation plus another custom one that you are
going to use as a developer library, you end up with having at least 2 python
installations at the same time, and this leads us to the problem that exporting
PYTHONHOME or PYTHONPATH it's likely to cause more harm than good.
There should be a way to pass and use customized PYTHONPATH,PYTHONHOME right
inside the scripts that are using the PYTHON_EXECUTABLE otherwise this is not
going to work at all and the result of the script will be 100% unreliable .
-----
this is about the r206684 from the svn trunk, I also posted my configuration
and softwares used in a dedicated discussion on llvm-dev here
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/072312.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/072312.html</a></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>