Using Intel C++ Compiler as the Secondary Toolchain for Yocto Project


         NOTES: This article only applies for Intel C++ Compiler 14.0 which is included in the Intel System Studio 2014. Starting from Intel C++ Compiler 15.0 which is included in the Intel System Studio 2015, the toolchain layer has been integrated in the Intel System Studio product. Please refer to article on how to use Intel C++ Compiler for Yocto* Project.


        The Yocto Project is an open-source collaboration project focused on embedded Linux developers. The Yocto Project uses a build system based on the Poky project to construct complete Linux images. The Poky project, in turn, draws from and contributes back to the OpenEmbedded project. Yocto Project includes toolchain that is built up of GNU binutils, gcc, and eglibc. In addition the related components such as gdb, cross-prelink, mklibs and others provide additional toolchain functionality.

        The Intel® C++ Compiler, also known as icc, is a high performance compiler which lets you build and optimize your C/C++ applications for the Linux* based operating system. The Intel® C++ compiler provides complete supports for various embedded Linux* system such as Yocto project based OS. In this document we will describe how to add Intel C++ Compiler as an additional toolchain in the Yocto Project build. With the instructions as described in this document, we will be able to use the Intel C++ compiler to build the packages in Yocto project.

Set up Yocto Project build

        Before we enable the Intel C++ compiler as the secondary toolchain in Yocto Project, we need to make sure the existing Yocto project build with GNU toolchain can work well. Please follow the instructions in “Yocto Project Quick Start” to setup the Yocto Project build environment. The above document will guide you to build an image and run it in the QEMU emulator. For example, to build a Yocto Project version 1.5 QEMU image with poky-dora-10.0.0,
      $ wget
    $ tar xjf poky-dora-10.0.0.tar.bz2
     $ cd poky-dora-10.0.0
     $ source oe-init-build-env
$ bitbake -k core-image-sato
      $ runqemu qemux86
        Please follow the  “Yocto Project Quick Start” manual to make sure the qemux86 image can be built successfully.    

Install Intel System Studio for Linux

      Intel C++ compiler (ICC compiler) is a component of Intel System Studio for Linux. The latest Intel C++ compiler for embedded linux version 14.0 is available in the Intel System Studio 2014 release. This version of ICC compiler supports the sysroot based compilation which helps a very convenient integration with Yocto project. For more information about the Intel system studio, please visit webpage:
      Once you get the Intel system studio package, install it on your host system. By default, the Intel system studio will be installed in the folder "/opt/intel/system_studio_2014.x.y/" where x.y is the sub version of the product.

Integrate ICC toolchain into Yocto Project

      Download the meta-tc-icc.tgz from the attachment and extract the package to the folder poky-dora-10.0.0/, you will find all the configurations and layers for ICC compiler as the secondary toolchain in the folder poky-dora-10.0.0/meta-tc-icc.      The folder meta-tc-icc defined the layers and configuration for ICC compiler as the secondary toolchain. It also contains the receipts to install the Intel C++ compiler runtime libraries into the target image.
      This file defines the layer configuration for meta-tc-icc. You don’t need to change this file most likely when you build the package with icc compiler.
      This file defines the configuration for ICC compiler as the secondary toolchain. This file overrides the environment in order to use the ICC compiler.
This file defines the list to build with icc by package. It’s simple to use ICC compiler to build a specified package by adding the specific line in this file. For example, to build the package “zlib” with Intel C++ compiler, add one line in this file:
TOOLCHAIN_pn-zlib = 'icc'
If you have your own package for example “mypackage” and want to build it with ICC compiler, simply add:
TOOLCHAIN_pn-mypackage = “icc”
You can also add the above line in your package .bb file which is a recommended way to use ICC compiler.
This file is used to setup the sanity check list for the ICC compiler build. You can add a line such as TCBLACKLIST[eglibc] = 'icc' so that to block the ICC build for package “eglic”. If you use ICC compiler to build the package which marked in the blacklist, it will result in a build failure.
      This is the file to handle the ICC build sanity check list. If the package “xxx” is listed in the sanity checklist, it will produce an error message “Recipe xxx is blacklisted for the icc tool chain” when building with ICC compiler.
      This is the file to populate the ICC compiler in the SDK toolchain. The file will generate a script file for ICC build together with GCC build to set up the ICC build environment in SDK toolchain.
