8.1.1. Project Setup Basics

8.1.1.1. Background

You have a project with C/C++ source and want to analyze the code with respect to software erosion. In the following, the basic steps are explained.

8.1.1.2. What needs to be done?

  1. Install the Axivion Suite and its Java dependency according to Installation. Optionally, install a custom Python interpreter to use instead of the included one.

  2. Before setting up the code analysis, make sure that the native build is working in the workspace/computer that will be used for code analysis in order to have all dependencies for the build ready.

  3. Create the project overview sheet:

    1. Which VCS do you use?

    2. Which build system do you use?

    3. Which native compiler do you use?

    4. Where are the compiler’s standard headers located?

    5. Where is the 3rd party code?

  4. You have to decide where to store the configuration files. It is best practice to create a folder axivion inside the project’s VCS directory and collect the individual configuration files in this folder. The folder should be added to the VCS.

  5. If you already have a setup for a similar project, try to copy the configuration files and change them.

  6. Depending on your build system, find out how to replace the calls to the native compiler and linker with calls to cafeCC.

  7. Run the tool axivion_config and click the button “Use Wizard”. Follow the Wizard. You will be able to edit the configuration at the end of the process to configure more specific behavior that is not supported by the Wizard. If you have multiple build results, see Multi-Target Projects for how to proceed.

  8. Adapt the start script start_analysis.bat or start_analysis.sh for the CI build that can be used to start an analysis run. An initial version of the start script will have been created by the project Wizard.

  9. Start the CI via the start script interactively and redirect stdout and stderr into a log file, e.g.

    start_analysis >build.log 2>&1
    

    Then check the build.log for errors and warnings. First, eliminate the catastrophic errors from cafeCC (are the compiler include paths correctly set up?). Then, try to remove all error messages. Typical sources for error messages are missing defines for compiler specifics. If in doubt how to proceed, contact axivion.support@qt.io. When all compiler errors are resolved, code analysis can be run successfully.

  10. When analyzing a project which compiles fine with the native compiler, but the Axivion Suite displays a lot of errors in the compiler’s system header files, please check the compiler configuration.

    If your project uses a compiler variant of GCC, Clang, IAR, GHS, TI, TASKING, Microchip XC8, or Freescale CodeWarrior, please use the automated setup tools (gccsetup, clangsetup, iarsetup, ghssetup, ticgtsetup, taskingsetup, xc8setup, and fcwsetup respectively) as also recommended during the project Wizard run.

    For other compilers, see Compiler profile overview.

  11. If your project uses a proprietary project file (like .sln, .vcxproj, .uvprojx, .ewp, .gpj, or .cbp), please use the supplied build tools (build_sln, build_vcxproj, build_uvprojx, build_ewp, build_gpj, and build_cbp respectively). build_sln and build_vcxproj are available on Windows only.

  12. Configure the analyses (select the right stylecheck rules, architecture setup, dead code etc.).

  13. Make a test run and start a dashboard locally. Check the results from the analyses.

  14. Review the analysis configuration: Do you need to exclude 3rd party code, generated code, compiler headers? Is further configuration for libraries required (e.g., Qt)?

  15. After the analysis is running fine locally, commit the configuration files to the VCS.

  16. Add the analysis job to your CI server. Check out the code and let the analysis run on the CI server. Are the results as expected?

  17. Add the resulting project to your web UI server and notify users about the availability of the results.