Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Error sourcing setvars.sh on Ubuntu 20.04

CJ00
Beginner
4,239 Views

I'm trying to set the variables after installing the packages intel-basekit and intel-hpckit through the apt package manager. No issues occurred during installation.

When I try to source the variables using the setvars.sh script, I get the following error.

 

:: initializing oneAPI environment ...
   bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
 
:: ERROR: No env scripts found: No "env/vars.sh" scripts to process.
   This can be caused by a bad or incomplete "--config" file.
   Can also be caused by an incomplete or missing oneAPI installation.

 

 I've read through the documentation in length and couldn't find answers.

Following this answer for zsh shells here, I tried running

 

bash -c 'source setvars.sh'
bash -c 'source /opt/intel/oneapi/compiler/latest/env/vars.sh'

 

There were no immediate errors, and the environment appeared to be initialized. The $PATH and $LD_LIBRARY_PATH variables contain /opt/intel/oneapi... paths in them. However, when I run ifort to compile a basic program, it throws the error:

 

ld: cannot find -lgcc
ld: cannot find -lgcc_s

 

 My system details are the following:

 

$ lsb_release -a
  Distributor ID:	Ubuntu
  Description:	Ubuntu 20.04.4 LTS
  Release:	20.04
  Codename:	focal

$ uname -r
  5.15.0-46-generic

$ uname -m
  x86_64

 

 

0 Kudos
1 Solution
Ron_Green
Moderator
3,891 Views

strange - I tried to set that alias and no issue.  I also changed link /bin/sh to /bin/dash.  no issues.

 

$ alias
alias ls='ls --color=auto'
rwgreen@orcsle156:~$ !source
source /cts/tools/oneapi/2022.2.0-up1/setvars.sh
 
:: initializing oneAPI environment ...
   -bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
:: advisor -- latest
:: ccl -- latest
:: clck -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: inspector -- latest
:: intelpython -- latest
:: ipp -- latest
:: ippcp -- latest
:: ipp -- latest
:: itac -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

 

 

