Question

On a Linux system, I am trying to run a Fortran program that makes use of some shared libraries (netCDF libs, if that makes a difference). Before I run, I set LD_LIBRARY_PATH so that it points to the location of my libraries. Then I run the executable and I quickly get the error

../my_program: error while loading shared libraries: libnetcdff.so.5: cannot open shared object file: No such file or directory

Now, I double check the value of LD_LIBRARY_PATH, and then cd to it and find plain as day

$ ls *ff*

$ libnetcdff.a libnetcdff.la libnetcdff.so libnetcdff.so.0 libnetcdff.so.0.0.0

So the libnetcdff is absolutely present.

Could anyone point me to the problem?

The one thing that has occurred to me is that the executable seems to want to find libnetcdff.so.5, while the library that is present is actually libnetcdff.so.0. Is that the problem? If so, is there a way to convince the executable to not insist on "5"? Alternatively, would a link from libnetcdff.so.0 to libnetcdff.so.5 solve the problem? (I don't have permissions in the directory, BTW, which is why I haven't tried that yet.)

Environment info: CentOS machine, code compiled with gfortran. And yes, when I compiled, my -L flags were pointing to the same directory that LD_LIBRARY_PATH points to.

Thanks.

Was it helpful?

Solution

A library link should work. Since you mention that you do not have root/sudo access, what you can do is link in a file you do have access in:

ln -s /path/to/libnetcdff.so.0 /path/you/have/access/to/libnetcdff.so.5

And then add in the /path/you/have/access/to/ in your LD_LIBRARY_PATH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top