NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Error when building netcdf-fortran with static libraries

It fails with the same error when configuring using the instructions for
shared libraries. This thread seems to be relevant but I don't think it has
a concrete answer:
https://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11207.html

On Sun, May 24, 2020 at 4:49 PM Malcolm Maas <malcolmmaas@xxxxxxxxx> wrote:

> Hello,
>
> I'm building netcdf-fortran-4.5.2 on Windows 10, using MinGW. I've
> installed netCDF-4.7.4 as a binary and am using these instructions to build
> netcdf-fortran:
> https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html#building_fortran_with_static_libraries
>
> This is what I ran in an attempt to build it:
> CPPFLAGS="-IE:/Users/Malcolm/netCDF-4.7.4/include
> -IE:/Users/Malcolm/hdf5/include
> -IE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/include"
> LDFLAGS="-LE:/Users/Malcolm/netCDF-4.7.4/lib -LE:/Users/Malcolm/hdf5/lib
> -LE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/lib"
> LD_LIBRARY_PATH=E:/Users/Malcolm/netCDF-4.
> 7.4/lib:E:/Users/Malcolm/hdf5/lib:E:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/lib
> LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl" ./configure
> --prefix=E:/Users/Malcolm/netcdf-4.7.4/lib --disable-shared
>
> It did a bunch of checks, and at the end was:
> checking for library containing nc_open... no
> configure: error: Could not link to netcdf C library. Please set LDFLAGS.
>
> I'm not sure what I should do, because I set LDFLAGS in the command. Here
> is the full error from config.log:
> configure:22764: checking for library containing nc_open
> configure:22795: gcc -o conftest.exe -g -O2
> -IE:/Users/Malcolm/netCDF-4.7.4/include -IE:/Users/Malcolm/hdf5/include
> -IE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/include
> -LE:/Users/Malcolm/netCDF-4.7.4/lib -LE:/Users/Malcolm/hdf5/lib
> -LE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/lib conftest.c -lm -lnetcdf
> -lhdf5_hl -lhdf5 -lz -lcurl >&5
> C:\Users\Malcolm\AppData\Local\Temp\cckVY3CJ.o: In function `main':
> e:\Users\Malcolm\netcdf-fortran-4.5.2/conftest.c:52: undefined reference
> to `nc_open'
> collect2.exe: error: ld returned 1 exit status
> configure:22795: $? = 1
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "netCDF-Fortran"
> | #define PACKAGE_TARNAME "netcdf-fortran"
> | #define PACKAGE_VERSION "4.5.2"
> | #define PACKAGE_STRING "netCDF-Fortran 4.5.2"
> | #define PACKAGE_BUGREPORT "support-netcdf@xxxxxxxxxxxxxxxx"
> | #define PACKAGE_URL ""
> | #define PACKAGE "netcdf-fortran"
> | #define VERSION "4.5.2"
> | #define NF_RELAX_COORD_BOUND 1
> | #define ENABLE_CDF5 1
> | #define HAVE_F2008 1
> | #define HAVE_TS29113_SUPPORT 1
> | #define TEMP_LARGE "."
> | #define STDC_HEADERS 1
> | #define HAVE_SYS_TYPES_H 1
> | #define HAVE_SYS_STAT_H 1
> | #define HAVE_STDLIB_H 1
> | #define HAVE_STRING_H 1
> | #define HAVE_MEMORY_H 1
> | #define HAVE_STRINGS_H 1
> | #define HAVE_INTTYPES_H 1
> | #define HAVE_STDINT_H 1
> | #define HAVE_UNISTD_H 1
> | #define HAVE_DLFCN_H 1
> | #define LT_OBJDIR ".libs/"
> | #define NF_INT1_T byte
> | #define NF_INT2_T integer*2
> | #define NF_INT8_T integer*8
> | #define NF_INT1_IS_C_SIGNED_CHAR 1
> | #define NF_INT2_IS_C_SHORT 1
> | #define NF_INT8_IS_C_LONG_LONG 1
> | #define NF_INT_IS_C_INT 1
> | #define NF_REAL_IS_C_FLOAT 1
> | #define NF_DOUBLEPRECISION_IS_C_DOUBLE 1
> | #define NCBYTE_T byte
> | #define NCSHORT_T integer*2
> | #define HAVE_LIBM 1
> | #define HAVE_NETCDF_H 1
> | /* end confdefs.h.  */
> |
> | /* Override any GCC internal prototype to avoid an error.
> |    Use char because int might match the return type of a GCC
> |    builtin and then its argument prototype would still apply.  */
> | #ifdef __cplusplus
> | extern "C"
> | #endif
> | char nc_open ();
> | int
> | main ()
> | {
> | return nc_open ();
> |   ;
> |   return 0;
> | }
> configure:22795: gcc -o conftest.exe -g -O2
> -IE:/Users/Malcolm/netCDF-4.7.4/include -IE:/Users/Malcolm/hdf5/include
> -IE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/include
> -LE:/Users/Malcolm/netCDF-4.7.4/lib -LE:/Users/Malcolm/hdf5/lib
> -LE:/Users/Malcolm/zlib-curl/curl-7.70.0-win64/lib conftest.c -lnetcdf  -lm
> -lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl >&5
> C:\Users\Malcolm\AppData\Local\Temp\ccqgO2UL.o: In function `main':
> e:\Users\Malcolm\netcdf-fortran-4.5.2/conftest.c:52: undefined reference
> to `nc_open'
> collect2.exe: error: ld returned 1 exit status
> configure:22795: $? = 1
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "netCDF-Fortran"
> | #define PACKAGE_TARNAME "netcdf-fortran"
> | #define PACKAGE_VERSION "4.5.2"
> | #define PACKAGE_STRING "netCDF-Fortran 4.5.2"
> | #define PACKAGE_BUGREPORT "support-netcdf@xxxxxxxxxxxxxxxx"
> | #define PACKAGE_URL ""
> | #define PACKAGE "netcdf-fortran"
> | #define VERSION "4.5.2"
> | #define NF_RELAX_COORD_BOUND 1
> | #define ENABLE_CDF5 1
> | #define HAVE_F2008 1
> | #define HAVE_TS29113_SUPPORT 1
> | #define TEMP_LARGE "."
> | #define STDC_HEADERS 1
> | #define HAVE_SYS_TYPES_H 1
> | #define HAVE_SYS_STAT_H 1
> | #define HAVE_STDLIB_H 1
> | #define HAVE_STRING_H 1
> | #define HAVE_MEMORY_H 1
> | #define HAVE_STRINGS_H 1
> | #define HAVE_INTTYPES_H 1
> | #define HAVE_STDINT_H 1
> | #define HAVE_UNISTD_H 1
> | #define HAVE_DLFCN_H 1
> | #define LT_OBJDIR ".libs/"
> | #define NF_INT1_T byte
> | #define NF_INT2_T integer*2
> | #define NF_INT8_T integer*8
> | #define NF_INT1_IS_C_SIGNED_CHAR 1
> | #define NF_INT2_IS_C_SHORT 1
> | #define NF_INT8_IS_C_LONG_LONG 1
> | #define NF_INT_IS_C_INT 1
> | #define NF_REAL_IS_C_FLOAT 1
> | #define NF_DOUBLEPRECISION_IS_C_DOUBLE 1
> | #define NCBYTE_T byte
> | #define NCSHORT_T integer*2
> | #define HAVE_LIBM 1
> | #define HAVE_NETCDF_H 1
> | /* end confdefs.h.  */
> |
> | /* Override any GCC internal prototype to avoid an error.
> |    Use char because int might match the return type of a GCC
> |    builtin and then its argument prototype would still apply.  */
> | #ifdef __cplusplus
> | extern "C"
> | #endif
> | char nc_open ();
> | int
> | main ()
> | {
> | return nc_open ();
> |   ;
> |   return 0;
> | }
> configure:22812: result: no
> configure:22819: error: Could not link to netcdf C library. Please set
> LDFLAGS.
>
> This is my first time compiling something, and I've mostly been learning
> as I go. There's a good chance I'm missing something basic here.
>
> --
> *Malcolm*
>


-- 
*Malcolm*
  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: