[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #YMY-503506]: [NetcdfLibs]/usr/bin/ld: cannot find -lU77
- Subject: [netCDF #YMY-503506]: [NetcdfLibs]/usr/bin/ld: cannot find -lU77
- Date: Mon, 17 Feb 2020 13:59:57 -0700
Hello,
It appears that the problem is when trying to compile a file,
'monteCarloDriver.f95', which has a dependency on libnetcdf and libU77. I'm
unfamiliar with libU77, but using Google shows me that it is the Unix Fortran
system library.
When you remove it and the compilation continues, it appears that linker is
failing to find the symbols from the netCDF Fortran interface. Looking at
NetcdfLibs, it appears that you are linking against the netCDF-C library
(libnetcdf), but not the Fortran interface (libnetcdff). Try adding
`-lnetcdff` to the script variable NetcdfLibs, and let me know if that fixes
the issue.
Thanks!
-Ward
> Hi,
>
> I am writing this letter for some support about Netcdf libraries. Recently, I
> am trying to build a code, called I3RC, which requires the netcdf library.
>
> The netcdf options are set as:
>
> NetcdfHome = /home/atlas/Library/netCDF-Fortran
> Netcdf_IncludeDir = $(NetcdfHome)/include
> NetcdfLibs = -L$(NetcdfHome)/lib -lnetcdf -lU77
>
>
> But when I make the .f90 files, it tells me that
>
> Building in Example-Drivers directory
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators -c
> monteCarloDriver.f95
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators -o
> monteCarloDriver monteCarloDriver.o
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/characterUtils.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/numericUtilities.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/ErrorMessages.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/userInterface_Unix.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/multipleProcesses_nompi.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/scatteringPhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/inversePhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/opticalPropertie
s.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/RandomNumbersForMC.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/monteCarloIllumination.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/surfaceProperties.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators/monteCarloRadiativeTransfer.o
-L/home/atlas/Library/netCDF-Fortran/lib -lnetcdf -lU77
> /usr/bin/ld: cannot find -lU77
> collect2: error: ld returned 1 exit status
>
>
> And when I delete the '-IU77' from the NetcdfLibs (NetcdfLibs =
> -L$(NetcdfHome)/lib -lnetcdf), it gives:
> Building in Example-Drivers directory
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators -c
> monteCarloDriver.f95
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators -o
> monteCarloDriver monteCarloDriver.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/characterUtils.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/numericUtilities.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/ErrorMessages.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/userInterface_Unix.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/multipleProcesses_nompi.o
>
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/scatteringPhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/inversePhaseFunctions.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/opticalProperties.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/RandomNumbersForMC.o
> /home/atlas/00-AC/I3R
C_Go/I3RC-Monte-Carlo-Model/Code/monteCarloIllumination.o
/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/surfaceProperties.o
/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators/monteCarloRadiativeTransfer.o
-L/home/atlas/Library/netCDF-Fortran/lib -lnetcdf
> monteCarloDriver.o: In function `writeresults_netcdf.3541.constprop.1':
> monteCarloDriver.f95:(.text+0x4cb): undefined reference to
> `__netcdf_MOD_nf90_create'
> monteCarloDriver.f95:(.text+0x4fe): undefined reference to
> `__netcdf_MOD_nf90_put_att_text'
> monteCarloDriver.f95:(.text+0x1bca): undefined reference to
> `__netcdf_MOD_nf90_inq_varid'
> monteCarloDriver.f95:(.text+0x1c96): undefined reference to
> `__netcdf_MOD_nf90_put_var_1d_fourbytereal'
> monteCarloDriver.f95:(.text+0x22c8): undefined reference to
> `__netcdf_MOD_nf90_put_var_3d_fourbytereal'
> monteCarloDriver.f95:(.text+0x1cd5): undefined reference to
> `__netcdf_MOD_nf90_def_dim'
>
>
> I think I have correctly installed netcdf, and nc-config -- all gives:
> This netCDF 4.6.0 has been built with the following features:
> --cc -> /usr/bin/cc
> --cflags -> -I/usr/include -I/usr/include/hdf5/serial
> --libs -> -L/usr/lib/x86_64-linux-gnu
> -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -lhdf5_hl -lhdf5 -lpthread
> -lsz -lz -ldl -lm -lcurl
>
> --has-c++ -> no
> --cxx ->
>
> --has-c++4 -> no
> --cxx4 ->
>
> --has-fortran-> yes
> --fc -> gfortran
> --fflags -> -I/usr/include
> --flibs -> -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro
> -Wl,-z,now -lnetcdf -lnetcdf
> --has-f90 -> no
> --has-f03 -> yes
>
> --has-dap -> yes
> --has-dap2 -> yes
> --has-dap4 -> yes
> --has-nc2 -> yes
> --has-nc4 -> yes
> --has-hdf5 -> yes
> --has-hdf4 -> no
> --has-logging-> no
> --has-pnetcdf-> no
> --has-szlib -> no
> --has-cdf5 -> no
> --has-parallel-> no
>
> --prefix -> /usr
> --includedir-> /usr/include
> --libdir -> /usr/lib/x86_64-linux-gnu
> --version -> netCDF 4.6.0
>
> So my question is how can I correctly install the '-lU77' lib?
> Or without'-lU77' lib, whether there is a way to correctly run functions like
> netcdf_MOD_nf90_create and netcdf_MOD_nf90_put_att_text ?
>
> Thank you so much. I'm looking forward to your reply
>
> Best,
>
> Atlas Chen
> School of Energy Sicence and Engineering
> Harbin Institute of Technology
> No.92, West Dazhi Street, Harbin, PR China
>
> Hi,
>
> I am writing this letter for some support about Netcdf libraries. Recently, I
> am trying to build a code, called I3RC, which requires the netcdf library.
>
> The netcdf options are set as:
>
> NetcdfHome = /home/atlas/Library/netCDF-Fortran
> Netcdf_IncludeDir = $(NetcdfHome)/include
> NetcdfLibs = -L$(NetcdfHome)/lib -lnetcdf -lU77
>
>
> But when I make the .f90 files, it tells me that
>
> Building in Example-Drivers directory
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators -c
> monteCarloDriver.f95
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators -o
> monteCarloDriver monteCarloDriver.o
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/characterUtils.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/numericUtilities.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/ErrorMessages.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/userInterface_Unix.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/multipleProcesses_nompi.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/scatteringPhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/inversePhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/opticalPropertie
s.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/RandomNumbersForMC.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/monteCarloIllumination.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Code/surfaceProperties.o
/home/atlas/00-AC/I3RC_Go_no_netCDF/I3RC-Monte-Carlo-Model/Integrators/monteCarloRadiativeTransfer.o
-L/home/atlas/Library/netCDF-Fortran/lib -lnetcdf -lU77
> /usr/bin/ld: cannot find -lU77
> collect2: error: ld returned 1 exit status
>
>
> And when I delete the '-IU77' from the NetcdfLibs (NetcdfLibs =
> -L$(NetcdfHome)/lib -lnetcdf), it gives:
> Building in Example-Drivers directory
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators -c
> monteCarloDriver.f95
> gfortran -O2 -std=f95 -fno-range-check
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/Library/netCDF-Fortran/include
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code
> -I/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators -o
> monteCarloDriver monteCarloDriver.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/characterUtils.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/numericUtilities.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/ErrorMessages.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/userInterface_Unix.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/multipleProcesses_nompi.o
>
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/scatteringPhaseFunctions.o
>
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/inversePhaseFunctions.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/opticalProperties.o
> /home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/RandomNumbersForMC.o
> /home/atlas/00-AC/I3R
C_Go/I3RC-Monte-Carlo-Model/Code/monteCarloIllumination.o
/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Code/surfaceProperties.o
/home/atlas/00-AC/I3RC_Go/I3RC-Monte-Carlo-Model/Integrators/monteCarloRadiativeTransfer.o
-L/home/atlas/Library/netCDF-Fortran/lib -lnetcdf
> monteCarloDriver.o: In function `writeresults_netcdf.3541.constprop.1':
> monteCarloDriver.f95:(.text+0x4cb): undefined reference to
> `__netcdf_MOD_nf90_create'
> monteCarloDriver.f95:(.text+0x4fe): undefined reference to
> `__netcdf_MOD_nf90_put_att_text'
> monteCarloDriver.f95:(.text+0x1bca): undefined reference to
> `__netcdf_MOD_nf90_inq_varid'
> monteCarloDriver.f95:(.text+0x1c96): undefined reference to
> `__netcdf_MOD_nf90_put_var_1d_fourbytereal'
> monteCarloDriver.f95:(.text+0x22c8): undefined reference to
> `__netcdf_MOD_nf90_put_var_3d_fourbytereal'
> monteCarloDriver.f95:(.text+0x1cd5): undefined reference to
> `__netcdf_MOD_nf90_def_dim'
>
>
> I think I have correctly installed netcdf, and nc-config -- all gives:
> This netCDF 4.6.0 has been built with the following features:
> --cc -> /usr/bin/cc
> --cflags -> -I/usr/include -I/usr/include/hdf5/serial
> --libs -> -L/usr/lib/x86_64-linux-gnu
> -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -lhdf5_hl -lhdf5 -lpthread
> -lsz -lz -ldl -lm -lcurl
>
> --has-c++ -> no
> --cxx ->
>
> --has-c++4 -> no
> --cxx4 ->
>
> --has-fortran-> yes
> --fc -> gfortran
> --fflags -> -I/usr/include
> --flibs -> -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro
> -Wl,-z,now -lnetcdf -lnetcdf
> --has-f90 -> no
> --has-f03 -> yes
>
> --has-dap -> yes
> --has-dap2 -> yes
> --has-dap4 -> yes
> --has-nc2 -> yes
> --has-nc4 -> yes
> --has-hdf5 -> yes
> --has-hdf4 -> no
> --has-logging-> no
> --has-pnetcdf-> no
> --has-szlib -> no
> --has-cdf5 -> no
> --has-parallel-> no
>
> --prefix -> /usr
> --includedir-> /usr/include
> --libdir -> /usr/lib/x86_64-linux-gnu
> --version -> netCDF 4.6.0
>
> So my question is how can I correctly install the '-lU77' lib?
> Or without'-lU77' lib, whether there is a way to correctly run functions like
> netcdf_MOD_nf90_create and netcdf_MOD_nf90_put_att_text ?
>
> Thank you so much. I'm looking forward to your reply
>
> Best,
Ticket Details
===================
Ticket ID: YMY-503506
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.