[LLVMbugs] [Bug 19583] New: scan-build is not allowing cross compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 28 05:37:23 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19583

            Bug ID: 19583
           Summary: scan-build is not allowing cross compile
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: npl at chello.at
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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)?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140428/0ea8629f/attachment.html>


More information about the llvm-bugs mailing list