Main Content

Check If Polyspace Supports Build Scripts

Issue

This topic is relevant only if you are creating a Polyspace® project in Windows® from your build scripts.

When Polyspace traces your build script in a Windows console application other than cmd.exe, the command fails. However, the build command by itself executes to completion.

For instance, your build script executes to completion from the Cygwin™ shell. However, when Polyspace traces the build, the build script throws an error.

Possible Cause

When you launch a Windows console application, your environment variables are appropriately set. Alternate console applications such as the Cygwin shell can set your environment differently from cmd.exe.

Polyspace attempts to trace your build script with the assumption that the script runs to completion in cmd.exe. Therefore, even if your script runs to completion in the alternate console application, when Polyspace traces the build, the script can fail.

Solution

Make sure that your build script executes to completion in the cmd.exe interface. If the build executes successfully, create a wrapper .bat file around your script and trace this file.

For instance, before you trace a build command that executes to completion in the Cygwin shell, launch the Cygwin shell from cmd.exe and then run your build script. For example, if you use a script build.sh to build your code, enter the following command at the DOS command line:

cmd.exe /C "C:\cygwin64\bin\bash.exe" --login -c build.sh
If the steps do not execute to completion, Polyspace cannot trace your build.

If the steps complete successfully, trace the build command after launching it from cmd.exe. For instance, on the command-line, do the following to create a Polyspace options file.

  1. Enter your build commands in a .bat file.

    rem @echo off
    cmd.exe /C "C:\cygwin64\bin\bash.exe" --login -c build.sh
    Name the file, for instance, launching.bat.

  2. Trace the build commands in the .bat file and create a Polyspace options file.

    "C:\Program Files\MATLAB\R2024b\polyspace\bin\polyspace-configure.exe" -output-options-file myOptions.txt launching.bat

You can now run polyspace-code-prover or polyspace-code-prover-server on the options file.