Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Specifying Location of Compiler Components with compilervars File

$
0
0

Before you invoke the compiler, you may need to set certain environment variables that define the location of compiler-related components.

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

  • On Linux* and OS X*, the file is a shell script called compilervars.sh or compilervars.csh.
  • On Windows*, the file is a batch file called compilervars.bat. The batch file iclvars.bat is provided for compatibility.

The following information is operating system dependent.

Linux* and OS X*:

Set the environment variables before using the compiler. You can use the source command to execute the shell script compilervars.sh or compilervars.csh. You can also type the location of the shell script, beginning with ./.

//# syntax:source  /<install-dir>/bin/compilervars.sh <arg> 
./<install-dir>/bin/compilervars.sh <arg> //# examples: (assuming <install-dir> is /installed/compiler/)
prompt>  source /installed/compiler/bin/compilervars.sh ia32
prompt>  ./installed/compiler/bin/compilervars.sh ia32

// OR//# syntax:source  /<install-dir>/bin/compilervars.csh <arg> 
./<install-dir>/bin/compilervars.csh <arg> //# examples: (assuming <install-dir> is /installed/compiler/)
prompt>  source /installed/compiler/bin/compilervars.csh ia32
prompt>  ./installed/compiler/bin/compilervars.csh ia32

The environment script file requires an architecture argument <arg>:

  • ia32: Compiler and libraries for IA-32 architecture only.
  • intel64: Compiler and libraries for Intel® 64 architecture only.

The default install path is /opt/intel/bin/<version>/ if the installation was conducted by the root user, where <version> is the version of the compiler you wish to set the environment for.

If you want the script to run automatically, add the same command to the end of your startup file.

Sample .bash_profile entry for compilervars.sh for IA-32 architecture only:

# set environment vars for Intel(R)  C++  Compiler
source <install-dir>/bin/compilervars.sh ia32

Note

Symbolic links are created in the /opt/intel directory at install. The environment variables use symbolic links; however, if two versions of the Intel® C++ Compiler are installed, the most recently installed version will be symbolically linked.

Note

With some Linux* distributions, if the Intel® C++ compiler (icpc) is sourced using compilervars.sh from the .bash_profile, the location of LIBRARY_PATH may not be set as expected. It may be necessary to source compilervars.sh after starting a terminal session.

If the proper environment variables are not set, an error similar to the following will appear when attempting to execute a compiled program:

./a.out: error while loading shared libraries:
libimf.so: cannot open shared object file: No such file or directory

Windows*:

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 Using the Intel® Command-Line Window.

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 batch file takes two arguments:

<install-dir>\bin\compilervars.bat <arg1> [<arg2>]
where <arg1> is one of the following:

  • intel64: Compiler and libraries for Intel® 64 architecture only (host and target)

  • ia32: Compiler and libraries for IA-32 architecture only (host and target)

  • ia32_intel64: Compiler running on IA-32 architecture (host) that generates code for Intel® 64 architecture (target) using Intel® 64 architecture libraries

<arg2>, is optional. If specified, is one of the following:

  • vs2015: Microsoft Visual Studio* 2015

  • vs2013: Microsoft Visual Studio* 2013

  • vs2012: Microsoft Visual Studio* 2012

  • vs2010: Microsoft Visual Studio* 2010

Note

If <arg2> is not specified, the script uses the version of Visual Studio* that was detected during the installation procedure.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>