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.
29280 Discussions

ifort not finding .so file located in another directory despite (LD_)LIBRARY_PATH

mirko_vukovic
Beginner
828 Views
I am trying my hand at building and using library files (.so extension), using ifort 10.1.011 on 64-bit RH Enterprise Linux 5.

I have defined both LD_LIBRARY_PATH and LIBRARY_PATH to point to the directory where the library resides, but the linker still does not find it. Here is a copy of the linker command & output, and of two ls commands. As you can see, if I do an ls using the values of the environment variables, the file is there:

(output from make:)
ifort -o profile_test profile_test.o libprofiles.so libtecplot_utils.so
ld: libtecplot_utils.so: No such file: No such file or directory
make: *** [profile_test] Error 1
> ls `echo $LD_LIBRARY_PATH | cut -d: -f1`
libtecplot_utils.so
> ls $LIBRARY_PATH
libtecplot_utils.so



Is there some other environment variable that I need to set? Or am I missing something that ld is trying to tell me.

I am also confused about the roles of LD_LIBRARY_PATH and LIBRARY_PATH. Are they both for the same purpose?

Thank you,

Mirko
0 Kudos
2 Replies
TimP
Honored Contributor III
828 Views
At link time, you must employ the usual unix/linux syntax to specify the path and library name e.g.
ifort -L ..... *.o -ltecplot_utils

or specify the full path name of the .so, when it is not on a -L path.
LD_LIBRARY_PATH doesn't have effect at link time; you will need it at run time.
0 Kudos
mirko_vukovic
Beginner
828 Views
Of course!

what confused me was that during my initial testing, I had the library in the same directory with the other code. So, I was able to link to it by just refering explicitly to it (without the -l option).

Off course, that broke down, once I placed it in the library directory.

Thank you very much

Mirko
0 Kudos
Reply