Menu

Can't build NCO checking for nc_open in -lnetcdf... no

Help
2015-09-24
2015-10-09
  • Steve Dainard

    Steve Dainard - 2015-09-24

    Hello bonobo

    I'm attempting to compile NCO with netcdf in a non-standard location but I'm getting an error that netcdf can't be found:

    CPPFLAGS="-I/modules/netcdf/4.1.3/include/" LDFLAGS="-L/modules/netcdf/4.1.3/lib/" ./configure --prefix=/modules/nco/4.5.2

    Test for netCDF

    checking for /opt/local/include/netcdf.h... no
    checking for /opt/local/lib/libnetcdf.a... no
    checking netcdf.h usability... yes
    checking netcdf.h presence... yes
    checking for netcdf.h... yes
    checking for nc_open in -lnetcdf... no
    configure: error: in /modules/source/nco-4.5.2': configure: error: cannot find netCDF library Seeconfig.log' for more details

    I tried a few different purmutations from these threads as well:
    https://sourceforge.net/p/nco/discussion/9830/thread/548e1df9/
    https://github.com/nco/nco/issues/6

    nm -a /modules/netcdf/4.1.3/lib/libnetcdf.a | grep nc_open
    U nc_open
    0000000000000510 T nc_open
    0000000000000010 T nc_open_par
    0000000000000020 T nc_open_par_fortran

    Wondering if when I compiled NetCDF I missed a dependancy that nco needs.

    Thanks

     
  • Charlie Zender

    Charlie Zender - 2015-09-24

    Hi Steve,
    I'm unsure why the LDFLAGS does not work.
    But I usually manipulate the NETCDF_INC and NETCDF_LIB environment variables instead, e.g.,
    NETCDF_INC='/modules/netcdf/4.1.3/include' NETCDF_LIB='/modules/netcdf/4.1.3/lib' configure --prefix=blahblahblah...
    Try that.
    cz

     
  • Steve Dainard

    Steve Dainard - 2015-09-30

    Hi Charlie,

    Same error:

    NETCDF_INC='/modules/netcdf/4.1.3/include' NETCDF_LIB='/modules/netcdf/4.1.3/lib' ./configure --prefix=/modules/nco/4.5.2
    
    #################################
    #  Test for netCDF             #
    ################################
    checking for /opt/local/include/netcdf.h... no
    checking for /opt/local/lib/libnetcdf.a... no
    checking netcdf.h usability... yes
    checking netcdf.h presence... yes
    checking for netcdf.h... yes
    checking for nc_open in -lnetcdf... no
    configure: error: in `/modules/source/nco-4.5.2':
    configure: error: cannot find netCDF library
    See `config.log' for more details
    

    I've also tried configuring version 4.4.4 and 4.4.9 with the same result.

     
  • Charlie Zender

    Charlie Zender - 2015-10-01

    are you sure libnetcdf.a is in /modules/netcdf/4.1.3/lib?

     
  • Steve Dainard

    Steve Dainard - 2015-10-01

    Yep:

    ll /modules/netcdf/4.1.3/lib/
    total 20780
    -rw-r--r--. 1 root root 5687330 Sep 23 14:56 libnetcdf.a
    -rw-r--r--. 1 root root 5355130 Sep 23 14:56 libnetcdf_c++4.a
    -rwxr-xr-x. 1 root root 1324 Sep 23 14:56 libnetcdf_c++4.la
    lrwxrwxrwx. 1 root root 23 Sep 23 14:56 libnetcdf_c++4.so -> libnetcdf_c++4.so.1.0.1
    lrwxrwxrwx. 1 root root 23 Sep 23 14:56 libnetcdf_c++4.so.1 -> libnetcdf_c++4.so.1.0.1
    -rwxr-xr-x. 1 root root 2231802 Sep 23 14:56 libnetcdf_c++4.so.1.0.1
    -rw-r--r--. 1 root root 1160188 Sep 23 14:56 libnetcdf_c++.a
    -rwxr-xr-x. 1 root root 1317 Sep 23 14:56 libnetcdf_c++.la
    lrwxrwxrwx. 1 root root 22 Sep 23 14:56 libnetcdf_c++.so -> libnetcdf_c++.so.4.1.0
    lrwxrwxrwx. 1 root root 22 Sep 23 14:56 libnetcdf_c++.so.4 -> libnetcdf_c++.so.4.1.0
    -rwxr-xr-x. 1 root root 500011 Sep 23 14:56 libnetcdf_c++.so.4.1.0
    -rw-r--r--. 1 root root 1582730 Sep 23 14:56 libnetcdff.a
    -rwxr-xr-x. 1 root root 1296 Sep 23 14:56 libnetcdff.la
    lrwxrwxrwx. 1 root root 19 Sep 23 14:56 libnetcdff.so -> libnetcdff.so.5.1.0
    lrwxrwxrwx. 1 root root 19 Sep 23 14:56 libnetcdff.so.5 -> libnetcdff.so.5.1.0
    -rwxr-xr-x. 1 root root 1179364 Sep 23 14:56 libnetcdff.so.5.1.0
    -rwxr-xr-x. 1 root root 1254 Sep 23 14:56 libnetcdf.la
    lrwxrwxrwx. 1 root root 18 Sep 23 14:56 libnetcdf.so -> libnetcdf.so.7.1.1
    lrwxrwxrwx. 1 root root 18 Sep 23 14:56 libnetcdf.so.7 -> libnetcdf.so.7.1.1
    -rwxr-xr-x. 1 root root 3549982 Sep 23 14:56 libnetcdf.so.7.1.1

     
  • Charlie Zender

    Charlie Zender - 2015-10-09

    hi steve, havn't forgotten this. i don't understand what causes this behavior. the next step to take is to read the log that configure generates, config.log, search for the part where it tests libnetcdf for the presence of nc_open(), and try to glean what really causes the failure. you might also run
    nm -a libnetcdf.a | grep nc_open
    to be sure that function is in the library.
    cz

     

Log in to post a comment.