Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29286 Discussions

Error sourcing setvars.sh on Ubuntu 20.04

CJ00
Beginner
9,067 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
8,719 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
CJ00
Beginner
992 Views

@Ron_Green 

 

I tried logging everything using set -x like you suggested. The logs showed that every time a cd command was invoked, something funny was going on. I had customised cd to automatically display the files in the directory every time I did a cd, using the following function in .bash_aliases.

 32 # for auto ls after cd
 33 function cd {
 34   builtin cd "$@" && ls
 35 }

 

This was the cause of the problem. I've never had this issue with any scripts before, so it never crossed my mind.

I'm sorry I couldn't find this earlier as it was not set as an alias to cd or in .bashrc.

Once, I disabled it, the setvars.sh worked perfectly.

 

Thanks @VarshaS_Intel  and @James_T_Intel for the help too!

0 Kudos
Ron_Green
Moderator
980 Views

Ah, yes!  'cd', should have thought of that one!  Good catch.

The setvars.sh uses the unqualified names for 'ls' and 'cd' because some distros put those in /bin and others in /usr/bin.  So we can't fully path them.  

 

btw - that is a really cool customization for 'cd'.  Wish I could use it myself.  hmm, maybe if we use "mycd" or some other shorthand name that doesn't alias another command. 

 

I'll keep this issue in mind if we run into something similar in the future.  Thanks for bringing this to us!

 

0 Kudos
Reply