Intel c/c++ compiler: “could not locate executable

2019-07-18 05:36发布

问题:

I recently installed a Intel's c/c++ compiler for linux: "Intel® C++ Composer XE for Linux".

When i was doing the installation, only marked the options(or packages) relates to the compiler and debugger, and said to the instaler that i will compile 64bit aplications.

Now when i try to compile a program i get:

meniwis@meniwis-Satellite-L845:~/syscave/src/c-ext/code$ ./build.sh

Could not locate executable icc
Could not locate executable ecc
INFO:root:using /opt/alges/ as sqlite3 directory
INFO:root:using /opt/alges/ as HDF5 directory
running build_ext
running build_src
build_src
building extension "cvoronoi" sources
building extension "cflowsim" sources
build_src: building npy-pkg config files
customize IntelCCompiler
customize IntelCCompiler using build_ext
customize IntelCCompiler
customize IntelCCompiler using build_ext
building 'cvoronoi' extension
compiling C++ sources
C compiler: icc -fPIC

compile options: '-g -I/home/meniwis/syscave/src/c-ext/code/../include - 
I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c'
icc: /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp
sh: 1: icc: not found
sh: 1: icc: not found
error: Command "icc -fPIC -g -I/home/meniwis/syscave/src/c-ext/code/../include -  
I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c   
/home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp -o build/temp.linux-x86_64- 
2.7/home/meniwis/syscave/src/c-ext/code/cvoronoi.o" failed with exit status 127

Making a "step-by-step" of what i am doing:

In comand line i type:

meniwis@meniwis-Satellite-L845:~/syscave/src/c-ext/code$ ./build.sh

The "build.sh" file is the next:

export HDF5_DIR=/opt/alges/
export SQLITE3_DIR=/opt/alges/
export SYSCAVE_ROOT=/home/meniwis/syscave/

python setup.py build_ext --inplace

A part of the "setup.py" file:

.
.
.
voronoi_src_dir=abspath(pjoin(syscave_root,'src/c-ext/code'))
cflowsim_src_dir=abspath(pjoin(syscave_root,'src/c-ext/code/flowsim/code/Flowsim'))

extensions = [
    Extension('cvoronoi',
        sources=[
                pjoin(voronoi_src_dir,'cvoronoi.cpp'),
                pjoin(voronoi_src_dir,'VoronoiDiagramGenerator.cpp')
            ],
        language = "c++",
        include_dirs=[pjoin(voronoi_src_dir,'../include')],
        extra_objects=lib_args['extra_compile_args']
    ),
    Extension('cflowsim',
        sources=[
                pjoin(cflowsim_src_dir,'cflowsim.cpp'),
                pjoin(cflowsim_src_dir,'parsers.cpp'),
                pjoin(cflowsim_src_dir,'Cell.cpp'),
                pjoin(cflowsim_src_dir,'ChunkDriver.cpp'),
                pjoin(cflowsim_src_dir,'DataLoader.cpp'),
                pjoin(cflowsim_src_dir,'DisplayResult.cpp'),
                pjoin(cflowsim_src_dir,'Drawbell.cpp'),
                pjoin(cflowsim_src_dir,'DrawbellType.cpp'),
                pjoin(cflowsim_src_dir,'Drawpoint.cpp'),
                pjoin(cflowsim_src_dir,'ExtractionResult.cpp'),
                pjoin(cflowsim_src_dir,'Model.cpp'),
                pjoin(cflowsim_src_dir,'Simulator.cpp'),
                pjoin(cflowsim_src_dir,'Tracer.cpp'),
        ],
        language = "c++",
        extra_objects=lib_args['extra_compile_args'],
        **lib_args
    )
]


#move to packages
#all default to ext_dir
ext_run_dir=abspath(pjoin(syscave_root,'src/python/syscave/extensions/'))
moves=[]
for ext in extensions:
    if ext.name not in moves:
        moves.append((ext.name,ext_run_dir))

moves.append(None)

ext_src_dir=pjoin(syscave_root,'src','c-ext','code') #='.'
file_ext=''
if os.name=='posix':
    file_ext='so'
    build_path=abspath(ext_src_dir)
elif os.name=='nt':
    file_ext='pyd'
    build_path=abspath(ext_src_dir)
else:
    raise EnvironmentError('Unsupported platform: {0}'.format(os.name))

for i,m in enumerate(moves):
    if m is None:
        continue
    name,new_path=m
    file_name=".".join([name,file_ext])
    file_path_from=os.path.join(build_path,file_name)
    file_path_to  =os.path.join(new_path,file_name)
    moves[i]=(file_path_from,file_path_to)
.
.
.

So the error is that icc and ecc cant be found? or is something else?, and if this is, how i solve it? Any directions?.

Thanks in advance. Grettings.

---------------------EDIT----------------------------------


After the help of @Vahid abdi, i do the next:

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

Now i get:

meniwis@meniwis-Satellite-L845:~/syscave/src/c-ext/code$ ./build.sh 
Found executable /opt/intel/bin/icc
Could not locate executable ecc
INFO:root:using /opt/alges/ as sqlite3 directory
INFO:root:using /opt/alges/ as HDF5 directory
running build_ext
running build_src
build_src
building extension "cvoronoi" sources
building extension "cflowsim" sources
build_src: building npy-pkg config files
customize IntelCCompiler
customize IntelCCompiler using build_ext
customize IntelCCompiler
customize IntelCCompiler using build_ext
building 'cvoronoi' extension
compiling C++ sources
C compiler: icc -fPIC

compile options: '-g -I/home/meniwis/syscave/src/c-ext/code/../include - 
I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c'
icc: /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp
In file included from /usr/include/c++/4.8/bits/stl_tree.h(61),
                 from /usr/include/c++/4.8/map(60),
                 from /home/meniwis/syscave/src/c- 
ext/code/../include/VoronoiDiagramGenerator.h(36),
                 from /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp(9):
/usr/include/c++/4.8/bits/stl_algobase.h(59): catastrophic error: cannot open source  
file "bits/c++config.h"
  #include <bits/c++config.h>
                         ^

compilation aborted for /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp (code 4)
In file included from /usr/include/c++/4.8/bits/stl_tree.h(61),
                 from /usr/include/c++/4.8/map(60),
                 from /home/meniwis/syscave/src/c-  
ext/code/../include/VoronoiDiagramGenerator.h(36),
                 from /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp(9):
/usr/include/c++/4.8/bits/stl_algobase.h(59): catastrophic error: cannot open source    
file "bits/c++config.h"
  #include <bits/c++config.h>
                             ^

compilation aborted for /home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp (code 4)
error: Command "icc -fPIC -g -I/home/meniwis/syscave/src/c-ext/code/../include -  
I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c    
/home/meniwis/syscave/src/c-ext/code/cvoronoi.cpp -o build/temp.linux-x86_64-  
2.7/home/meniwis/syscave/src/c-ext/code/cvoronoi.o" failed with exit status 4

Please help. Thanks in advance.

回答1:

Now the problem is icc can't open bits/c++config.h

if you have bits/c++config.h first try to find it's path (which is probably is: /usr/include/x86_64-linux-gnu/c++/4.7) and add it to icc like below

export __INTEL_POST_CFLAGS="-I/usr/include/x86_64-linux-gnu/c++/4.7"


回答2:

how did you install icc?

icc is not in your $PATH variable

first lookup for the icc path updatedb && locate icc

then add it's basename to your $PATH variable like this:

export PATH=$PATH:/path/to/youricc/basename