User Guide

  • XX.XX
  • 04/09/2020
  • Public Content

Building Yocto* Project Images and Applications from the Command Line

Intel® System Studio provides an integration layer and several recipes to integrate with the Yocto Project development environment. For more information, see

Using ICC in the Yocto Image Build Environment as a Secondary Compiler

When you have used the integration layer to integrate Intel® System Studio, you can build a Yocto image using the GNU* Compiler Collection* (GCC*) as the primary compiler, and also use the Intel® C++ Compiler as a secondary compiler. For example, when building the platform image with GCC, you can include an application, built using the Intel® C++ Compiler, as part of the image.
To enable the Intel® C++ Compiler to build a specific package, add the following line in the package recipe .bb file:
TOOLCHAIN_pn-${PN} = "icc"
The Intel® C++ Compiler is now invoked automatically when you use this recipe .bb file to build this package.

App Development: When the Yocto SDK is Built with ICC Environment Scripts

When you have used the integration layer to integrate Intel® System Studio when you build the SDK, the Intel® C++ Compiler build environment script file is automatically generated in the same folder in which the default GCC environment scripts are located.
To set up the Intel® C++ Compiler build environment and use the Intel® C++ Compiler for building, source the ICC environment script. The ICC environment script has the same name as the file for the GCC but with the extension
. Sourcing the script overwrites the environment variables CC, CXX, AR and LD. For example, on a Linux system:
source /opt/poky/2.1/environment-setup-i586-poky-linux-icc
Check the content in
and update the compiler options if necessary for your compilation.

App Development: When the Yocto SDK is Not Built with ICC Environment Scripts

Use the
option to specify the target root directory of headers and libraries. For example, if the headers and libraries are normally located in
causes the compiler to search in
for the headers and libraries.
Use the
option to specify a string that prepends the name of the GNU tools called from the Intel® C++ Compiler. The value depends on the GNU toolchain used for a particular operating system. For example, for the Yocto Project v2.1, the prefix value is
. Append a hyphen to the prefix only if the toolchain prefix ends with a hyphen.
To adapt the Intel® C++ Compiler to the Yocto Project v2.1 build environment:
  1. Make a copy of the GCC environment setup file and rename it to
    cp /opt/poky/2.1/environment-setup-i586-poky-linux /opt/poky/2.1/environment-setup-i586-poky-linux-icc
  2. Open the environment setup file,
    , and locate the following build settings:
    export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export CXX="i586-poky-linux-g++ -m32 -march=i586 --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export LD="i586-poky-linux-ld --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export AR=i586-poky-linux-ar
  3. Change them to:
    export CC="icc -gnu-prefix=i586-poky-linux- -m32 -march=i586 --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export CXX="icpc -gnu-prefix=i586-poky-linux- -m32 -march=i586 --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export LD="xild -qgnu-prefix=i586-poky-linux- --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux" export AR="xiar -qgnu-prefix=i586-poky-linux-"
  4. Save the file.
To build an application called
, on a Linux OS host for the Yocto Project v2.1 target, use the following commands:
source /opt/intel/system_studio_yyyy.x.y/bin/ ia32 source /opt/poky/2.1/environment-setup-i586-poky-linux-icc $CC my_source_file.c
You can also use
directly from the command line with the
compiler options, as follows:
icc –gnu-prefix=i586-poky-linux- --sysroot=/opt/poky/2.1/sysroots/i586-poky-linux my_source_file.c
Following successful compilation, an executable named
is created in the current directory. Copy
onto the target machine running Yocto Project (v2.1 in this example), and verify that
runs on the target machine.
For information about the
compiler options, see the Intel® C++ Compiler 19.1 Developer Guide and Reference.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804