Using compilervars File

Before you invoke the compiler component of the Intel® System Studio, you must set certain environment variables that define the location of compiler-related components.

The Intel® C++ Compiler includes the compilervars scripts that you can run to set environment variables.

  • On Linux*, the file is a shell script called compilervars.sh or compilervars.csh.
  • On Windows*, the file is a batch file called compilervars.bat.

Note

Using the compilervars script does not set the environment variables for the shared libraries used by your application. You must set the LD_LIBRARY_PATH environment variable on your target system.

The following information is operating system dependent.

On Linux* Host Systems

Set up the Intel compiler environment with the following command:

  • Dash or other POSIX-compliant shell: $ . <install-dir>/bin/compilervars.sh -arch <arch> -platform <platform>

  • C shell: $ source <install-dir>/bin/compilervars.csh -arch <arch> -platform <platform>

  • Bash shell:

    • $ source <install-dir>/bin/compilervars.sh -arch <arch> -platform <platform>

    • $ . <install-dir>/bin/compilervars.sh -arch <arch> -platform <platform>

The environment script file requires an architecture argument <arch> for the -arch option, which takes the following values:

  • intel64: Compiler and libraries for Intel® 64 architecture-based target systems
  • ia32: Compiler and libraries for IA-32 architecture-based target systems

The environment script file also takes a target platform argument <platform> for the -platform option, which can have the following values:

  • linux: sets environment variables for the compiler and libraries for Linux targets only. This is the default target platform. So if the -platform option is not used, the target platform is assumed to be Linux.
  • android: sets environment variables for the compiler and libraries for Android targets only.

The default install path is /opt/intel/bin/ if the installation is conducted by the root user.

//# Examples

prompt>  source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux  //for Linux targets

prompt>  source /opt/intel/bin/compilervars.sh -arch ia32 -platform android   //for Android targets

On Windows* Host Systems

Under normal circumstances, you do not need to run the compilervars.bat batch file. The Intel® C++ command-line window sets these variables for you automatically.

For information on using the command-line window, see the Intel® C++ Compiler 18.0 Developer Guide and Reference.

Note

You need to run the batch file if a command-line window is opened without using one of the provided menu items in the Start menu, or if you want to use the compiler from a script of your own.

The batch file inserts the directories used by the Intel® C++ Compiler at the beginning of the existing paths. Because these directories appear first, they are searched before any directories in the path lists provided by Windows*. This is especially important if the existing path includes directories with files having the same names as those needed by the Intel® C++ Compiler.

If needed, you can run compilervars.bat each time you begin a session on Windows* systems by specifying it as the initialization file with the PIF Editor.

The syntax for using the compilervars batch file is as follows:

> compilervars.bat -arch <arch> -platform <platform>

The environment batch file requires an architecture argument <arch> for the -arch option, which takes the following values:

  • intel64: Compiler and libraries for Intel® 64 architecture-based target systems

  • ia32: Compiler and libraries for IA-32 architecture-based target systems

The environment batch file requires a platform argument <platform> for the -platform option, which takes the following values:

  • linux: sets up variables for Linux* targets
  • android: sets up variables for Android* targets

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