Wednesday, 21 December 2011

Coverity and Bitbake

Coverity is a useful tool but boy can it take time to get it to work, especially if your compiler is not supported.

The latest issue, however, was more interesting. Apparently Bitbake shouldn't be a problem, but it was with us. The bitbake script cleans all environment variables except those whitelisted before it runs and as it happens, Coverity requires certain variables to be kept.

This problem can be solved by editing the /lib/bb/utils.py. There is a function called preserved_envvars_list() which returns an array of whitelisted environment variables. In order to make Coverity work, you need to add the following variables to that list:

EDIT: I was told of a few more variables in the Coverity Support Forum.

        'LD_PRELOAD',
        'COVERITY_BIN',
        'COVERITY_SITE_CC',
        'COVERITY_TEMP',
        'COVERITY_IS_COMPILER',
        'COVERITY_TOP_PROCESS',
        'COVERITY_IS_COMPILER_DESCENDANT',
        'COVERITY_OUTPUT',
        'COVERITY_BUILD_INVOCATION_ID',
        'COVERITY_COMPILER_PATH_MISMATCH_FILE',
        'COVERITY_LD_PRELOAD',
        'COVERITY_LD_PRELOAD_32',
        'COVERITY_LD_PRELOAD_64'
        'COVERITY_PATHLESS_CONFIGS_FILE',
        'COVERITY_PREV_XML_CATALOG_FILES',
        'COVERITY_START_CWD',
        'COVERITY_TOP_CONFIG',
        'LD_PRELOAD_32',
        'LD_PRELOAD_64',
        'PLATFORM',
        'COVERITY_DEBUG',
        'COVERITY_EMIT',
        'COVERITY_LD_LIBRARY_PATH',
        'COVERITY_TOP_PROCESS',
        'COVERITY_USE_DOLLAR_PLATFORM'

No comments:

Post a comment