<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 --- - scan-build is not allowing cross compile"
   href="http://llvm.org/bugs/show_bug.cgi?id=19583">19583</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build is not allowing cross compile
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </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>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>npl@chello.at
          </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>I am trying to run scan-build on a project for arm-none-eabi. I have not been
able to configure the script to pick up the right settings.

The filesystem layout is the following:
/usr/bin/clang[++]
/usr/bin/scan-build
/opt/mytoolchain/bin/arm-none-eabi-clang[++] -> /usr/bin/clang[++] (symlink)
/opt/mytoolchain/bin/arm-none-eabi-scan-build -> /usr/bin/scan-build (symlink)

The invocation is:
/opt/mytoolchain/bin/arm-none-eabi-scan-build
--use-cc=/opt/mytoolchain/bin/arm-none-eabi-clang
--use-c++=/opt/mytoolchain/bin/arm-none-eabi-clang++
--use-analyzer=/opt/mytoolchain/bin/arm-none-eabi-clang++ make ...

which should mean that /opt/mytoolchain/bin/arm-none-eabi-clang++ is used as
analyzer and pick up the correct settings. The scan-build script however runs a
"realpath" on the path and thus uses /usr/bin/clang++ directly...

I fixed this by modifying the scan-build script:
change
    $Clang = Cwd::realpath($AnalyzerDiscoveryMethod);
to
    $Clang = $AnalyzerDiscoveryMethod;

I would like this change to be applied in trunk. I think it can be required
that the user has to supply an absolute path for this parameter. Otherwise its
pretty hard to use this script in a cross-compile environment (hardlink would
be an option, but I would prefer something that can easily deployed with a
simple tar archive...)

Further, maybe the scan-build script could try to locate the correct clang
automatically from the invocation. ie. make a symlink
"arm-none-eabi-scan-build" and upon invocation it should deduce the default
cross compiler arm-none-eabi-gcc/g++ and analyzer arm-none-eabi-clang++
(just replace -scan-build with -clang from the commandline)?</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>