c++cmakec++17coverity

Coverity build in linux env (cmake project) is failing


I am working on implementing the static code analyzer for our linux env code base and I am facing NO FILES EMITTED issue in it.

These are the steps I followed:

I have linux version Coverity 2023.9.2. We use cmake to build our projects with “Ninja” as the build system. I have configured Coverity with various templates in “myConfig.xml” file so that I don’t miss any compiler. My project is in C++ and C#.

Below is the command how I configure our cmake project before cov-build capture.

*az73@lin*:**/usr/bin/cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="/mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Readers/out/install/WSL-GCC-Debug" -DCMAKE_TOOLCHAIN_FILE="/mnt/d/microservices/repos/vcpkg/scripts/buildsystems/vcpkg.cmake" /mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Readers/CMakeLists.txt**

This is the cov-build command which I give while building the configured cmake project. (You can see that build is in progress without any issues)

*az73@lin*:**/mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Readers/build/WSL-GCC-Debug$ cov-build --dir cov-int --config /mnt/d/linux-coverity/cov-analysis-linux64-2023.9.2/bin/myConfig.xml /usr/bin/cmake --build /mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Readers/build/WSL-GCC-Debug --clean-first --config Debug**

Coverity Build Capture (64-bit) version 2023.9.2 on Linux 5.15.153.1-microsoft-standard-WSL2 x86_64
Internal version numbers: 395a026bc9 p-2023.9-push-64


[1/1] Cleaning all built files...
Cleaning... 199 files.
[58/202] Linking CXX shared library OutputHelper/ClipperTableAccessor/libClipperTableAccessor.so
MSBuild version 17.7.6+77d58ec69 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Logging -> /mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Logging/bin/Debug/net6.0/Logging.dll
  Utilities -> /mnt/d/microservices/InteropServices/src/Services/Utilities/bin/Debug/net6.0/Utilities.dll
  ClipperTableAccessor -> /mnt/d/microservices/InteropServices/src/Services/Modules/HxGN.PPM.Interop.Readers/build/WSL-GCC-Debug/OutputHelper/ClipperTableAccessor/net6.0/ClipperTableAccessor.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:42.74
[94/202] Building CXX object Readers/NavisworksReader/NavisworksFileReader/CMakeFiles/NavisworksFileReader.dir/NavisworksFileReader.cpp.o

And the error I have been facing is this:

**[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.**

When I tried for a sample cpp file which two issues, I could see that Coverity is able to capture it:

*az73@lin*:**/mnt/c/Users/ashaik2/Desktop$ cov-build --dir cov-int-samp --config /mnt/d/linux-coverity/cov-analysis-linux64-2023.9.2/bin/myConfig.xml g++ sample.cpp -o sample**

Coverity Build Capture (64-bit) version 2023.9.2 on Linux 5.15.153.1-microsoft-standard-WSL2 x86_64
Internal version numbers: 395a026bc9 p-2023.9-push-64


Emitted 1 C/C++ compilation units (100%) successfully

1 C/C++ compilation units (100%) are ready for analysis

I am not sure why Coverity is unable to emit any files when I am trying at project level. I would like to know if I am missing anything.


Solution

  • I have gone through the build-log and learned that the actual command during build is c++ -options file.cpp. c++ is an alias of g++ in linux env I guess. A cov-configure with c++ solved my problem and I can see cov-build emits files to get them analyzed.