setvars.sh finds all the vars.sh scripts under /opt/intel/oneapi/*/latest/env 

something in creating that list is wrong.  so time for the big debug hammer.

sudo bash

  # to get a root sudo shell

Edit /opt/intel/oneapi/setvars.sh

first line, change 

/bin/sh 

to

/bin/sh -x

 

exit the sudo shell, go back to user.

then source setvars.sh and capture the output.  like this

source /opt/intel/oneapi/setvars.sh |& tee source.log

 

let's see what is going wrong

View solution in original post

0 Kudos
22 Replies
Soumya_M_Intel
Moderator
3,769 Views

Hi CJ00,


Thanks for posting your concern on the forum. However, this forum topic is to provide support on Getting Started questions (such as download, installation, etc) for Intel® oneAPI Toolkits, Intel® Parallel Studio XE and Intel® System Studio. As the mentioned query is related to post-installation, it is out of our scope.


Nonetheless, please be assured, as we are routing your post to the correct forum. Based on your query, we are moving this topic to the 'Intel® oneAPI Base Toolkit' community. Our internal team would get back to you there in a timely manner.


Hope you have a nice day ahead!


Regards,

Soumya


0 Kudos
VarshaS_Intel
Moderator
3,745 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Could you please let us know the version of Intel OneAPI toolkits you have installed?

 

Could you please provide us with the screenshot of the error you are facing while running the fortran code? 

 

And also, could you let us know if you are able to get the fortran version after initializing the oneAPI environment?

 

ifort --version

 

At our end, we have tried the latest Intel oneAPI(2022.2) on Ubuntu 20.04 and we are able to get the expected results. Please find the below screenshot:

VarshaS_Intel_0-1660736716659.png

 

Thanks & Regards,

Varsha

 

0 Kudos
CJ00
Beginner
3,734 Views

Thanks for the quick response @VarshaS_Intel .

Here are the details.

 

Could you please let us know the version of Intel OneAPI toolkits you have installed?

$ sudo apt-cache policy intel-basekit intel-hpckit
intel-basekit:
  Installed: 2022.2.0-262
  Candidate: 2022.2.0-262
intel-hpckit:
  Installed: 2022.2.0-191
  Candidate: 2022.2.0-191

 

Could you please provide us with the screenshot of the error you are facing while running the fortran code? 

When I run bash -c 'source /opt/intel/oneapi/setvars.sh', the same initialization details are printed out as in your screenshot.

If I check for ifort after that, I get:

$ ifort --version

Command 'ifort' not found, did you mean:

  command 'isort' from deb isort (4.3.4+ds1-2)
  command 'fort' from deb fort-validator (1.2.0-1)

 

However if I run, the source and ifort commands in the same command string, ifort appears to be available as below

$ bash -c 'source /opt/intel/oneapi/setvars.sh; ifort --version'

:: initializing oneAPI environment ...
   bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
:: advisor -- latest
:: ccl -- latest
:: clck -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: inspector -- latest
:: intelpython -- latest
:: ipp -- latest
:: ippcp -- latest
:: ipp -- latest
:: itac -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vpl -- latest
:: vtune -- latest
:: oneAPI environment initialized ::
 
ifort (IFORT) 2021.6.0 20220226
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

 

Let me clarify that the primary issue I face is that even though I use the bash terminal I'm unable to run

source /opt/intel/oneapi/setvars.sh

and can instead only do

bash -c 'source /opt/intel/oneapi/setvars.sh'

The latter cannot be placed in a file like .bashrc as explained in this post in the Intel forums by @Ron_Green , so I keep having to set variables every time I open/split into a terminal. 

I hope I haven't made it confusing.

 

Thanks,

CJ

 


 

0 Kudos
James_T_Intel
Moderator
3,694 Views

First, on your base terminal, what do you get from


echo $SHELL


Ideally, this will show as /bin/bash. If you see zsh, you need to add a step to the line you are using to source. See the original thread you linked, but you should instead use:


bash -c 'source /opt/intel/oneapi/setvars.sh ; exec zsh'


Make sure you keep the exec zsh part, this puts you back into zsh while keeping the environment variables set by the bash script. You also only need the setvars, this should find the vars needed from each of the components.


Regarding the linker errors. The compilers depend on system runtime libraries, and need the development versions of those installed as well. I'm surprised these weren't automatically installed via APT, but you can get them directly using the following:


sudo apt install build-essential


This should take care of the linker errors you are encountering.


0 Kudos
CJ00
Beginner
3,686 Views

@James_T_Intel thanks for the follow up.

 

I must say, I'm a very bash person. I've never used any of these fancier shells, zsh and what not! Unsurprisingly, this is what I get for the SHELL variable.

$ echo $SHELL
/bin/bash

 

Regarding the linker errors. The compilers depend on system runtime libraries, and need the development versions of those installed as well. I'm surprised these weren't automatically installed via APT, but you can get them directly using the following:

 

I think the linker errors were a consequence of the environment variables not being intialized correctly. APT had handled the dependency during installation.

 

Finally, this is what works for me at the moment. It is very odd that bash requires this to be done. I have the same issue on an other Ubuntu 20.04 system too.

bash -c 'source /opt/intel/oneapi/setvars.sh; exec bash'

 Is there anyway I can include this in a script somewhere, so the variables are still available every time I split/open a new terminal?

 

Thanks,

CJ

0 Kudos
James_T_Intel
Moderator
3,630 Views

In theory, you could "source /opt/intel/oneapi/setvars.sh" in your .bashrc, but this seems to not set your environment correctly. Let's check something. If you just start a new terminal and source the setvars script, what do you get for your $PATH environment variable?


0 Kudos
CJ00
Beginner
3,605 Views

James,

I've tried several ways to get the setvars.sh script to add the required directories to $PATH.

These are the commands I've tried that have no effect on $PATH

$ source /opt/intel/oneapi/setvars.sh   
# Returns ERROR: No env scripts found

$ bash -c 'source /opt/intel/oneapi/setvars.sh'  
# Executes successfully but $PATH remains the same after the command is run.

$ bash -c 'source /opt/intel/oneapi/setvars.sh; echo $PATH'
# Executes successfully but $PATH remains the same after the command is run.

 

The only one that seems to work is

$ bash -c 'source /opt/intel/oneapi/setvars.sh; exec bash'
# Successfully initializes oneAPI environment

$ echo $PATH
opt/intel/oneapi/vtune/2022.3.0/bin64:/opt/intel/oneapi/vpl/2022.1.0/bin:....
# Required directories are appended to PATH variable

 

However, I understand this cannot be added to .bashrc or any similar script because of the 'exec bash' part at the end.

I cannot understand why I have to do 'bash -c' for it to work on a bash shell.

 

I understand the difficulties in trying to solve a non-reproducible issue. So, I'll work with the exec bash part included for now.

0 Kudos
Ron_Green
Moderator
3,625 Views

ok wait - the error you show is that it can't find gcc libraries.  did you install gcc?

gcc --version

 

what does that show?

 

0 Kudos
CJ00
Beginner
3,616 Views

Thanks for jumping in on this.

gcc --version gives me

$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
0 Kudos
Ron_Green
Moderator
3,610 Views

Ah I see - you missed a command to start a new zsh after the source.  do this

 

bash -c 'source /opt/intel/oneapi/setvars.sh ; exec zsh'

 

this should work.  if not, send the output of

 

ifort -# hello.f90

0 Kudos
CJ00
Beginner
3,609 Views

Ron,

bash -c 'source /opt/intel/oneapi/setvars.sh ; exec bash' does work.

But I do not use zsh or similar shells. I use bash on a freshly installed Ubuntu 20.04.

0 Kudos
Ron_Green
Moderator
3,603 Views

my confusion.

so you do use bash:

echo $0
-bash

maybe a bad installation?

cd /opt/intel/oneapi
find . -name vars.sh
./intelpython/python3.7/pkgs/intelpython-2021.1.1-1/env/vars.sh
./intelpython/python3.7/env/vars.sh
./intelpython/python3.7/envs/tensorflow_gpu/env/vars.sh
./intelpython/python3.7/envs/2021.1.1/env/vars.sh
./vpl/2021.1.1/env/vars.sh
./dnnl/2021.1.1/env/vars.sh
./mpi/2021.1.1/env/vars.sh
./advisor/2021.1.1/env/vars.sh
./compiler/2021.1-beta09/linux/env/vars.sh
./compiler/2021.1-beta09/linux/dpl_env/vars.sh
./compiler/2021.1.2/env/vars.sh
./mkl/2021.1.1/env/vars.sh
./tbb/2021.1.1/env/vars.sh
./vtune/2021.1.1/env/vars.sh
./dpl/2021.1.2/env/vars.sh
./dal/2021.1.1/env/vars.sh
./dpcpp-ct/2021.1.1/env/vars.sh
./ipp/2021.1.1/env/vars.sh
./dev-utilities/2021.1.1/env/vars.sh
./ccl/2021.1.1/env/vars.sh
./ippcp/2021.1.1/env/vars.sh
./debugger/10.0.0/env/vars.sh

 Did you install as root or with sudo or as a normal user?

 

if you have a simple hello.f90 like this

print *, "hello"
end

what is the output of

ifort -#  hello.f90 

0 Kudos
CJ00
Beginner
3,521 Views

$0 gives me

$ echo $0
/bin/bash

 

Searching for vars.sh gives me

$ find /opt/intel/oneapi/ -name 'vars.sh'
/opt/intel/oneapi/mkl/2022.1.0/env/vars.sh
/opt/intel/oneapi/ccl/2021.6.0/env/vars.sh
/opt/intel/oneapi/dev-utilities/2021.6.0/env/vars.sh
/opt/intel/oneapi/dpcpp-ct/2022.1.0/env/vars.sh
/opt/intel/oneapi/dnnl/2022.1.0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/pkgs/intelpython-2022.1.0-0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/envs/2022.1.0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/env/vars.sh
/opt/intel/oneapi/vpl/2022.1.0/env/vars.sh
/opt/intel/oneapi/debugger/2021.6.0/env/vars.sh
/opt/intel/oneapi/dpl/2021.7.0/env/vars.sh
/opt/intel/oneapi/itac/2021.6.0/env/vars.sh
/opt/intel/oneapi/ipp/2021.6.0/env/vars.sh
/opt/intel/oneapi/tbb/2021.6.0/env/vars.sh
/opt/intel/oneapi/dal/2021.6.0/env/vars.sh
/opt/intel/oneapi/advisor/2022.1.0/env/vars.sh
/opt/intel/oneapi/mpi/2021.6.0/env/vars.sh
/opt/intel/oneapi/inspector/2022.1.0/env/vars.sh
/opt/intel/oneapi/compiler/2022.1.0/env/vars.sh
/opt/intel/oneapi/ippcp/2021.6.0/env/vars.sh
/opt/intel/oneapi/vtune/2022.3.0/env/vars.sh
/opt/intel/oneapi/clck/2021.6.0/env/vars.sh

 

I installed OneAPI using the apt package manager with

$ sudo apt install intel-basekit intel-hpckit

 The repository was

$ apt-cache policy intel-basekit intel-hpckit
intel-basekit:
  Installed: 2022.2.0-262
  Candidate: 2022.2.0-262
  Version table:
 *** 2022.2.0-262 500
        500 https://apt.repos.intel.com/oneapi all/main amd64 Packages

intel-hpckit:
  Installed: 2022.2.0-191
  Candidate: 2022.2.0-191
  Version table:
 *** 2022.2.0-191 500
        500 https://apt.repos.intel.com/oneapi all/main amd64 Packages

 

I can't run ifort without sourcing the setvars.sh script. If I use the ifort executable's path directly, I get

$ cat hello.f90 
program hello
  print*, "hello"
end program hello

$  /opt/intel/oneapi/compiler/latest/linux/bin/intel64/ifort --version
ifort (IFORT) 2021.6.0 20220226
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

$ /opt/intel/oneapi/compiler/latest/linux/bin/intel64/ifort -# hello.f90 
/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/fortcom  \
    -D__INTEL_COMPILER=2021 \
    -D__INTEL_COMPILER_UPDATE=6 \
    -D__unix__ \
    -D__unix \
    -D__linux__ \
    -D__linux \
    -D__gnu_linux__ \
    -Dunix \
    -Dlinux \
    -D__ELF__ \
    -D__x86_64 \
    -D__x86_64__ \
    -D__amd64 \
    -D__amd64__ \
    -D__INTEL_COMPILER_BUILD_DATE=20220226 \
    -D__INTEL_OFFLOAD \
    -D__MMX__ \
    -D__SSE__ \
    -D__SSE_MATH__ \
    -D__SSE2__ \
    -D__SSE2_MATH__ \
    -D__pentium4 \
    -D__pentium4__ \
    -D__tune_pentium4__ \
    -I. \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include/intel64 \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include/icc \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include \
    -I/usr/local/include \
    -I/usr/lib/gcc/x86_64-linux-gnu/9/include \
    -I/usr/include/ \
    -I/usr/include \
    -I/usr/include/x86_64-linux-gnu \
    -omp_simd \
    -O2 \
    "-reentrancy threaded" \
    -simd \
    -offload_host \
    -mGLOB_em64t=TRUE \
    -mP1OPT_version=2021.6.0-intel64 \
    -mGLOB_diag_file=/tmp/ifortcHixVY.diag \
    -mGLOB_long_size_64 \
    -mGLOB_routine_pointer_size_64 \
    -mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 \
    -mP2OPT_static_promotion \
    -mGLOB_pack_sort_init_list \
    -mP1OPT_print_version=FALSE \
    -mCG_use_gas_got_workaround=F \
    -mP2OPT_align_option_used=TRUE \
    -mGLOB_gcc_version=940 \
    -mGLOB_options_string=-# \
    -mGLOB_cxx_limited_range=FALSE \
    -mCG_extend_parms=FALSE \
    -mGLOB_compiler_bin_directory=/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64 \
    -mGLOB_as_output_backup_file_name=/tmp/ifortmXBoPXas_.s \
    -mGLOB_dashboard_use_source_name \
    -mIPOPT_activate \
    -mIPOPT_lite \
    -mGLOB_uarch_tuning=0x0 \
    -mGLOB_product_id_code=0x22006d91 \
    -mCG_bnl_movbe=T \
    -mP3OPT_use_mspp_call_convention \
    -mP2OPT_subs_out_of_bound=FALSE \
    -mP2OPT_disam_type_based_disam=2 \
    -mGLOB_ansi_alias \
    -mPGOPTI_value_profile_use=T \
    -mGLOB_opt_report_use_source_name \
    -mGLOB_offload_mode=1 \
    -mGLOB_offload_no_openmp=TRUE \
    -mP2OPT_offload_unique_var_string=ifort1117675979RF5JDZ \
    -mP2OPT_hlo_level=2 \
    -mP2OPT_hlo \
    -mP2OPT_hpo_rtt_control=0 \
    -mIPOPT_args_in_regs=0 \
    -mP2OPT_disam_assume_nonstd_intent_in=FALSE \
    -mGLOB_imf_mapping_library=/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/libiml_attr.so \
    -mIPOPT_single_file_compile_and_link=TRUE \
    -mPGOPTI_gen_threadsafe_level=0 \
    -mIPOPT_lto_object_enabled \
    -mIPOPT_lto_object_value=1 \
    -mIPOPT_obj_output_file_name=/tmp/ifortcHixVY.o \
    -mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarchLj8AYZ \
    -mGLOB_linker_version=2.34 \
    -mGLOB_linker=ld \
    -mGLOB_driver_tempfile_name=/tmp/iforttempfiletpRtyZ \
    -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS \
    -mGLOB_async_unwind_tables=TRUE \
    -mGLOB_obj_output_file=/tmp/ifortcHixVY.o \
    -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN \
    -mP1OPT_source_file_name=hello.f90 \
    -mP1OPT_full_source_file_name=/home/cibin/Documents/scratch/hello.f90 \
    -mP2OPT_symtab_type_copy=true \
    hello.f90

ld  \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o \
    --eh-frame-hdr \
    --build-id \
    -dynamic-linker \
    /lib64/ld-linux-x86-64.so.2 \
    -m \
    elf_x86_64 \
    -plugin \
    /opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/../../lib/icx-lto.so \
    -o \
    a.out \
    /opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin/for_main.o \
    -L/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/ \
    -L/lib/x86_64-linux-gnu/ \
    -L/lib/../lib64 \
    -L/lib/../lib/ \
    -L/usr/lib/x86_64-linux-gnu/ \
    -L/usr/lib/../lib64 \
    -L/usr/lib/../lib/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../ \
    -L/lib64 \
    -L/lib/ \
    -L/usr/lib64 \
    -L/usr/lib \
    /tmp/ifortcHixVY.o \
    -Bdynamic \
    -Bstatic \
    -lifport \
    -lifcoremt \
    -limf \
    -lsvml \
    -Bdynamic \
    -lm \
    -Bstatic \
    -lipgo \
    -lirc \
    -Bdynamic \
    -lpthread \
    -Bstatic \
    -lsvml \
    -Bdynamic \
    -lc \
    -lgcc \
    -lgcc_s \
    -Bstatic \
    -lirc_s \
    -Bdynamic \
    -ldl \
    -lc \
    /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o

rm /tmp/ifortdashvHmgie0  # and some other similar temporary files

 

If I run it without the -# flag, I get

$ /opt/intel/oneapi/compiler/latest/linux/bin/intel64/ifort hello.f90 
ld: /opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/../../lib/icx-lto.so: error loading plugin: libimf.so: cannot open shared object file: No such file or directory

 I think that is because setvars.sh has not been run.

 

ifort works without any issues with "bash -c 'source setvars.sh'; env bash". This makes me think it's not an installation issue.

0 Kudos
CJ00
Beginner
3,586 Views

Checking $0 gives me

$ echo $0
/bin/bash

 

Searching for vars.sh gives me

$ find /opt/intel/oneapi/ -name 'vars.sh'
/opt/intel/oneapi/mkl/2022.1.0/env/vars.sh
/opt/intel/oneapi/ccl/2021.6.0/env/vars.sh
/opt/intel/oneapi/dev-utilities/2021.6.0/env/vars.sh
/opt/intel/oneapi/dpcpp-ct/2022.1.0/env/vars.sh
/opt/intel/oneapi/dnnl/2022.1.0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/pkgs/intelpython-2022.1.0-0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/envs/2022.1.0/env/vars.sh
/opt/intel/oneapi/intelpython/python3.9/env/vars.sh
/opt/intel/oneapi/vpl/2022.1.0/env/vars.sh
/opt/intel/oneapi/debugger/2021.6.0/env/vars.sh
/opt/intel/oneapi/dpl/2021.7.0/env/vars.sh
/opt/intel/oneapi/itac/2021.6.0/env/vars.sh
/opt/intel/oneapi/ipp/2021.6.0/env/vars.sh
/opt/intel/oneapi/tbb/2021.6.0/env/vars.sh
/opt/intel/oneapi/dal/2021.6.0/env/vars.sh
/opt/intel/oneapi/advisor/2022.1.0/env/vars.sh
/opt/intel/oneapi/mpi/2021.6.0/env/vars.sh
/opt/intel/oneapi/inspector/2022.1.0/env/vars.sh
/opt/intel/oneapi/compiler/2022.1.0/env/vars.sh
/opt/intel/oneapi/ippcp/2021.6.0/env/vars.sh
/opt/intel/oneapi/vtune/2022.3.0/env/vars.sh
/opt/intel/oneapi/clck/2021.6.0/env/vars.sh

 

Installed it using apt using sudo apt install intel-basekit intel-hpckit from the following apt repos:

$ apt-cache policy intel-basekit intel-hpckit
intel-basekit:
  Installed: 2022.2.0-262
  Candidate: 2022.2.0-262
  Version table:
 *** 2022.2.0-262 500
        500 https://apt.repos.intel.com/oneapi all/main amd64 Packages

intel-hpckit:
  Installed: 2022.2.0-191
  Candidate: 2022.2.0-191
  Version table:
 *** 2022.2.0-191 500
        500 https://apt.repos.intel.com/oneapi all/main amd64 Packages
0 Kudos
Ron_Green
Moderator
3,591 Views

what do you have in ~/.bashrc file, if anything?

did you use the interactive installer or the silent installer or APT?

0 Kudos
CJ00
Beginner
3,521 Views

I do not have any scripts being sourced/executed in ~/.bashrc. Only have a few additions to $PATH.

 

I cannot run ifort -# without setting the env variables as the executable will not be found/available.

If I run ifort directly from the oneAPI executable's directory, I get

$ /opt/intel/oneapi/compiler/latest/linux/bin/intel64/ifort -# hello.f90 
/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/fortcom  \
    -D__INTEL_COMPILER=2021 \
    -D__INTEL_COMPILER_UPDATE=6 \
    -D__unix__ \
    -D__unix \
    -D__linux__ \
    -D__linux \
    -D__gnu_linux__ \
    -Dunix \
    -Dlinux \
    -D__ELF__ \
    -D__x86_64 \
    -D__x86_64__ \
    -D__amd64 \
    -D__amd64__ \
    -D__INTEL_COMPILER_BUILD_DATE=20220226 \
    -D__INTEL_OFFLOAD \
    -D__MMX__ \
    -D__SSE__ \
    -D__SSE_MATH__ \
    -D__SSE2__ \
    -D__SSE2_MATH__ \
    -D__pentium4 \
    -D__pentium4__ \
    -D__tune_pentium4__ \
    -I. \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include/intel64 \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include/icc \
    -I/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/include \
    -I/usr/local/include \
    -I/usr/lib/gcc/x86_64-linux-gnu/9/include \
    -I/usr/include/ \
    -I/usr/include \
    -I/usr/include/x86_64-linux-gnu \
    -omp_simd \
    -O2 \
    "-reentrancy threaded" \
    -simd \
    -offload_host \
    -mGLOB_em64t=TRUE \
    -mP1OPT_version=2021.6.0-intel64 \
    -mGLOB_diag_file=/tmp/ifort8zfO3i.diag \
    -mGLOB_long_size_64 \
    -mGLOB_routine_pointer_size_64 \
    -mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 \
    -mP2OPT_static_promotion \
    -mGLOB_pack_sort_init_list \
    -mP1OPT_print_version=FALSE \
    -mCG_use_gas_got_workaround=F \
    -mP2OPT_align_option_used=TRUE \
    -mGLOB_gcc_version=940 \
    -mGLOB_options_string=-# \
    -mGLOB_cxx_limited_range=FALSE \
    -mCG_extend_parms=FALSE \
    -mGLOB_compiler_bin_directory=/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64 \
    -mGLOB_as_output_backup_file_name=/tmp/ifortRtLJeias_.s \
    -mGLOB_dashboard_use_source_name \
    -mIPOPT_activate \
    -mIPOPT_lite \
    -mGLOB_uarch_tuning=0x0 \
    -mGLOB_product_id_code=0x22006d91 \
    -mCG_bnl_movbe=T \
    -mP3OPT_use_mspp_call_convention \
    -mP2OPT_subs_out_of_bound=FALSE \
    -mP2OPT_disam_type_based_disam=2 \
    -mGLOB_ansi_alias \
    -mPGOPTI_value_profile_use=T \
    -mGLOB_opt_report_use_source_name \
    -mGLOB_offload_mode=1 \
    -mGLOB_offload_no_openmp=TRUE \
    -mP2OPT_offload_unique_var_string=ifort1154436346eSjQXh \
    -mP2OPT_hlo_level=2 \
    -mP2OPT_hlo \
    -mP2OPT_hpo_rtt_control=0 \
    -mIPOPT_args_in_regs=0 \
    -mP2OPT_disam_assume_nonstd_intent_in=FALSE \
    -mGLOB_imf_mapping_library=/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/libiml_attr.so \
    -mIPOPT_single_file_compile_and_link=TRUE \
    -mPGOPTI_gen_threadsafe_level=0 \
    -mIPOPT_lto_object_enabled \
    -mIPOPT_lto_object_value=1 \
    -mIPOPT_obj_output_file_name=/tmp/ifort8zfO3i.o \
    -mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarch0sFFUh \
    -mGLOB_linker_version=2.34 \
    -mGLOB_linker=ld \
    -mGLOB_driver_tempfile_name=/tmp/iforttempfile5aRi8h \
    -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS \
    -mGLOB_async_unwind_tables=TRUE \
    -mGLOB_obj_output_file=/tmp/ifort8zfO3i.o \
    -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN \
    -mP1OPT_source_file_name=hello.f90 \
    -mP1OPT_full_source_file_name=/home/cibin/Documents/scratch/hello.f90 \
    -mP2OPT_symtab_type_copy=true \
    hello.f90

ld  \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o \
    --eh-frame-hdr \
    --build-id \
    -dynamic-linker \
    /lib64/ld-linux-x86-64.so.2 \
    -m \
    elf_x86_64 \
    -plugin \
    /opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../bin/intel64/../../lib/icx-lto.so \
    -o \
    a.out \
    /opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin/for_main.o \
    -L/opt/intel/oneapi/compiler/2022.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/ \
    -L/lib/x86_64-linux-gnu/ \
    -L/lib/../lib64 \
    -L/lib/../lib/ \
    -L/usr/lib/x86_64-linux-gnu/ \
    -L/usr/lib/../lib64 \
    -L/usr/lib/../lib/ \
    -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../ \
    -L/lib64 \
    -L/lib/ \
    -L/usr/lib64 \
    -L/usr/lib \
    /tmp/ifort8zfO3i.o \
    -Bdynamic \
    -Bstatic \
    -lifport \
    -lifcoremt \
    -limf \
    -lsvml \
    -Bdynamic \
    -lm \
    -Bstatic \
    -lipgo \
    -lirc \
    -Bdynamic \
    -lpthread \
    -Bstatic \
    -lsvml \
    -Bdynamic \
    -lc \
    -lgcc \
    -lgcc_s \
    -Bstatic \
    -lirc_s \
    -Bdynamic \
    -ldl \
    -lc \
    /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o \
    /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o

rm /tmp/ifortdashvauM1ag  # And some other tmp files

 

 

0 Kudos
Ron_Green
Moderator
3,572 Views

CJ,

a few questions

 

This is Ubu 20.04.  Is this a workstation or server running Ubuntu, or is this a VM, a container, or WSL 2.0?

 

next you said "When I try to source the variables using the setvars.sh script, I get the following error."

<snip>

 

your command is just

'source /opt/intel/oneapi/setvars.sh' 

correct?

 

Do you have sh as a sym link to bash?

ls -l /bin/sh

lrwxrwxrwx 1 root root 4 Oct 26  2020 /bin/sh -> bash

 

a few more questions or tests 

 

 

which ln
/usr/bin/ln

 

 

 

 

 

which ls
/usr/bin/ls

 

 

and do you have aliases, particularly for 'ls'?

 

 

alias

 

 

 

Did your 'latest' links get created?

 

ls -l /opt/intel/oneapi/*/*/env/vars.sh
-rwxr-xr-x 1 root  root  1652 Nov 11  2020 /opt/intel/oneapi/advisor/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  1652 Nov 11  2020 /opt/intel/oneapi/advisor/latest/env/vars.sh
-rwxr-xr-x 1 root  root  4505 Nov  5  2020 /opt/intel/oneapi/ccl/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  4505 Nov  5  2020 /opt/intel/oneapi/ccl/latest/env/vars.sh
-rwxr-xr-x 1 root  root  7949 Dec 14  2020 /opt/intel/oneapi/compiler/2021.1.2/env/vars.sh
-rwxr-xr-x 1 root  root  7949 Dec 14  2020 /opt/intel/oneapi/compiler/latest/env/vars.sh
-rwxr-xr-x 1 root  root  4038 Nov 11  2020 /opt/intel/oneapi/dal/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  4038 Nov 11  2020 /opt/intel/oneapi/dal/latest/env/vars.sh
-rwxr-xr-x 1 root  root  4961 Nov  4  2020 /opt/intel/oneapi/debugger/10.0.0/env/vars.sh
-rwxr-xr-x 1 root  root  4961 Nov  4  2020 /opt/intel/oneapi/debugger/latest/env/vars.sh
-rw-rw-r-- 1 root  root  5300 Nov  9  2020 /opt/intel/oneapi/dev-utilities/2021.1.1/env/vars.sh
-rw-rw-r-- 1 root  root  5300 Nov  9  2020 /opt/intel/oneapi/dev-utilities/latest/env/vars.sh
-rwxr-xr-x 1 root  root  5591 Nov 11  2020 /opt/intel/oneapi/dnnl/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  5591 Nov 11  2020 /opt/intel/oneapi/dnnl/latest/env/vars.sh
-rwxr-xr-x 1 root  root  4006 Nov  3  2020 /opt/intel/oneapi/dpcpp-ct/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  4006 Nov  3  2020 /opt/intel/oneapi/dpcpp-ct/latest/env/vars.sh
-rwxr-xr-x 1 root  root  4494 Oct 15  2020 /opt/intel/oneapi/dpl/2021.1.2/env/vars.sh
-rwxr-xr-x 1 root  root  4494 Oct 15  2020 /opt/intel/oneapi/dpl/latest/env/vars.sh
-rw-rw-r-- 1 19712 12137 4065 Nov 11  2020 /opt/intel/oneapi/intelpython/latest/env/vars.sh
-rw-rw-r-- 1 19712 12137 4065 Nov 11  2020 /opt/intel/oneapi/intelpython/python3.7/env/vars.sh
-rwxrwxr-x 1 root  root  3590 Nov 12  2020 /opt/intel/oneapi/ipp/2021.1.1/env/vars.sh
-rwxrwxr-x 1 root  root  3813 Nov  5  2020 /opt/intel/oneapi/ippcp/2021.1.1/env/vars.sh
-rwxrwxr-x 1 root  root  3813 Nov  5  2020 /opt/intel/oneapi/ippcp/latest/env/vars.sh
-rwxrwxr-x 1 root  root  3590 Nov 12  2020 /opt/intel/oneapi/ipp/latest/env/vars.sh
-rwxr-xr-x 1 root  root  7922 Nov  4  2020 /opt/intel/oneapi/mkl/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  7922 Nov  4  2020 /opt/intel/oneapi/mkl/latest/env/vars.sh
-rw-r--r-- 1 root  root  6275 Nov 12  2020 /opt/intel/oneapi/mpi/2021.1.1/env/vars.sh
-rw-r--r-- 1 root  root  6275 Nov 12  2020 /opt/intel/oneapi/mpi/latest/env/vars.sh
-rw-r--r-- 1 root  root  2070 Oct 20  2020 /opt/intel/oneapi/tbb/2021.1.1/env/vars.sh
-rw-r--r-- 1 root  root  2070 Oct 20  2020 /opt/intel/oneapi/tbb/latest/env/vars.sh
-rw-r--r-- 1 root  root  3828 Oct 30  2020 /opt/intel/oneapi/vpl/2021.1.1/env/vars.sh
-rw-r--r-- 1 root  root  3828 Oct 30  2020 /opt/intel/oneapi/vpl/latest/env/vars.sh
-rwxr-xr-x 1 root  root  1599 Nov 10  2020 /opt/intel/oneapi/vtune/2021.1.1/env/vars.sh
-rwxr-xr-x 1 root  root  1599 Nov 10  2020 /opt/intel/oneapi/vtune/latest/env/vars.sh

 

 

