The Intel® System Studio installer automatically integrates the Intel® C++ Compiler with an existing Application Development Toolkit (ADT) installation for Yocto* Project 1.3-1.5.
To be able to use the Application Development Toolkit with the Intel® C++ Compiler, you must install it using the Application Development Toolkit tarball and installer script available at http://downloads.yoctoproject.org/releases/yocto/. You can find more detailed information at http://www.yoctoproject.org/docs/current/adt-manual/adt-manual.html#using-the-adt-installer.
Refer to the Yocto* Project Application Development Toolkit User’s Guide at http://www.yoctoproject.org/docs/current/adt-manual/adt-manual.html for details on the Application Development Toolkit Usage. The Yocto* Project distributions and board support packages can be found at http://www.yoctoproject.org/download. Yocto* Project documentation can be found at http://www.yoctoproject.org/documentation.
Using -gnu-prefix and --sysroot Compiler Options for Cross-Compilation
Use this method only if you are using Intel® Compiler 14.0 or later, and are cross-compiling for Yocto* Project versions 1.4 or later. This method uses the --sysroot and -gnu-prefix compiler options instead of setting environment variables and using the -platform compiler option that was used in the previous cross-compiling method.
You use the --sysroot option to specify the target root directory of headers and libraries. For example, if the headers and libraries are normally located in /usr/include and /usr/lib respectively, --sysroot=/mydir causes the compiler to search in /mydir/usr/include and /mydir/usr/lib for the headers and libraries.
You use the -gnu-prefix option to specify a string that prepends the name of 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 v1.4, the prefix value is i586-poky-linux-
. Append a hyphen to the prefix only if the toolchain prefix ends with a hyphen.
To adopt the Intel® C++ Compiler (icc) to the Yocto* Project v1.4 build environment, follow these steps:
Make a copy of the GCC environment setup file and rename it to environment-setup-i586-poky-linux-icc.
cp /opt/poky/1.4/environment-setup-i586-poky-linux /opt/poky/1.4/environment-setup-i586-poky-linux-icc
Open the environment setup file, /opt/poky/1.4/environment-setup-i586-poky-linux-icc, and locate the following build settings:
export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export CXX="i586-poky-linux-g++ -m32 -march=i586 --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export LD="i586-poky-linux-ld --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export AR=i586-poky-linux-ar
Change them to:
export CC="icc -gnu-prefix=i586-poky-linux- -m32 -march=i586 --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export CXX="icpc -gnu-prefix=i586-poky-linux- -m32 -march=i586 --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export LD="xild -qgnu-prefix=i586-poky-linux- --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux" export AR="xiar -qgnu-prefix=i586-poky-linux-"
Save the file.
To build an application called my_source_file.c, on a Linux* OS host for the Yocto Project* [v1.4 or later] target, use the following commands:
source /opt/intel/system_studio_2015.x.y/bin/compilervars.sh ia32 source /opt/poky/1.4/environment-setup-i586-poky-linux-icc $CC my_source_file.c
You can also use icc directly from the command line with the –gnu-prefix and --sysroot compiler options, as follows:
icc –gnu-prefix=i586-poky-linux- --sysroot=/opt/poky/1.4/sysroots/i586-poky-linux my_source_file.c
Following successful compilation, an executable named a.out is created in the current directory. Copy a.out onto the target machine running Yocto* Project 1.4 or later, and verify that a.out runs on the target machine.
Setting Environment Variables and Using -platform Compiler Option for Cross-Compiling
Use this method only if you are using Intel® Compiler 13.0 and are cross-compiling for Yocto* Project versions 1.2 to 1.3. In this method you set specific environment variables and use the -platform option to cross-compile.
After installation is complete, set the YL_TOOLCHAIN and YL_SYSROOT environment variables to match cross-compilation tools directories. For example:
export YL_TOOLCHAIN=/opt/poky/1.3/sysroots/i686-pokysdk-linux/usr/bin export YL_SYSROOT=/opt/poky/1.3/sysroots/i586-poky-linux
Note
The Yocto* SDK can only be installed to the root (/) directory.
To compile your application for the Yocto* Project v1.3 target, specify the -platform=yl13 compiler option. For example, to compile a C source file, my_source_file.c, use a command similar to the following:
icc -platform=yl13 my_source_file.c
Similarly, to compile a C++ source file, my_source_file.cpp, use a command similar to the following:
icpc -platform=yl13 my_source_file.cpp
The corresponding environment file is located in <install-dir>/bin/ia32.
Following successful compilation, an executable named a.out is created in the current directory. Copy the a.out file to the target machine running Yocto* Project 1.2 to 1.3, and verify that a.out runs on the target machine.