Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

Troubleshooting an incomplete kwinject build specification

Troubleshooting an incomplete kwinject build specification

Build specification contains only the version line

If kwinject generated a build specification file that contained only the version line, kwinject was not able to recognize your compiler.

Go to C/C++ compilers supported for build integration and look up your compiler type to see if it's supported.

  • If you don't know your compiler name, see Using a build trace to troubleshoot build specification problems.
  • If your compiler's exact name doesn't appear in the table, but you know it's one of the supported compiler types, you need to bind your compiler's name to the compiler type recognized by kwinject, as detailed below.
  • If your compiler doesn't appear in our list of supported compilers at all, contact Customer Support so that we can support your compiler. See Adding an unsupported C/C++ compiler for the information you'll need to send to Support.

For Visual Studio 2010 projects built on the command line, if the build specification contains only the version line, check for a stray msbuild.exe or mspdbsrv.exe process. If you find one, kill it before running kwinject.

Build specification config line is missing or wrong

If you notice that the build specification contains an accurate compile line, but a config line is missing or wrong, kwinject has your build settings but still doesn't have a complete list of system includes or macro definitions necessary for an accurate build analysis. In this case, re-run kwinject with the --debug option and send the debug output to Customer Support, so that we can properly support your compiler.

Binding your compiler name to a recognized compiler type

If you know your compiler is one of the supported compiler types, but it has a nonstandard name, you need to bind your compiler's name to the compiler type recognized by kwinject.

Generate a build trace

Generate a build trace to get your exact compiler name. See Using a build trace to troubleshoot build specification problems.

Temporarily bind the compiler name to test it

Bind the name of the compiler temporarily to see if this resolves the issue.

  1. Run kwinject with the --prog option:
    kwinject --prog <compiler_name>=<compiler_type> --trace-in <trace_file> --output <output_file>
    
    where
    • <compiler_name> is one or more executables applicable to the specified compiler type and specified in<klocwork_install>/config/kwfilter.conf
    • <compiler_type> is a compiler name recognized by kwinject
    For example, if gcc is a symbolic link to gcc-4.1, we can temporarily specify that gcc-4.1 is actually gcc by using the --prog option when running kwinject on a build trace:
    kwinject --prog gcc-4.1=gnu --trace-in <trace_file> --output <output_file>
    
    Note: You can also use kwshell with the --prog option, instead of kwinject.
  2. Then, review your new build specification file (.out) to make sure it contains a config line. Using the above example, the config line of our build specification would look like this:
    config;/usr/bin/gcc;-e;gnu;-DGNUC=3;-J/usr/include;
    
  3. If the config line is present in the build specification and looks complete, then you can permanently bind your compiler's name as shown in the next section.
Tip: In some cases, a single build environment may have multiple compilers or linkers (for example, gcc-x86, gcc-mips, and ar-mips). In this situation, just use multiple instances of the --prog option. For example:
kwinject --output myproject.out --prog gcc-x86=gnu --prog gcc-mips=gnu --prog ar-mips=ar make 

Permanently bind the compiler name in the compiler mapping file

You can edit the compiler mapping file, found at <klocwork_install>/config/kwfilter.conf, so that you don't have to pass the compiler name to kwinject with the --prog option each time you generate a build specification.

Using the same example, we can add gcc-4.1 to kwfilter.conf. The line in kwfilter.conf controlling the GNU compiler type looks like this by default:

# Default GNU C/C++ compiler

filter gnu gcc, g++, cc, c++

We can edit it as follows:

# Default GNU C/C++ compiler

filter gnu gcc, g++, cc, c++, gcc-4.1, g++-4.1

See Compiler mapping file format (kwfilter.conf) for more information.

Tip: Make your custom kwfilter.conf file available to developers who are using Klocwork Desktop or kwcheck. Developers working in unsupported IDEs or text editors may need to configure their compilers as well. It will save time if they copy your custom kwfilter.conf file to their <user_install/config> directory.