0 Kudos
CJ00
Beginner
3,537 Views

Ron,

This is on a Dell Inspiron laptop running Ubuntu 20.04.

I also have access to a workstation running Ubuntu 20.04 that I'm checking these queries against. It has responded identically so far.

 

I have run 'source setvars.sh' and 'bash -c 'source setvars.sh''. Without the 'bash -c' the script throws an error.

$ # This throws an error 
$ source setvars.sh 
 
:: initializing oneAPI environment ...
   bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
 
:: ERROR: No env scripts found: No "env/vars.sh" scripts to process.
   This can be caused by a bad or incomplete "--config" file.
   Can also be caused by an incomplete or missing oneAPI installation.

$ # This does not throw an error 
$ bash -c 'source setvars.sh'
 
:: initializing oneAPI environment ...
   bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
:: advisor -- latest
# ...
# ... list of all other components ...
:: vtune -- latest
:: oneAPI environment initialized ::

 

ls is a link to dash (not bash). Which is pretty standard I guess?

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Aug 15 14:32 /bin/sh -> dash

 

The ls and ln commands are from /usr/bin.

$ which ln
/usr/bin/ln

$ which ls
/usr/bin/ls

$ alias ls
alias ls='ls --color=auto'

 

The links to the 'latest' directory seem to have been created too.

$ ls -l /opt/intel/oneapi/*/*/env/vars.sh
-rwxr-xr-x 1 root root  2668 Mar 25 17:08 /opt/intel/oneapi/advisor/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root  2668 Mar 25 17:08 /opt/intel/oneapi/advisor/latest/env/vars.sh
-rwxr-xr-x 1 root root  5654 Mar 11 15:55 /opt/intel/oneapi/ccl/2021.6.0/env/vars.sh
-rwxr-xr-x 1 root root  5654 Mar 11 15:55 /opt/intel/oneapi/ccl/latest/env/vars.sh
-rw-r--r-- 1 root root  9148 Mar 29 19:38 /opt/intel/oneapi/clck/2021.6.0/env/vars.sh
-rw-r--r-- 1 root root  9148 Mar 29 19:38 /opt/intel/oneapi/clck/latest/env/vars.sh
-rwxr-xr-x 1 root root 12392 Mar 16 23:50 /opt/intel/oneapi/compiler/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root 12392 Mar 16 23:50 /opt/intel/oneapi/compiler/latest/env/vars.sh
-rwxr-xr-x 1 root root  9542 Mar  5 05:26 /opt/intel/oneapi/dal/2021.6.0/env/vars.sh
-rwxr-xr-x 1 root root  9542 Mar  5 05:26 /opt/intel/oneapi/dal/latest/env/vars.sh
-rw-r--r-- 1 root root  6220 Mar 17 20:45 /opt/intel/oneapi/debugger/2021.6.0/env/vars.sh
-rw-r--r-- 1 root root  6220 Mar 17 20:45 /opt/intel/oneapi/debugger/latest/env/vars.sh
-rw-r--r-- 1 root root  7844 Mar 17 21:19 /opt/intel/oneapi/dev-utilities/2021.6.0/env/vars.sh
-rw-r--r-- 1 root root  7844 Mar 17 21:19 /opt/intel/oneapi/dev-utilities/latest/env/vars.sh
-rwxr-xr-x 1 root root  7602 Mar 29 02:53 /opt/intel/oneapi/dnnl/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root  7602 Mar 29 02:53 /opt/intel/oneapi/dnnl/latest/env/vars.sh
-rwxr-xr-x 1 root root  5445 Mar  1 08:45 /opt/intel/oneapi/dpcpp-ct/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root  5445 Mar  1 08:45 /opt/intel/oneapi/dpcpp-ct/latest/env/vars.sh
-rwxr-xr-x 1 root root  7430 Mar 10 15:57 /opt/intel/oneapi/dpl/2021.7.0/env/vars.sh
-rwxr-xr-x 1 root root  7430 Mar 10 15:57 /opt/intel/oneapi/dpl/latest/env/vars.sh
-rwxr-xr-x 1 root root  1885 Mar  4 06:20 /opt/intel/oneapi/inspector/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root  1885 Mar  4 06:20 /opt/intel/oneapi/inspector/latest/env/vars.sh
-rw-rw-r-- 1 root root 11929 Jan 12  2022 /opt/intel/oneapi/intelpython/latest/env/vars.sh
-rw-rw-r-- 1 root root 11929 Jan 12  2022 /opt/intel/oneapi/intelpython/python3.9/env/vars.sh
-rwxrwxr-x 1 root root  5975 Mar  9 02:28 /opt/intel/oneapi/ipp/2021.6.0/env/vars.sh
-rwxrwxr-x 1 root root  6335 Feb 28 02:55 /opt/intel/oneapi/ippcp/2021.6.0/env/vars.sh
-rwxrwxr-x 1 root root  6335 Feb 28 02:55 /opt/intel/oneapi/ippcp/latest/env/vars.sh
-rwxrwxr-x 1 root root  5975 Mar  9 02:28 /opt/intel/oneapi/ipp/latest/env/vars.sh
-rwxr-xr-x 1 root root  6066 Mar 28 00:00 /opt/intel/oneapi/itac/2021.6.0/env/vars.sh
-rwxr-xr-x 1 root root  6066 Mar 28 00:00 /opt/intel/oneapi/itac/latest/env/vars.sh
-rwxr-xr-x 1 root root 11614 Mar 11 10:41 /opt/intel/oneapi/mkl/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root 11614 Mar 11 10:41 /opt/intel/oneapi/mkl/latest/env/vars.sh
-rw-r--r-- 1 root root  7621 Feb 28 02:46 /opt/intel/oneapi/mpi/2021.6.0/env/vars.sh
-rw-r--r-- 1 root root  7621 Feb 28 02:46 /opt/intel/oneapi/mpi/latest/env/vars.sh
-rw-r--r-- 1 root root  6894 Jan 24  2022 /opt/intel/oneapi/tbb/2021.6.0/env/vars.sh
-rw-r--r-- 1 root root  6894 Jan 24  2022 /opt/intel/oneapi/tbb/latest/env/vars.sh
-rwxr-xr-x 1 root root  8497 Mar 18 01:15 /opt/intel/oneapi/vpl/2022.1.0/env/vars.sh
-rwxr-xr-x 1 root root  8497 Mar 18 01:15 /opt/intel/oneapi/vpl/latest/env/vars.sh
-rwxr-xr-x 1 root root  2603 Mar 29 02:07 /opt/intel/oneapi/vtune/2022.3.0/env/vars.sh
-rwxr-xr-x 1 root root  2603 Mar 29 02:07 /opt/intel/oneapi/vtune/latest/env/vars.sh
0 Kudos
Ron_Green
Moderator
3,440 Views

sorry for the delay in reponse.

 

ok, the alias for 'ls' has to go - get rid of it.  setvars.sh uses 'ls' and expects it to be unaliased so it can find and run all the vars.sh files.  if it's aliased in your .bashrc or other dot file, comment that out.  if not maybe it's coming from default in /etc/profile or /etc/bashrc.

 

next, dash is not what I see for /bin/sh.  I see bash

 

more /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
rwgreen@orcsle156:~$ which bash
/usr/bin/bash
rwgreen:~$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Oct 26  2020 /bin/sh -> bash

there is a discussion of bash vs dash for Ubuntu HERE

it's odd that my Ubu 20 system has /bin/sh linked to bash, not dash.  my system gets kicked around a lot supporting issues.  yours is probably more "pure" Ubuntu.  I don't think that link matters.  I really think it's the alias on 'ls'.  Let me try that alias and see what I get.

 

 

0 Kudos
Ron_Green
Moderator
3,892 Views

strange - I tried to set that alias and no issue.  I also changed link /bin/sh to /bin/dash.  no issues.

 

$ alias
alias ls='ls --color=auto'
rwgreen@orcsle156:~$ !source
source /cts/tools/oneapi/2022.2.0-up1/setvars.sh
 
:: initializing oneAPI environment ...
   -bash: BASH_VERSION = 5.0.17(1)-release
   args: Using "$@" for setvars.sh arguments: 
:: advisor -- latest
:: ccl -- latest
:: clck -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: inspector -- latest
:: intelpython -- latest
:: ipp -- latest
:: ippcp -- latest
:: ipp -- latest
:: itac -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

 

 

setvars.sh finds all the vars.sh scripts under /opt/intel/oneapi/*/latest/env 

something in creating that list is wrong.  so time for the big debug hammer.

sudo bash

  # to get a root sudo shell

Edit /opt/intel/oneapi/setvars.sh

first line, change 

/bin/sh 

to

/bin/sh -x

 

exit the sudo shell, go back to user.

then source setvars.sh and capture the output.  like this

source /opt/intel/oneapi/setvars.sh |& tee source.log

 

let's see what is going wrong

0 Kudos
Reply