Building Wind River* Linux* Images and Applications from the Command Line

Before compiling applications for running on target Wind River* Linux* OS, you must install Wind River* Linux* 6.0.x-8.0 and build sysroot for the target platform.

To find out more about Wind River* Linux* and how to install the required Wind River* Linux* tool-chain, go to http://www.windriver.com/products/linux/.

Intel® System Studio provides an integration layer and several recipes to integrate with the Wind River Linux project development environment. For more information, see https://software.intel.com/en-us/articles/using-intel-system-studio-with-wind-river-linux-build-environment.

Platform Development: Using icc in the Wind River Image Build Environment as a Secondary Compiler

When you have used the integration layer to integrate Intel® System Studio, you can build a platform image using gcc as the primary compiler, and also use the Intel compiler as a secondary compiler. For example, when building the platform image with gcc, you can include an application, built using the Intel compiler, as part of the image.

To enable the Intel 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 Wind River SDK is Built with icc Environment Scripts

When you have used the integration layer to integrate Intel® System Studio when you build the SDK from a Wind River Linux platform project, the Intel compiler build environment script file is automatically generated in the same folder in which the default gcc compiler environment scripts are located.

To set up the build environment to use the Intel compiler for building, source the icc environment script. The icc environment script has the same name as the file for the gcc compiler but with the extension -icc. When you source the icc environment script, it overwrites the environment variables CC, CXX, AR and LD. For example, on a Linux system:

source /WRL6_SDK_DIR/environment-setup-i586-wrs-linux-icc

where WRL6_SDK_DIR is the root folder of the Wind River Linux SDK installation folder.

Check the content in the WRL6_SDK_DIR/environment-setup-i586-wrs-icc file and update the compiler options if necessary for your compilation.

App Development: When the Wind River SDK is Not Built with icc Environment Scripts

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.

Use the -gnu-prefix 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 Wind River* Linux* platform, the prefix value, for a 64-bit target, is x86_64-wrs-linux-. Append a hyphen to the prefix only if the toolchain prefix ends with a hyphen.

To adapt the Intel® C++ Compiler to the Wind River build environment:

  1. Make a copy of the GCC environment setup file and rename it to environment-setup-i586-wrs-icc. For example:

    cp cp /opt/windriver/wrlinux-small/7.0-qemux86-64/environment-setup-core2-64-wrs-linux /opt/windriver/wrlinux-small/7.0-qemux86-64/environment-setup-core2-64-wrs-linux-icc 

  2. Open the environment setup file,/opt/windriver/wrlinux-small/7.0-qemux86-64/environment-setup-core2-64-wrs-linux-icc, and locate the following build settings:

    export CC="x86_64-wrs-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
    export CXX="x86_64-wrs-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
    export LD="x86_64-wrs-linux-ld  --sysroot=$SDKTARGETSYSROOT"
    export AR=x86_64-wrs-linux-ar
    

  3. Change them to:

    export CC="icc -gnu-prefix=x86_64-wrs-linux- -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
    export CXX="icpc -gnu-prefix=x86_64-wrs-linux- -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
    export LD="xild -qgnu-prefix=x86_64-wrs-linux-  --sysroot=$SDKTARGETSYSROOT"
    export AR="xiar -qgnu-prefix=x86_64-wrs-linux-"

  4. Save the file.

Use icc from the command line with the –gnu-prefix and --sysroot compiler options, as follows:

icc my_source_file.c -gnu-prefix=$GNU_PREFIX --sysroot=$SYSROOT

Following successful compilation, an executable named a.out is created in the current directory. Copy a.out onto the target machine and verify that a.out runs on the target machine.

For information about the gnu-prefix and sysroot compiler options, see the Intel® C++ Compiler 18.0 Developer Guide and Reference.

For more complete information about compiler optimizations, see our Optimization Notice.