1

I'm compiling a cpp code with icc (under ubuntu):

icc -I/usr/share/R/include -I/~/Desktop/work/p1/geqw4/vi3/out/sp/ccode/eigen -fpic -O2 -pipe -c -DEIGEN_NO_DEBUG aha.cpp -o aha.o

icc -shared -o aha.so aha.o -L/usr/local/lib/R/site -Wl,-rpath,/usr/local/lib/R/site -L/usr/lib64/R/lib -lR

it compiles, but upon running the executable i get:

unable to load shared object '~/Desktop/work/p1/geqw4/vi3/out/sp/ccode/simcode/mine2/aha.so':
  libimf.so: cannot open shared object file: No such file or directory

libimf.so is in /opt/intel/lib/intel64. I remember running unto the same problem the last time i used icc (a year ago) but i don't recall what the solution was.

user189035
  • 5,589
  • 13
  • 52
  • 112

4 Answers4

4

You need to update the library path so the linker will look in /opt/intel/bin. (Are you sure it's bin and not lib?) You can add it to your LD_LIBRARY_PATH environment variable or add it to /etc/ld.so.conf if you want it to be system wide.

vipw
  • 7,593
  • 4
  • 25
  • 48
  • Thanks; yes, i copy pasted the wrong dir (fixed now). I did "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/lib/intel64" to no avail. is there anything else i forgot? – user189035 Jul 09 '12 at 11:02
4

Ok solved;

for future record (i use icc once a year, if that much):

do

gedit ~/.bashrc

then

LD_LIBRARY_PATH=/opt/intel/lib/intel64
export LD_LIBRARY_PATH

then, from the ~/ directory do:

source .bashrc
user189035
  • 5,589
  • 13
  • 52
  • 112
1

Intel compilers come with various shell scripts which set up the environment. Generally, all you have to do is source one script:

 source ${INTEL_COMPILER_DIR}/bin/compilervers.csh

and it should also set up for other products you may have (MKL, TBB, etc).

phzx_munki
  • 1,058
  • 11
  • 16
1

A lot of the shared libraries that icpc or icc links are not actually needed. After you build, you should run ldd -u -r on the final build file (executable or shared library) to show all the unused library dependencies. If you see that libimf is not used, then you can compile your executable or shared library with this option:

-Wl,--as-needed

Then rerun ldd -u -r and see if the dependency goes away.

Mark Lakata
  • 19,989
  • 5
  • 106
  • 123