Please note that this configuration file requires the Intel System Studio installation path which is specified by ${ISS_BASE_DIR}. You need to add ISS_BASE_DIR in the poky-dora-10.0.0/build/conf/local.conf file. For example, in the build/conf/local.conf file, add
ISS_BASE_DIR = "/opt/intel/system_studio_2014.x.y/"
where “/opt/intel/system_studio_2014.x.y” is the default installation folder of Intel System studio. Change it to your installation folder if necessary.
      The file defined the runtime libraries which will be installed to the target usr/lib or usr/lib64 folder based on the target architecture. It will copy the redistribution libraries from the Intel system studio installation folder which is specified by environment ISS_BASE_DIR in the poky-dora-10.0.0build/conf/local.conf file.
      When bitbake build the icc-runtime, it will copy the file file://${ISS_BASE_DIR}/targets/system_studio_target.tgz to the build folder, extract the bit and copy the ICC compiler redistribution libraries to the folder in the target OS image.
To use the ICC redistribution libraries, the commercial license of Intel C++ compiler is required. In this file, we use the license agreement file in /opt/intel/system_sutdio_2014.x.y/documentation/license.txt for the license file check.
         LIC_FILES_CHKSUM = file://${ISS_BASE_DIR}/documentation/license.txt;md5=0ceb7aae4e16e44ddc8408bd828c04e1
      The md5 checksum is computed by the following command on linux host. You may change this checksum if necessary.
$md5sum /opt/intel/system_studio_2014.x.y/documentation/license.txt

Using ICC compiler as the secondary toolchain

You can follow the following steps to enable a package build with ICC compiler.
Step1: change the local.conf to add path for ISS_BASE_DIR. For example:
      $ . ./oe-init-build-env
      $ vi conf/local.conf
      Add the following line based on your system studio package and installation folder.
ISS_BASE_DIR = "/opt/intel/system_studio_2014.x.y/"
Step 2: Add meta-tc-icc into BBLAYERS in file conf/bblayer.conf, for example:
  /path/to/poky-dora-10.0.0/meta \
  /path/to/poky-dora-10.0.0/meta-yocto \
  /path/to/poky-dora-10.0.0/meta-yocto-bsp \
  /path/to/poky-dora-10.0.0/meta-tc-icc \
Step 3: Add icc-runtime to the image. This step is optional unless you want to integrate the ICC runtime libraries automatically in the target image. To add icc-runtime to the image, open the target image .bb file, for example, copy the meta/recipes-sato/images/ to a new .bb (e.g. and add the following line to the end of the copy:
     IMAGE_INSTALL += "icc-runtime"
The Intel C++ compiler runtime libraries will be integrated into the target OS image in the folder /usr/lib. These libraries will be used by the applications which built with ICC compiler.
Step 4: Enable the package to be built with ICC compiler
Change the file meta-tc-icc\conf\tc-per-package.conf or the package .bb file, enable the ICC build for that package. For example, the following line will enable the ICC build for zlib library for target system.
      TOOLCHAIN_pn-zlib = 'icc'
Step 5: Build the target image
      For example: $ bitbake -k my-core-image-sato
You may also use bitbake command such as “bitbake –b mypackagename –c compile” to compile the target package using ICC compiler separately.
For example: “bitbake –b zlib -c compile”
When the above command is finished, check the log file in poky-dora-10.0.0/build/tmp/work/i586-poky-linux/zlib/1.2.8-r0/temp/do_compile.log, you will find this application is built with ICC compiler instead of GNU compiler.

Populate ICC compiler in the SDK toolchain

      Once you build the target image, you can generate a SDK which has a sysroot matching your target rootfs. ICC compiler environment can be built into the SDK automatically. For example, we can use the following command to generate the SDK which matching the “my-core-image-sato”.
      $ bitbake my-core-image-sato -c populate_sdk
When the SDK is generated, we can find the file environment-setup-i586-poky-linux-icc in the folder build/tmp/work/qemux86-poky-linux/my-core-image-sato/1.0-r0/sdk/image/opt/poky/1.5. This file is used to setup the build environment with ICC compiler. In addition, this file is also included in the SDK deploy file which is located in folder build/tmp/deploy/sdk/.
      To use the ICC compiler from SDK toolchain, in command line, simply setup the ICC build environment:
      $ source /path/to/environment-setup-i586-poky-linux-icc
      You can also try $bitbake meta-toolchain to build a SDK with ICC compiler environment script included.


Intel System Studio Website

Using ICC compiler together with standalone Yocto Project poky toolchain

Yocto Project Quick Start

Adding a secondary toolchain in OpenEmbedded-Core

OpenEmbedded website

Yocto Project Devlopment Manual

Yocto Project How Do I

This article applies to:
Products: Intel(R) INDE; INTEL(R) System Studio 2014
Host OS/platforms: Windows (IA-32, Intel(R) 64), Linux* (IA32, Intel(R) 64)
Target OS/platforms: Yocto* Project Linux*

下载 meta-tc-icc_0.zip6.79 KB