Intel C++ Compiler "icc : command not found" error in Ubuntu [Solved]

rukawa
@rukawa-Y0pUkC โ€ข Oct 27, 2024

Hello everybody,
I've recently installed the intel's icc compiler, but I'm still unable to use it because everytime I try to compile my c programs using it I get the message :
icc : command not found
I reinstalled the icc compiler, but I still have the same problem.
Should I make some modifications somewhere in some file so that the operating system takes this newly unstalled software into account? What could be the source of the problem?
I have an UBUNTU 12.04 by the way.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    amd64 or i386 system ?

  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek Rawalamd64 or i386 system ?

    amd64

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    have you installed ia32-libs ?
    apt-get ia32-libs

    And still problem persist, check in directory : /opt whether folder name 'intel' exist or not.

  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek Rawalhave you installed ia32-libs ?
    apt-get ia32-libs

    And still problem persist, check in directory : /opt whether folder name 'intel' exist or not.

    I installed ia32-libs, and I checked /opt and the folder name 'intel' exists. I still have the same problem though.

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    Okay that's good,
    Open terminal & type

    gedit ~/.bashrc 

    enter this line at end of file :

    export PATH=$PATH:/opt/intel/bin 

    save it.
    Now,type in terminal

     source ~/.bashrc 
  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek RawalOkay that's good,
    Open terminal & type
    gedit ~/.bashrc 
    enter this line at end of file :
    export PATH=$PATH:/opt/intel/bin 
    save it.
    Now,type in terminal
    source ~/.bashrc 

    I entered the following line at the end of the file :

    export PATH=$PATH:/opt/intel/bin 

    but when I type :
    rukawa@ruka:~$ sudo ~/.bashrc
    I get the following message:
    sudo: /home/rukawa/.bashrc: command not found
    I tried to do it without sudo and I got this :
    rukawa@ruka:~$ ~/.bashrc
    bash: /home/rukawa/.bashrc: Permission denied

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    Open /Home, Press Ctrl+H to show hidden files, there will be file named .bashrc open it using any editor you like.
    111

  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek RawalOpen /Home, Press Ctrl+H to show hidden files, there will be file named .bashrc open it using any editor you like.
    111

    I did that

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    rukawaI did that

    make it executable
    sudo chmod 755 <to the directory>

    or simply right click on file & click on 'make it executable'

    and it's

     source ~/.bashrc 
  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek Rawalmake it executable
    sudo chmod 755 <to the directory>

    or simply right click on file & click on 'make it executable'

    and it's
     source ~/.bashrc 

    I made it executable and executed the following command without problems:

     source ~/.bashrc 
  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    rukawaI made it executable and executed the following command without problems:
     source ~/.bashrc 

    now compile your C code using icc commands. It will compile with icc compiler.

  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek Rawalnow compile your C code using icc commands. It will compile with icc compiler.

    I'm really sorry, but it didn't solve the problem, I still get the message :
    icc : command not found

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 2, 2013

    Tell me the output of

     sudo /opt/intel/bin/link_install.sh -s 
  • rukawa

    @rukawa-Y0pUkC • Nov 2, 2013

    Abhishek RawalTell me the output of
     sudo /opt/intel/bin/link_install.sh -s 

    I get the following message :
    sudo: /opt/intel/bin/link_install.sh: command not found

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    rukawaI get the following message :
    sudo: /opt/intel/bin/link_install.sh: command not found

    show me output of

     ls /opt/intel/bin 

    ------------------------------------------------------------------
    Sorry, I am trying my best to help you & eventually in next few minutes it will be solved. I haven't installed ICC right now, I installed ICC almost a year ago, so it's bit hard to solve query when my system don't have it installed.Still we will solve it.
    Patience is the key ๐Ÿ˜€

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek Rawalshow me output of
     ls /opt/intel/bin 
    ------------------------------------------------------------------
    Sorry, I am trying my best to help you & eventually in next few minutes it will be solved. I haven't installed ICC right now, I installed ICC almost a year ago, so it's bit hard to solve query when my system don't have it installed.Still we will solve it.
    Patience is the key ๐Ÿ˜€

    I thank you very much sir and appreciate your help ๐Ÿ˜€

    rukawa@ruka:/opt/intel$ ls /opt/intel/bin
    compilervars.csh idb inspxe-inject inspxe-wrap
    compilervars.sh idbc inspxe-runsc
    rukawa@ruka:/opt/intel$

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    Alright, now tell me in detail, which packages you have really installed ?
    Have you installed Intel C++ composer XE ?
    have you installed Intel Fortran composer ?
    you have to install both.

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalAlright, now tell me in detail, which packages you have really installed ?
    Have you installed Intel C++ composer XE ?
    have you installed Intel Fortran composer ?
    you have to install both.


    I installed the intel C++ composer XE, because I'm only having C programs, why do I have to install both?

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    rukawaI installed the intel C++ composer XE, because I'm only having C programs, why do I have to install both?

    Because back then I had ๐Ÿ˜›
    Anyways leave that.

    have you installed build-essentials ?
    apt-get install build-essential

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalBecause back then I had ๐Ÿ˜›
    Anyways leave that.

    have you installed build-essentials ?
    apt-get install build-essential

    ๐Ÿ˜€ , Yes I have, and I followed these steps to install the icc compiler :
    #-Link-Snipped-#

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    So you're using 12.04 LTS & Intel 13.0 ICC, I assume.
    You followed this, right ?

    November 2012: Ubuntu 12.xx and Intel 13.0.0.079 (Composer XE 2013 initial release) URGENT, Installation will fail without a manual change

    Ubu 12.0x changed the link for /bin/sh from /bin/bash to /bin/dash. Intel installation scripts for 13.0.0.079 reference /bin/sh BUT assume/require this is bourne or bash (sh or bash) but are NOT compatible with dash. To get around this problem, do the following before trying to install the Intel compiler:

    As root user:

    mv /bin/sh /bin/sh.orig
    ln -s /bin/bash /bin/sh

    Read the following information to continue to configure your system BEFORE you attempt an installation.
    Following installation you are free to revert back to linking /bin/sh to /bin/dash if you so desire.
  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalSo you're using 12.04 LTS & Intel 13.0 ICC, I assume.
    You followed this, right ?

    Yes I followed the these steps, except that I didn't extract the archive in /tmp, I exctracted it a directory that I created : Documents/icc

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    Okay we are now few steps away.
    Show me output of (one by one)

     ls /opt/intel 
     ls /opt/intel/Compiler 
  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalOkay we are now few steps away.
    Show me output of (one by one)
     ls /opt/intel 
     ls /opt/intel/Compiler 


    rukawa@ruka:/$ ls /opt/intel
    bin composer_xe_2013_sp1.0.080 ipp licenses tbb
    composerxe include ism man
    composer_xe_2013_sp1 intel_sdp_products.db lib mkl
    rukawa@ruka:/$

    I have no directory called Compiler, if you're meaning the name of the compiler I installed, then :

    rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080
    bin Documentation ipp pkg_bin uninstall
    compiler eclipse_support man Samples uninstall_GUI.sh
    debugger foldermap.sc.xml mkl tbb uninstall.sh
    rukawa@ruka:/$

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080
    bin Documentation ipp pkg_bin uninstall
    compiler eclipse_support man Samples uninstall_GUI.sh
    debugger foldermap.sc.xml mkl tbb uninstall.sh
    rukawa@ruka:/$

    There I see compiler!

    ls /opt/intel/composer_xe_2013_sp1.0.080/compiler 
  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalThere I see compiler!
    ls /opt/intel/composer_xe_2013_sp1.0.080/compiler 

    rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080/compiler
    include lib perf_headers
    rukawa@ruka:/$

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    rukawarukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080/compiler
    include lib perf_headers
    rukawa@ruka:/$

    It perfectly seems like path of compiler.
    Still you have to do bit of work on your own to assure that it's compiler only. Check each & every file under /opt/intel & locate compiler.

    (I am quite sure that the above directory is compiler, but do cross-check too)
    Once compiler is located, open .bashrc
    add these codes in the end

     if [ -d "path of compiler" ] ; then
              PATH="path of compiler:$PATH"
    fi 

    then run ~/.bashrc

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    @#-Link-Snipped-# locate /bin inside /opt/intel/composer_xe_2013_sp1.0.080/compiler
    There must be /bin somewhere. Most prolly under include or lib folder.

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek Rawal@#-Link-Snipped-# locate /bin inside /opt/intel/composer_xe_2013_sp1.0.080/compiler
    There must be /bin somewhere. Most prolly under include or lib folder.


    I looked for /bin but it's not inside compiler, in fact , the /opt/intel/composer_xe_2013_sp1.0.080 directory has a /bin and a /compiler, but there's not /bin inside /compiler, I checked all the directories inside /compiler.
    As for the code
    if [ -d "path of compiler" ] ; then
    PATH="path of compiler:$PATH"
    fi
    I deleted the export line that you showed me at the beginning, and I wrote the following at the end of the .bashrc file :
    if [ -d /opt/intel/composer_xe_2013_sp1.0.080/compiler ] ; then
    PATH="/opt/intel/composer_xe_2013_sp1.0.080/compiler/:$PATH"
    fi

    I saved the .bashrc file and executed the command :
    source ~/.bashrc

    then I tried to compile my .c file using :
    icc test1.c
    but I'm still getting the message :
    icc : command not found

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    Add

     if [ -d "/opt/intel/bin" ] ; then
    PATH="/opt/intel/bin:$PATH"
    fi

    run bashrc

    If you attach screenshot of every directory it will help me to visualise.

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    @#-Link-Snipped-#, I've just bumped into this article : #-Link-Snipped-#,
    it's about setting up the environment variables before starting with the C++ compiler, my problem is that I don't have the iccvars.sh file, I've looked for it everywhere in tha /opt/intel directory.

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    Try re-installing the compiler, but remember one thing.
    During setup when it asks :
    1) start installation now
    2) change directory (or something like that)
    3) Change components to install

    select the third one, because it will install all components. and none of libs will be missing.
    As intel wiki says, extract installer in /tmp; so it's better to do as it says. This might be the problem too.

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalTry re-installing the compiler, but remember one thing.
    During setup when it asks :
    1) start installation now
    2) change directory (or something like that)
    3) Change components to install

    select the third one, because it will install all components. and none of libs will be missing.
    As intel wiki says, extract installer in /tmp; so it's better to do as it says. This might be the problem too.

    Ok I'll do it. Thank you very very much for your help ๐Ÿ˜€

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 3, 2013

    rukawaOk I'll do it. Thank you very very much for your help ๐Ÿ˜€

    I am quite disappointed as I couldn't help you to compile, because it's very easy shit & I have done this few timesback then =/
    I am off now, I'll be coming online back tomorrow, If you have no problem then we can ping eachother using teamviewer , so I can solve the problem easily.
    Goodluck, I hope your problem gets solve asap.

  • rukawa

    @rukawa-Y0pUkC • Nov 3, 2013

    Abhishek RawalI am quite disappointed as I couldn't help you to compile, because it's very easy shit & I have done this few timesback then =/
    I am off now, I'll be coming online back tomorrow, If you have no problem then we can ping eachother using teamviewer , so I can solve the problem easily.
    Goodluck,I hope your problem gets solve asap.

    At last! it got solved...
    Here what I did:
    1- I uninstalled the compiler
    2- I followed this : #-Link-Snipped-# to installl it again
    The thing is, in my first trial I haven't done this :

    mv /bin/sh /bin/sh.orig
    ln -s /bin/bash /bin/sh
    

    and I haven't extracted the archive in /tmp,
    Now I did as the article said without changing anything

    3 - After the completion of the installation, I composed this command :

    source <install-dir>/bin/iccvars.sh <arg>
    

    and replaced <install-dir> by : /opt/intel/composer_2013_sp1.0.080 (because that's where I have the intel compiler installed) and <arg> by : intel64 (because I have an amd64)
    (I got the command from the following article : #-Link-Snipped-#)

    4- I read this thread : #-Link-Snipped-#
    and composed the following commands one after the other:

    source /opt/intel/bin/iccvars.sh intel64
    source /opt/intel/bin/compilervars.sh intel64
    source /opt/intel/composer_xe_2013_sp1.0.080/bin/iccvars.sh intel64
    source /opt/intel/composer_xe_2013_sp1.0.080/bin/compilervars.sh intel64
    

    Now when I type :

    icc --version

    I get this result :
    icc (ICC) 14.0.0 20130728
    Copyright (C) 1985-2013 Intel Corporation. All rights reserved.

    I took quite a while!

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 4, 2013

    @#-Link-Snipped-# You might love to read this compilers benchmarking article : #-Link-Snipped-#

  • rukawa

    @rukawa-Y0pUkC • Nov 5, 2013

    Abhishek Rawal@#-Link-Snipped-# You might love to read this compilers benchmarking article : #-Link-Snipped-#

    Thanks ! I'm currently working on an assignment in which I have to do benchmarking ๐Ÿ˜€

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 5, 2013

    rukawaThanks ! I'm currently working on an assignment in which I have to do benchmarking ๐Ÿ˜€

    I understood that (because why would anyone install icc when gcc is already been shipped in Linux ?)
    Are you using phoronix suite for benchmarking ?
    I am quite interested in GCC versus Clang. Do post the result here, I would love to have discussion on that ๐Ÿ˜€

  • rukawa

    @rukawa-Y0pUkC • Nov 6, 2013

    Abhishek RawalI understood that (because why would anyone install icc when gcc is already been shipped in Linux ?)
    Are you using phoronix suite for benchmarking ?
    I am quite interested in GCC versus Clang. Do post the result here, I would love to have discussion on that ๐Ÿ˜€

    Ok, I'll finish some work first because I'm in a bit of a hurry and I'll post the result

  • Abhishek Rawal

    @abhishek-fg9tRh • Nov 6, 2013

    @#-Link-Snipped-# No hurry,buddy. Good luck for your project ๐Ÿ˜€

  • rukawa

    @rukawa-Y0pUkC • Nov 7, 2013

    Abhishek Rawal@#-Link-Snipped-# No hurry,buddy. Good luck for your project ๐Ÿ˜€

    In my assignment, I had to compare the execution time of programs implemented :
    1- without OpenMP
    2 - using OpenMP
    I only used Icc because it was required. (I could have done the same thing using gcc)
    (To get sarted on openMP #-Link-Snipped-#)
    1 - the mandelbrot fracatal:
    (I you want to get an idea about what it is you can go to http <a href="https://en.wikipedia.org/wiki/Mandelbrot_set" target="_blank" rel="nofollow noopener noreferrer">Mandelbrot Set</a>)

    int mandelbrot (float a, float b, int max_iter)
    {
          int iter = 0;
          float x=0, y=0;
        while(( iter < max_iter ) && ( x*x + y*y <= 4.0) )
        {
            x = x*x - y*y + a;
            y = 2*x*y + b;
             iter++;
        }
       return iter;
    }
    


    Now, that's a simple program, but one has to be careful when adding the openmp pragma because a segmentation fault can easily araise (and that's what happened to me)

    int mandelbrot (float a, float b, int max_iter)
    {
          int iter = 0;
          float x=0, y=0;
          [B]omp_set_num_threads([number of threads]);  [/B]
          [B]#pragma omp parallel for private(iter,a,b) schedule([scheduling type], [chunksize ])[/B]  
         while(( iter < max_iter ) && ( x*x + y*y <= 4.0) )
          {
              x = x*x - y*y + a;
              y = 2*x*y + b;
              iter++;
          }
          return iter;
    }
    

    I compared the execution times when choosing static and dynamic scheduling (in both scheduling patterns I gave the threads the same number of iterations to process).
    The result is : the bigger the numbre of threads id, the faster the program is executed. I'm not sur whether it's correct or not, but it seems to me logical. I read somewhere that depending on the number of cores of the computer, there's an optimal combination of the number of threads, the scheduling policy and the chunk size.
    I have a dual core machine, and the optimal combination in my case was:
    number of threads = 8
    scheduling policy = dynamic
    chunk size = max_iter/number of threads
    so in more concrete words :
    for max_iter = 256 (to have 256 levels of gray), I wrote:

    [....]
    omp_set_num_threads(8); 
    #pragma omp parallel for private(iter,a,b) schedule(dynamic, 64)
    [....]
    

    I didn't try for more than 8 threads, but maybe I could have had a faster program if I had tried it.
    As for the best scheduling policy, in this case it's dynamic scheduling. Logical, because the amount of work that each iteration contains depends on the value of the exiting iteration.

    I have though some questions on which I've been ruminating, since I got these results:
    -Why would a lower number of threads give better results?
    -When I didn't use the private(iter,a,b) clause I kept getting a segmentation fault, bur why?

    2-Calculation of pi
    We have
    There are 2 formulas to implement
    Capture du 2013-11-05 22:25:19
    Capture du 2013-11-05 22:41:09

    The second one gave better results in terms of precision and time of execution, BUT:
    I couldn't implement the OpenMP at all! I kept getting the segmentation fault no matter how I tried!
    here's my program:

    double integrale(int64 n)
    {
      double pi = 0.0;
      int i; double x,sum; int id;
      double step = 1.0/(double)n;
    omp_set_num_threads(2);
      #pragma omp parallel private(x,sum)
      {
           id = omp_get_thread_num();
           for(i=id,sum=0.0;i<n;i=i+2)
          {
             x = ((double)i-0.5)*step;
             sum += 4.0/(1.0+x*x);
          }
      #pragma omp critical
        pi += sum*step;
      }
      retrun pi;
    }
    

    What could be that created the problem?