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.
- 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>
You can also use kwshell with the --prog option, instead of kwinject. - <compiler_name> is one or more executables applicable to the specified compiler type and specified in
- Then, review your new build specification file (
.out
) to make sure it contains a config line. Using the above example, theconfig
line of our build specification would look like this:config;/usr/bin/gcc;-e;gnu;-DGNUC=3;-J/usr/include;
- 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.
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.
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.