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

error while loading shared libraries: libimf.so:

Anonymous21
Beginner
18,532 Views
Hi.
I cannot complie my program using the makefile. However, if I type the complie command, it can complie. I donot know why this situation happens.

sms is executable file after linked. This messege is below after I run.

[root@tmp code]# ./sms
./sms: error while loading shared libraries: libimf.so: cannot open shared object file: No such file or directory ----> What do I do?



This is manual but I do not know what I do. I think this is some clue for using the makefile.

--> To use a makefile to complie your input files, make sure that /usr/bin and /usr/local/bin are in your path.
If you use the C shell, you can edit your .cshrc file and add the following:
setenv PATH /usr/bin:/usr/local/bin:yourpath

Thanks
0 Kudos
4 Replies
TimP
Honored Contributor III
18,532 Views
In order to use Intel compilers with a normal Makefile, you must set the compiler environment variables before running make. It looks like you don't have the LD_LIBRARY_PATH environment variable set to include the correct compiler library, as you would do by e.g. under tcsh
source /opt/intel/fc/9.1.032/bin/ifortvars.csh
That script includes a command
setenv LD_LIBRARY_PATH .....
Some people would source ifortvars from their .profile or equivalent startup file, pursuant to the recommendation you quoted.
By the way, completely replacing the PATH handed to you when you log in is generally not a good idea.
0 Kudos
Anonymous21
Beginner
18,532 Views
Thanks.

But I do not know what I do.

Your answer is below.
LD_LIBRARY_PATH environment variable set to include the correct compiler library, as you would do by e.g. under tcsh ---> what is tcsh? I can open the .tcsh
source /opt/intel/fc/9.1.032/bin/ifortvars.csh
That script includes a command
setenv LD_LIBRARY_PATH .....

However, could you let me know in which file I make a command?

In my case, I set up this command at /root/.bash_profile

source /opt/intel/fc/9.0/fce/bin/ifortvars.sh
setenv LD_LIBRARY_PATH /usr/bin:/usr/local/bin://opt/intel/fc/9.0/fce/bin/ifortvars.sh

Is this setup is correct or not? But it still giving me that error.

If I also set up this command at /root/.bashrc, there is not any error. However, when I run my program, error occurs while loading shared libraries: libimf.so:

loadfort(){
/opt/intel/fce/9.0/bin/ifortvars.sh
export LD_LIBRARY_PATH=/opt/intel/fce/9.0/lib

}
alias ifort='/opt/intel/fce/9.0/bin/ifort'


Could you let me know what is need to correct my setup and in which directory
..? I want to make this setup file run as soon as I log in and I also use makefile to complie my codes? My OS is RHEL4.0.

Thanks
0 Kudos
TimP
Honored Contributor III
18,532 Views
OK, since you were talking about csh/tcsh commands, I thought you might be using tcsh. So you could stick with bash.
When you source ifortvars.sh, the ifort /lib directory is added to LD_LIBRARY_PATH. You don't want any of the /bin items you quote to appear in that environment variable. When you have sourced ifortvars.sh, you shouldn't require any alias for ifort; it should be found on PATH.
If you like, you can add the command to source ifortvars.sh in your .bashrc, That could be fairly convenient, particularly if you don't switch versions often (e.g. between 32- and 64-bit).
Remember that any files you create with the 32-bit ifort (when you source fc/9.0/bin/ifortvars.sh) will work only when you have that environment set. Likewise for the 64-bit ifort fce/9.0/bin/ifortvars.sh.
The run-time complaint about .so files could come about from trying to run a 32-bit application when only the 64-bit environment is set, or vice versa.
0 Kudos
ti_ma
Beginner
18,532 Views
I have a question about how to set a setenv LD_LIBRARY_PATH . in a make file.... Please help me.... Where and how should I set this setenv LD_LIBRARY_PATH . in a makefile? Target: dependencies ab @ setenv_LD_LIBRARY_PATH . I get an error when I do this...so can someone please help me...Thanks!
0 Kudos
Reply