Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated configure file #4

Open
zemega opened this issue Feb 9, 2021 · 10 comments
Open

Outdated configure file #4

zemega opened this issue Feb 9, 2021 · 10 comments

Comments

@zemega
Copy link

zemega commented Feb 9, 2021

In the configure file, line 349.
$FC ${FFLAGS} fort_netcdf.f -o fort_netcdf -L${NETCDF}/lib $NETCDFF -lnetcdf > /dev/null 2>&1
This is really outdated. To compile ncl 6.6.2 with netcdf support, its inevitable to compile hdf5 into netcdf-c, due to the need of logging in ncl 6.6.2. Therefore the libs needed to be linked can be determined from nc-config --libs. If netcdf-fortran is compiled as well, the libs needed to be linked should be referred to nf-config --flibs.

Users interested in compiling RIP with latest or newer libraries should modify configure.rip to match the libs linked.

@ghost
Copy link

ghost commented Jun 2, 2022

Having issues with this, can you provide some more detail?

@zemega
Copy link
Author

zemega commented Jun 3, 2022

Having issues with this, can you provide some more detail?

It's been so long that I used RIP. What I remember is that, I decided to install ncl using conda, and compile RIP based on that ncl, and that worked. What I have in my note was the instruction below. I also installed the compilers used in conda to compile ncl so that RIP will also use the same compiler. I need to activate conda environment for which the ncl is installed and then use RIP.

conda install -c conda-forge ncl c-compiler fortran-compiler cxx-compiler

@ghost
Copy link

ghost commented Jun 3, 2022

In the configure file, line 349. $FC ${FFLAGS} fort_netcdf.f -o fort_netcdf -L${NETCDF}/lib $NETCDFF -lnetcdf > /dev/null 2>&1 This is really outdated. To compile ncl 6.6.2 with netcdf support, its inevitable to compile hdf5 into netcdf-c, due to the need of logging in ncl 6.6.2. Therefore the libs needed to be linked can be determined from nc-config --libs. If netcdf-fortran is compiled as well, the libs needed to be linked should be referred to nf-config --flibs.

Users interested in compiling RIP with latest or newer libraries should modify configure.rip to match the libs linked.

Since i'm not a computer programmer I do not really understand what is needed to be added to line 349 with nf-config

@ghost
Copy link

ghost commented Jun 3, 2022

nf-config --flibs

so in conda environment

nf-config --flibs
....envs/ncl_stable/lib -lnetcdff -lnetcdf -lnetcdf -lnetcdff_c

and use those links in line 349????

@zemega
Copy link
Author

zemega commented Jun 4, 2022

@whatheway. I decided to try and compile this today using conda environment.

  1. Create a conda environment called ncl_rip. conda create -n ncl_rip.
  2. Activate it. conda activate ncl_rip
  3. Install ncl and the compilers. conda install -c conda-forge ncl c-compiler fortran-compiler cxx-compiler
  4. export the NETCDF environment inside the conda. export NETCDF=/home/user/miniconda2/envs/ncl_rip. Replace user with your username. Or modify the path according to your system. Pay attention to the name of environment. I used ncl_rip here, while you used ncl_stable in your comment above.
  5. Inside the RIP-Master folder, open arch folder. Edit configure.defaults file on line 33. Add -fallow-argument-mismatch. This means changing FFLAGS = -I. -fcray-pointer -fconvert=big-endian -frecord-marker=4 -fPIC -fno-second-underscore -fno-range-check -O into FFLAGS = -I. -fcray-pointer -fconvert=big-endian -frecord-marker=4 -fPIC -fno-second-underscore -fno-range-check -fallow-argument-mismatch -O
  6. Go back to RIP-Master folder.
  7. Run ./clean to start over. It's always important to clean previous attempt of compilation before starting again.
  8. Run ./configure, pick option 3.
  9. Run ./compile.
  10. It should compile fine, and a rip executable should appear.
  11. Try running ./rip.

I don't have any data to test it right now. Let me know if you have trouble with this.

@ghost
Copy link

ghost commented Jun 4, 2022 via email

@ghost
Copy link

ghost commented Jun 4, 2022

/home/will/WRF/miniconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/will/WRF/Libs/NETCDF/lib/libnetcdf.so: undefined reference to `fstat@GLIBC_2.33'

/home/will/WRF/miniconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/will/WRF/Libs/NETCDF/lib/libnetcdf.so: undefined reference to `memcpy@GLIBC_2.14'

/home/will/WRF/miniconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/will/WRF/Libs/NETCDF/lib/libnetcdf.so: undefined reference to `stat@GLIBC_2.33'

/home/will/WRF/miniconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/will/WRF/Libs/NETCDF/lib/libnetcdf.so: undefined reference to `pow@GLIBC_2.29'

collect2: error: ld returned 1 exit status
make: [Makefile:44: rip] Error 1 (ignored)

@zemega
Copy link
Author

zemega commented Jun 4, 2022

@whatheway. You don't need any other configuration I believe. The conda installation will install netcdf, ncl, gcc, c++, and fortran inside the conda environment. See below. Everything that rip needs is contained inside the conda environment.

conda activate ncl_rip
which gcc
/home/user/miniconda2/envs/ncl_rip/bin/gcc
which gfortran
/home/user/miniconda2/envs/ncl_rip/bin/gfortran
which c++
/home/user/miniconda2/envs/ncl_rip/bin/c++
nc-config --prefix
/home/user/miniconda2/envs/ncl_rip

You need to be in the conda environment to install and use rip.
You don't need to use the same compiler and library between ncl/rip and WRF. Unless you are using highly advanced function of netcdf in WRF.
Your error suggest that you are trying to use the netcdf you used to install WRF.

I'll say this again. The method I'm using depends on the conda environment. You will need to be in the conda environment to install rip. You need to be in the conda environment whenever you want to use rip.

@ghost
Copy link

ghost commented Jun 4, 2022

If wrf has hdf5 enabled will I need to install hdf5 via conda as well?

Also netcdf needs to be installed via conda too correct?

I think I got it working everything installs expect the data processing rip exe

@zemega
Copy link
Author

zemega commented Jun 4, 2022

I understand that you want to use the same compiler and libraries for everything. It's recommended to do so after all. But when it comes to old software that's no longer updated, you have to sit back and uses separate compiler and libraries if you cannot use the current one. Usually older compiler and libraries.

WRF (and WPS) will use its own compiler and libraries. Any other program that explicitly uses WRF's library, needs to use the same compiler and libraries.

RIP and ncl does not have any dependencies on WRF. Therefore RIP and ncl does not need to use the same compiler and libraries as WRF.

conda install -c conda-forge ncl c-compiler fortran-compiler cxx-compiler install everything that ncl needs inside a conda environtment, including netcdf and hdf5. This means everything rip needs in a conda environment. You still need to modify/add -fallow-argument- because RIP was written for use with old version of gfortran.

I know the separate installation of WRF and rip works and rip can process the output of WRF. Because I have processed WRF output using rip before. WRF was compiled with latest (at that time last year) gfortran, netcdf-c, netcdf-fortran and other libraries. rip was compile using the conda environment method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant