Search code examples
c++linuxazure-devopsintelicc

Build C++ code for Linux environment with Intel C++ compiler in Azure DevOps build pipeline


I'm seeking advice on how to build C++ code for Linux environment with Intel C++ compiler in Azure DevOps build CI pipeline. It's a common practice if using gcc instead of Intel C++ compiler. But when it comes to Intel c++ compiler, any advice to have a license (either named user or floating) integrated into the build process?

Advice is appreciated!


Solution

  • But when it comes to Intel c++ compiler, any advice to have a license (either named user or floating) integrated into the build process?

    For your scenario, it's recommended to use Self-hosted agent instead of Hosted agent.

    Here's the list of preinstalled software in Microsoft-Ubuntu-hosted agent, we can find that it doesn't contain the Intel C++ compiler. So hosted agent doesn't have the environment to use Intel C++ compiler. Now you need to install linux self-agent in one of your local machines which has the Intel C++ compiler environment.

    Note: Self-hosted agents give you more control to install dependent software needed for your builds and deployments.

    Here're some steps for you:

    Step 1: Download and install the Intel® Parallel Studio XE for Linux or Intel® System Studio for Linux. (Make sure you choose the correct edition and correct version)

    Step 2: Download and install the Linux self-hosted agent.

    Step 3: Choose your self-agent to run the pipeline. So your pipeline will execute in your local environment which has Intel C++ compiler.

    Step 4: Use command-line tasks instead of normal build tasks in your pipeline like CMD task, bash task or Powershell task to invoke the compiler from the command-line. See Option 1: Use the Command Line:

    • For C source files: icc helloworld.c
    • For C++ source files: icpc helloworld.cc