[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #OBF-167021]: Compiling Fortran example code



Hello,

This is an interesting problem that, unfortunately, I am unable to recreate.  
I've duplicated your test locally but I have no problem running the test.  I 
*did* have to modify my LD_LIBRARY_PATH to point to my equivalent of 
`/home/ce270/local/lib`, but if this were the problem I would expect you to 
receive a 'library not loaded' error.  This also assumes you are building with 
shared libraries instead of static libraries.  

Has the source file you're using been modified in any way? It's possible that 
an error was introduced, but if the file is exactly the same as what is being 
distributed, I'm afraid I don't have a lot of ideas, particularly since other 
tests appear to be working just fine.  If you provide your config.log file I 
will scan it to see if anything leaps out at me.

I'm sorry I can't provide a more concrete answer; if 'make check' didn't return 
any errors, I would conclude that the install is fine and that the issue lies 
somehow with the development/build/working environment.

-Ward

> Hi there,
> 
> Apologies if you have already received this request through your automated
> submission form. I haven't had the expected confirmation of receipt, so am
> sending on my request directly, hope this is OK!
> 
> I would like to use the netCDF Fortran libraries to read in some *.nc data
> files.
> 
> As far as I can tell, the installation of the netcdf-fortran-4.4.1 package
> (and all pre-requisites) has been successful. However, I seem to be unable
> to reproduce the successful compilation of the example Fortran code myself.
> 
> EG
> 
> If I run an executable file created during installation it works as it
> should:
> 
> ./simple_xy_nc4_wr
> *** SUCCESS writing example file simple_xy_nc4.nc!
> 
> But if I try to compile the code myself and then execute, I am not so lucky:
> 
> gfortran -g -O2 -o simple_xy_nc4_wr_cje -I/home/ce270/local/include
> simple_xy_nc4_wr.f -L/home/ce270/local/lib -lnetcdff -lnetcdf -lhdf5
> -lhdf5_hl
> ./simple_xy_nc4_wr_cje
> Error: NetCDF: Unknown file format
> 
> STOP 2
> 
> Interestingly, the same compilation command is successful on a different
> piece of example code:
> 
> gfortran -g -O2 -o simple_xy_wr_cje -I/home/ce270/local/include
> simple_xy_wr.f -L/home/ce270/local/lib -lnetcdff -lnetcdf -lhdf5 -lhdf5_hl
> ./simple_xy_wr_cje
> *** SUCCESS writing example file simple_xy.nc!
> 
> As far as I can gather, this might be because the *_nc4_* version of the
> example code above requires use of the hdf5 libraries... although these
> also seem to have installed correctly with no problems.
> 
> If you can give me any pointers on where the compilation may be going
> wrong, I would be very grateful indeed!
> 
> Best wishes, and thanks for your help,
> 
> Chris
> 
> ps - supplementary info on the install:
> 
> I installed the necessary libraries in accordance with the online
> instructions:
> 
> --Installing zlib-1.2.8
> ./configure --prefix=/home/ce270/local
> make
> make check
> make install
> 
> --installing hdf5-1.8.14
> ./configure --with-zlib=/home/ce270/local --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> --installing netcdf-4.3.2
> CPPFLAGS=-I/home/ce270/local/include LDFLAGS=-L/home/ce270/local/lib
> ./configure --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> --installing netcdf-fortran-4.4.1
> CPPFLAGS=-I/home/ce270/local/include LDFLAGS=-L/home/ce270/local/lib
> ./configure --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> This installation was completed on a "clean" system, i.e. I used "make
> uninstall" and "make distclean" in each case to clear up any previous
> attempts at installation. I realise that use of the sudo prefix in the
> installation is not ideal, but otherwise I get an error and the
> installation is unsuccessful. This all proceeds without any obvious errors
> (although several warnings do pop up). I have also checked manually that
> the library files and *.mod files are indeed located in the correct
> directories (i.e. those listed during the example code compilation steps
> above).
> 
> 
> Hi there,
> 
> Apologies if you have already received this request through your automated
> submission form. I haven't had the expected confirmation of receipt, so am
> sending on my request directly, hope this is OK!
> 
> I would like to use the netCDF Fortran libraries to read in some *.nc data
> files.
> 
> As far as I can tell, the installation of the netcdf-fortran-4.4.1 package
> (and all pre-requisites) has been successful. However, I seem to be unable
> to reproduce the successful compilation of the example Fortran code myself.
> 
> EG
> 
> If I run an executable file created during installation it works as it
> should:
> 
> ./simple_xy_nc4_wr
> *** SUCCESS writing example file simple_xy_nc4.nc!
> 
> But if I try to compile the code myself and then execute, I am not so lucky:
> 
> gfortran -g -O2 -o simple_xy_nc4_wr_cje -I/home/ce270/local/include
> simple_xy_nc4_wr.f -L/home/ce270/local/lib -lnetcdff -lnetcdf -lhdf5
> -lhdf5_hl
> ./simple_xy_nc4_wr_cje
> Error: NetCDF: Unknown file format
> 
> STOP 2
> 
> Interestingly, the same compilation command is successful on a different
> piece of example code:
> 
> gfortran -g -O2 -o simple_xy_wr_cje -I/home/ce270/local/include
> simple_xy_wr.f -L/home/ce270/local/lib -lnetcdff -lnetcdf -lhdf5 -lhdf5_hl
> ./simple_xy_wr_cje
> *** SUCCESS writing example file simple_xy.nc!
> 
> As far as I can gather, this might be because the *_nc4_* version of the
> example code above requires use of the hdf5 libraries... although these
> also seem to have installed correctly with no problems.
> 
> If you can give me any pointers on where the compilation may be going
> wrong, I would be very grateful indeed!
> 
> Best wishes, and thanks for your help,
> 
> Chris
> 
> ps - supplementary info on the install:
> 
> I installed the necessary libraries in accordance with the online
> instructions:
> 
> --Installing zlib-1.2.8
> ./configure --prefix=/home/ce270/local
> make
> make check
> make install
> 
> --installing hdf5-1.8.14
> ./configure --with-zlib=/home/ce270/local --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> --installing netcdf-4.3.2
> CPPFLAGS=-I/home/ce270/local/include LDFLAGS=-L/home/ce270/local/lib
> ./configure --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> --installing netcdf-fortran-4.4.1
> CPPFLAGS=-I/home/ce270/local/include LDFLAGS=-L/home/ce270/local/lib
> ./configure --prefix=/home/ce270/local
> make
> make check
> sudo make install
> 
> This installation was completed on a "clean" system, i.e. I used "make
> uninstall" and "make distclean" in each case to clear up any previous
> attempts at installation. I realise that use of the sudo prefix in the
> installation is not ideal, but otherwise I get an error and the
> installation is unsuccessful. This all proceeds without any obvious errors
> (although several warnings do pop up). I have also checked manually that
> the library files and *.mod files are indeed located in the correct
> directories (i.e. those listed during the example code compilation steps
> above).
> 
> 

Ticket Details
===================
Ticket ID: OBF-167021
Department: Support netCDF
Priority: Normal
Status: Closed