0

We just upgraded our build server from Ubuntu 16.x to 18.04.1, and I can no longer get Coverity to work.

Per Coverity Scan fails to build <stdlib.h> with _GNU_SOURCE defined, I have a Docker container on our Ubuntu 18.04.1 machine that installs the gcc-6 package (there's no other gcc installed in that container -- it's only gcc-6).

Per TravisCI / Coverity: Warning - No files were emitted, I also ran the following in my container: /coverity/cov-analysis-linux64-7.6.0/bin/cov-configure --comptype gcc --compiler gcc-6 --template. This seems to have generated the file /coverity/cov-analysis-linux64-7.6.0/config/coverity_config.xml

When I configure / build our software (libfabric, from https://github.com/ofiwg/libfabric) in the container, it builds just fine. However, if I try to build it via cov-build, I get compilation errors. For example, here's a cov-build command to build just a single file from libfabric:

# Clear out the Coverity meta data dir, just to be sure
$ rm -rf cov-data
$ /coverity/cov-analysis-linux64-7.6.0/bin/cov-build \
     -dir cov-data make src/fi_tostr.lo

Here's a snipit of the relevant output from the cov-build/build-log.txt file showing where Coverity failed:

[STATUS] Compiling src/fi_tostr.c
/coverity/cov-analysis-linux64-7.6.0/bin/cov-emit --dir=/home/jsquyres/git/libfabric/cov-data --ignore_path=/tmp/cov-0/a35264b27887fab7178c6bf7ab1117a9/cov-configure --ignore_path=/tmp/cov-0/a35264b27887fab7178c6bf7ab1117a9/cov-0/49f277832f55e48469661625f8083203 -w --no_stdarg_builtin --incompat_proto --add_type_modifier=__coverity___fpreg --add_type_modifier=__coverity___float80 --add_type_modifier=__coverity___float128 --no_predefined_cplusplus --gnu_version=60400 --no_predefines --restrict --gnu_carriage_return_line_terminator --no_multiline_string --no_trigraphs --c99 --allow__bool --pre_preinclude /home/jsquyres/git/libfabric/cov-data/emit/394646c6191c/config/5fe0c6b2b8489d2ab05d2434d738b5ac/gcc-config-0/coverity-macro-compat.h --pre_preinclude /home/jsquyres/git/libfabric/cov-data/emit/394646c6191c/config/5fe0c6b2b8489d2ab05d2434d738b5ac/gcc-config-0/coverity-compiler-compat.h --preinclude /coverity/cov-analysis-linux64-7.6.0/config/template-gcc-config-8/../user_nodefs.h --gcc -I . -I include -I prov/sockets/include -I prov/sockets --sys_include /usr/lib/gcc/x86_64-linux-gnu/6/include --sys_include /usr/local/include --sys_include /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed --sys_include /usr/include/x86_64-linux-gnu --sys_include /usr/include -DHAVE_CONFIG_H -DNDEBUG -DPROVDLDIR="/usr/local/lib/libfabric" -DRDMADIR="@rdmadir@" -DSYSCONFDIR="/usr/local/etc" -D_GNU_SOURCE -D__OPTIMIZE__ -D__USE_XOPEN2K8 --type_sizes=e16Pdlx8fi4s2 --type_alignments=e16Pdlx8fi4s2 --size_t_type=m --wchar_t_type=i --ptrdiff_t_type=l src/fi_tostr.c
"/usr/lib/gcc/x86_64-linux-gnu/6/include/stdatomic.h", line 40: error #65:
          expected a ";"
  typedef _Atomic _Bool atomic_bool;
                  ^

"/usr/lib/gcc/x86_64-linux-gnu/6/include/stdatomic.h", line 41: error #84:
          invalid combination of type specifiers
  typedef _Atomic char atomic_char;
                  ^

Does anyone know how to make Coverity understand these types?

jww
  • 97,681
  • 90
  • 411
  • 885
Jeff Squyres
  • 744
  • 4
  • 6
  • Looks like Coverity does not support the `_Atomic` type qualifier, so it chokes on ``. You can try a hack like `#ifdef __COVERITY__`, `#define _Atomic`, `#endif` before any other includes, or `-D_Atomic=""` compile flag. – Nominal Animal Oct 09 '18 at 20:08
  • You don't say which version of Coverity you are using. The docs for Coverity contain a table of supported compilers. If the compiler version changed you may need to run cov-configure. – Paul Floyd Jan 10 '19 at 16:56
  • @PaulFloyd This was now months ago; I don't recall the specific version of Coverity. It was whatever was current on scan.coverity.com at the time (Oct 2018). If you read my full problem description, you'll see that I *did* run `cov-configure`. – Jeff Squyres Jan 10 '19 at 21:38
  • Ah yes, and I see that it is version 7.6 from the cov-configure path. – Paul Floyd Jan 11 '19 at 09:42
  • @PaulFloyd Is there a fix / workaround to make this work? – Jeff Squyres Jan 11 '19 at 15:54
  • Sorry, no. Have you tried using `cov-wizard`? I have no experience with it, but it does have a `Compiler Configuration` pane, but it's probably just a GUI wrapper around `cov-configure`. – Paul Floyd Jan 15 '19 at 11:36

0 Answers0