Specifying the Location of Compiler Components with setvars

Before you invoke the compiler, you may need to set certain environment variables that define the location of compiler-related components. The Intel® oneAPI DPC++ Compiler includes setvars scripts to set environment variables:

The following information is operating system dependent.

Linux:

Set the environment variables before using the compiler by sourcing the shell script setvars.sh. Depending on the shell, you can use the source command or a . (dot) to source the shell script, according to the following rule for a .sh script :

The environment script file has an optional target architecture argument intel64, which is used for compiler and libraries for Intel® 64 architecture-based targets.

If you want the script to run automatically, add the same command to the end of your startup file. For example, a .bash_profile entry for setvars.sh for Intel® 64 architecture targets:

# set environment vars for Intel® oneAPI DPC++ Compiler  
source <install-dir>/setvars.sh intel64

Note

Symbolic links are created in the /opt/intel directory at install. The environment variables use symbolic links. When two versions of the Intel® oneAPI DPC++ Compiler are installed, the newest installed version is symbolically linked.

With some Linux distributions, if the Intel® oneAPI DPC++ Compiler (dpcpp) is sourced using setvars.sh from the .bash_profile, the location of LIBRARY_PATH may not be set as expected. It may be necessary to source setvars.sh after starting a terminal session.

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

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

Windows:

For information on using the command line see Using the Command Line on Windows.

Note

You need to run the batch file if a command line 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® oneAPI DPC++ Compiler at the beginning of the existing paths. Because these directories appear first, they are searched before the directories in the path lists that are provided by Windows. This is especially important if the existing path includes directories with files that have the same names as those needed by the Intel® oneAPI DPC++ Compiler.

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

The <install-dir> is located at: C:\Program Files (x86)\inteloneapi.

The batch file takes two arguments:

<install-dir>\setvars.bat [<arg1>] [<arg2>]

By default, <arg1> is intel64: To set compiler and libraries for Intel® 64 architecture (host and target).

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

Note

If <arg1> is not specified, the script uses the intel64 argument by default. If <arg2> is not specified, the script uses the highest installed version of Microsoft Visual Studio detected during the installation procedure.