Compiling finished but won't run (solved)

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
lteeter
Posts: 11
Joined: Mon Jun 18, 2012 1:03 am
Location: University of Victoria

Compiling finished but won't run (solved)

#1 Unread post by lteeter »

I ran

./build.sh

which gave me the executable file oceanG, but when I tried to run it I got the following error message:

./oceanG: error while loading shared libraries: libnetcdf.so.7: cannot open shared object file: No such file or directory

does anyone have any ideas how to go about fixing this?
Last edited by lteeter on Tue Aug 07, 2012 9:13 pm, edited 1 time in total.

lteeter
Posts: 11
Joined: Mon Jun 18, 2012 1:03 am
Location: University of Victoria

Re: Compiling finished but won't run

#2 Unread post by lteeter »

Managed to figure this out; for anyone having similar problems it looks like my libnetcdf.so.7 file was installed in /usr/local/lib which apparently isn't searched, so I had to add it to the library path:

export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH"

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Compiling finished but won't run (solved)

#3 Unread post by arango »

Notice that in the build script you have control of the location of the compilers and libraries. We usually install the NetCDF library with the following possibilities:

Code: Select all

/opt/XXXsoft/
            /mpich/
                  /netcdf3@
                  /netcdf4@
            /mpich2/
                   /netcdf3@
                   /netcdf4@
            /openmpi/
                    /netcdf3@
                    /netcdf4@
            /serial/
                   /netcdf3@
                   /netcdf4@
where XXX is the compiler (gfortran, ifort, pgi, etc). You can make a directory link to the NetCDF version so you can have many of them and use the one in the assigned link. As you can see, there are many possibilities and combinations. It is not wise to put everything in /usr/local/lib :!:

I have mentioned several times in this forum to use the ROMS build script. This type of problem is frequently reported in this forum. Users need to be aware of it and pay attention to all the compilation messages...

Post Reply