When I run the following command 'sourceanalyzer -b test5 gradlew clean build', I get the following error.
Execution failed for task ':app:compileDebugCpp'.
> Error while evaluating property 'compilerVersion' of task ':app:compileDebugCpp'.
> No tool chain is available to build C++ for host operating system 'Windows 10' architecture 'x86-64':
- Tool chain 'visualCpp' (Visual Studio):
- Could not locate a Visual Studio installation, using the command line tool, Windows registry or system path.
- Tool chain 'gcc' (GNU GCC):
- Could not determine GCC metadata: gcc.exe produced unexpected output.
- Tool chain ng' (Clang): Could not find C++ compiler 'clang++' in system path.
When I run 'gradlew clean build' without the 'sourceanalyzer -b test5' gradle builds the project normaly.
When I add the --info tag I see the following outputs.
With 'sourceanalyzer":
Configure project :googleTest
Evaluating project ':googleTest' using build file 'X:\workspace\SDETDMNA\googleTest\build.gradle'.
Starting process 'command 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe''. Working directory: C:\Program Files (x86)\Microsoft Visual Studio\Installer Command: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -all -legacy -format json -utf8
Successfully started process 'command 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe''
Starting process 'command 'C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test\build1020266612314496649\gcc.exe''. Working directory: C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test\build1020266612314496649 Command: C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test5\build1020266612314496649\gcc.exe -m64 -dM -E -v -
Successfully started process 'command 'C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\tes5t\build1020266612314496649\gcc.exe''
With out 'sourceanalyzer":
Configure project :googleTest
Evaluating project ':googleTest' using build file 'X:\workspace\SDETDMNA\googleTest\build.gradle'.
Starting process 'command 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe''. Working directory: C:\Program Files (x86)\Microsoft Visual Studio\Installer Command: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -all -legacy -format json -utf8
Successfully started process 'command 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe''
Starting process 'command 'C:\mingw64\bin\gcc.exe''. Working directory: C:\mingw64\bin Command: C:\mingw64\bin\gcc.exe -m64 -dM -E -v -
Successfully started process 'command 'C:\mingw64\bin\gcc.exe''
I have built a helloworld app with the following command: 'sourceanalyzer -b test g++ hello.cpp -o hello'. It built normaly and the source analyzer worked as expected.
The content of 'C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test5' directory is empty when I run the 'sourceanalyzer -b test5 gradlew clean build' command. While the content of 'C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test' directory has 2 directory one is a directory name 'build17907944560160959472' which contains the MinGw compilers, linkers, and javac.exe. The second directory contains several nested directories that contains the analysis of the source file. Those directories are generated after I run the command 'sourceanalyzer -b test g++ hello.cpp -o hello'.
I cannot find an option in Micro Focus Fortify Static Code Analyzer User Guide to inform the 'sourceanalyzer' of the path to MinGw. MinGW is on the path as well as the 'sourceanalyzer'.
Here is a copy of the build.gradle file. Note that 'id 'cpp-appliocation'' is set as required as required from the Micro Focus Fortify Static Code Analyzer User Guide on page 67.
Successfully started process 'command 'C:\Users\n24090\AppData\Local\Fortify\sca23.1\build\test5\build4539551643556218537\gcc.exe''
Using built-in specs.
COLLECT_GCC=C:\mingw64\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-13.2.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64 --enable-host-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libssp --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev1, Built by MinGW-Builds project' --with-bugurl=github.com/.../mingw-builds CFLAGS='-O2 -pipe -fno-ident -I/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/opt/include -I/c/buildroot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/opt/include -I/c/buildroot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/opt/include -I/c/buildroot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/opt/lib -L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib ' LD_FOR_TARGET=/c/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/bin/ld.exe --with-boot-ldflags=' -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (x86_64-posix-seh-rev1, Built by MinGW-Builds project)
COLLECT_GCC_OPTIONS='-m64' '-dM' '-E' '-v' '-mtune=core2' '-march=nocona'
C:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/cc1.exe -E -quiet -v -iprefix C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/ -D_REENTRANT - -m64 -mtune=core2 -march=nocona -dM -dumpbase -
ignoring duplicate directory "C:/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.2.0/include"
ignoring nonexistent directory "C:/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64D:/a/_temp/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../include"
ignoring duplicate directory "C:/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.2.0/include-fixed"
ignoring duplicate directory "C:/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/buildroot/x86_64-1320-posix-seh-ucrt-rt_v11-rev1/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/include
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/include-fixed
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/include
End of search list.