Unidata / netcdf-fortran

Official GitHub repository for netCDF-Fortran libraries, which depend on the netCDF C library. Install the netCDF C library first.
Other
222 stars 96 forks source link

Intel LLVM does not like -lgfortran linker #439

Open HathewayWill opened 1 month ago

HathewayWill commented 1 month ago

To report a non-security related issue, please provide:

relevant files added

@edhartnett @edwardhartnett

autoreconf.log config.log configure.log

HathewayWill commented 1 month ago

I would think that the gnu compilers wouldn't cause a problem because the -lgcc linker can be in the CFLAGS command and it doesn't cause it to break. Only the -lgfortran.

Some relevant code that I am using:

    cd "${WRF_FOLDER}"/Downloads
    tar -xzvf v$Netcdf_C_Version.tar.gz
    cd netcdf-c-$Netcdf_C_Version/

    # these variables need to be set for the NetCDF-C install to work
    export CPPFLAGS=-I$DIR/grib2/include
    export LDFLAGS=-L$DIR/grib2/lib
    export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgcc -lm -ldl -lpnetcdf"
    autoreconf -i -f 2>&1 | tee autoreconf.log

    CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static --enable-pnetcdf --enable-cdf5 --enable-parallel-tests 2>&1 | tee configure.log
    automake -a -f 2>&1 | tee automake.log
    make -j $CPU_HALF_EVEN 2>&1 | tee make.log
    make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log

    # other libraries below need these variables to be set
    export PATH=$DIR/NETCDF/bin:$PATH
    export NETCDF=$DIR/NETCDF

    echo " "
    ############################## NetCDF-Fortran library ############################

    cd "${WRF_FOLDER}"/Downloads
    tar -xvzf v$Netcdf_Fortran_Version.tar.gz
    cd netcdf-fortran-$Netcdf_Fortran_Version/

    # these variables need to be set for the NetCDF-Fortran install to work
    export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
    export CPPFLAGS="-I$DIR/NETCDF/include -I$DIR/grib2/include"
    export LDFLAGS="-L$DIR/NETCDF/lib -L$DIR/grib2/lib"
    export LIBS="-lnetcdf -lpnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm -ldl -lgcc "
    autoreconf -i -f 2>&1 | tee autoreconf.log
    CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-parallel-tests --enable-hdf5 2>&1 | tee configure.log
    automake -a -f 2>&1 | tee automake.log
    make -j $CPU_HALF_EVEN 2>&1 | tee make.log
    make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log

    echo " "
    #################################### System Environment Tests ##############

Log files with sucessful compiliation.

autoreconf.log config.log configure.log make.install.log make.log

HathewayWill commented 1 month ago

@WardF

Here's my issue that I opened with all the log files.

HathewayWill commented 1 month ago

@edhartnett @WardF

not sure why the linker for gfortran doesn't work. Seems to affect all versions of netcdf including cxx. Maybe it's an intel llvm problem?

WardF commented 1 week ago

Thanks for your patience; the netCDF-C release has been demanding a lot of my time. Let me review this.

HathewayWill commented 1 week ago

that's okay take your time, just trying to help @WardF