Linux 环境(cmake 项目)中的 Coverity 构建失败

问题描述 投票:0回答:1

我正在努力为我们的 linux env 代码库实现静态代码分析器,我面临着 NO FILES EMITTED 问题。

这些是我遵循的步骤:

我有Linux版本Coverity 2023.9.2。我们使用 cmake 来构建我们的项目,并以“Ninja”作为构建系统。我在“myConfig.xml”文件中使用各种模板配置了 Coverity,这样我就不会错过任何编译器。我的项目是用 C++ 和 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**

这是我在构建配置的 cmake 项目时给出的 cov-build 命令。 (您可以看到构建正在进行中,没有任何问题)

*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

我一直面临的错误是这样的:

**[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.**

当我尝试获取包含两个问题的示例 cpp 文件时,我可以看到 Coverity 能够捕获它:

*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

我不确定为什么 Coverity 在项目级别尝试时无法发出任何文件。我想知道我是否遗漏了什么。

c++ linux cmake c++17 coverity
1个回答
0
投票

我已经查看了构建日志并了解到构建过程中的实际命令是

c++ -options file.cpp
。我猜 c++ 是 Linux 环境中 g++ 的别名。使用 c++ 的 cov-configure 解决了我的问题,我可以看到 cov-build 发出文件来分析它们。

© www.soinside.com 2019 - 2024. All rights reserved.