LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   NoahMP _ Problems compiling with MAX_SOIL_LEVELS (https://www.linuxquestions.org/questions/centos-111/noahmp-_-problems-compiling-with-max_soil_levels-4175676596/)

Mishel 06-06-2020 04:12 AM

NoahMP _ Problems compiling with MAX_SOIL_LEVELS
 
(cd Utility_routines; make)
make[1]: Entering directory `/home/HRLDAS/src/HRLDAS-v3.6/Utility_routines'

rm -f module_date_utilities.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_date_utilities.F > module_date_utilities.f
gfortran -o module_date_utilities.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_date_utilities.f


rm -f module_model_constants.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_model_constants.F > module_model_constants.f
gfortran -o module_model_constants.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_model_constants.f


rm -f module_wrf_utilities.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_wrf_utilities.F > module_wrf_utilities.f
gfortran -o module_wrf_utilities.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_wrf_utilities.f


rm -f kwm_string_utilities.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ kwm_string_utilities.F > kwm_string_utilities.f
gfortran -o kwm_string_utilities.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none kwm_string_utilities.f

make[1]: Leaving directory `/home/HRLDAS/src/HRLDAS-v3.6/Utility_routines'
(cd Noah; make)
make[1]: Entering directory `/home/HRLDAS/src/HRLDAS-v3.6/Noah'

rm -f module_sf_myjsfc.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_myjsfc.F > module_sf_myjsfc.f
gfortran -o module_sf_myjsfc.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_myjsfc.f


rm -f module_sf_sfclay.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_sfclay.F > module_sf_sfclay.f
gfortran -o module_sf_sfclay.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_sfclay.f


rm -f module_sf_noahmplsm.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_noahmplsm.F > module_sf_noahmplsm.f
gfortran -o module_sf_noahmplsm.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_noahmplsm.f


rm -f module_sf_noahmp_glacier.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_noahmp_glacier.F > module_sf_noahmp_glacier.f
gfortran -o module_sf_noahmp_glacier.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_noahmp_glacier.f


rm -f module_sf_noahmp_groundwater.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_noahmp_groundwater.F > module_sf_noahmp_groundwater.f
gfortran -o module_sf_noahmp_groundwater.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_noahmp_groundwater.f


rm -f module_sf_noahmpdrv.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_sf_noahmpdrv.F > module_sf_noahmpdrv.f
gfortran -o module_sf_noahmpdrv.o -c -I. -I../Utility_routines -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none module_sf_noahmpdrv.f

make[1]: Leaving directory `/home/HRLDAS/src/HRLDAS-v3.6/Noah'
(cd IO_code; make)
make[1]: Entering directory `/home/HRLDAS/src/HRLDAS-v3.6/IO_code'

rm -f module_hrldas_netcdf_io.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_hrldas_netcdf_io.F > module_hrldas_netcdf_io.f
gfortran -o module_hrldas_netcdf_io.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none -I../Utility_routines -I/home/HRLDAS/LIBRARIES/netcdf/include module_hrldas_netcdf_io.f


rm -f module_NoahMP_hrldas_driver.f
cpp -C -P -traditional -D_GFORTRAN_ -D_HRLDAS_OFFLINE_ module_NoahMP_hrldas_driver.F > module_NoahMP_hrldas_driver.f
gfortran -o module_NoahMP_hrldas_driver.o -c -g -fconvert=big-endian -fbounds-check -fno-range-check -ffree-form -ffree-line-length-none -I. \
-I../Noah -I../Utility_routines -I/home/HRLDAS/LIBRARIES/netcdf/include module_NoahMP_hrldas_driver.f
module_NoahMP_hrldas_driver.f:334.18:

REAL, DIMENSION(MAX_SOIL_LEVELS) :: soil_thick_input ! depth to soil in
1
Error: Expression at (1) must be of INTEGER type, found REAL
module_NoahMP_hrldas_driver.f:334.18:

REAL, DIMENSION(MAX_SOIL_LEVELS) :: soil_thick_input ! depth to soil in
1
Error: Expression at (1) must be of INTEGER type, found REAL
module_NoahMP_hrldas_driver.f:334.54:

REAL, DIMENSION(MAX_SOIL_LEVELS) :: soil_thick_input ! depth to soil in
1
Error: The module or main program array 'soil_thick_input' at (1) must have constant shape
make[1]: *** [module_NoahMP_hrldas_driver.o] Error 1
make[1]: Leaving directory `/home/HRLDAS/src/HRLDAS-v3.6/IO_code'
make: *** [all] Error 2

shruggy 06-07-2020 08:03 AM

Somehow, the issue you opened in HRLDAS repo on GitHub includes more info than your post here.

Perhaps the version of gfortran in Ubuntu 20.04 enforces some restrictions that weren't in place previously. Try to compile with -std=legacy.

One thing I noticed is the affected code line in your post above is #334 and in the compiler output from the GitHub issue #31 it is line #341, whereas the relevant code line in the git repository is #565. Looks like you're compiling an older version. Try checking out the latest git snapshot, maybe your issue is already fixed there.

And if everything else fails try replacing the constant MAX_SOIL_LEVELS with its value in the code:
Code:

REAL, DIMENSION(10) :: soil_thick_input

Mishel 06-08-2020 01:38 PM

New issues regarding HRLDAS
 
Hi shruggy:
I tried what you suggested me.
First comment, did not change any result
Regarding isntalling new version, now I'm having new outputs as follows:

Code:

mishel@mishel-VirtualBox:~/HRLDAS/HRLDAS$ make
(cd Utility_routines;                make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/Utility_routines'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/Utility_routines'
(cd phys;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/phys'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/phys'
(cd IO_code;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/IO_code'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/IO_code'
(cd run;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/run'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/run'
(cd HRLDAS_forcing;                make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
(cd lib; make)
make[2]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
(make -f Makefile all)
make[2]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'

rm -f create_forcing.f90
/usr/bin/cpp -C -P -traditional -D_GFORTRAN_  create_forcing.F > create_forcing.f90
/usr/bin/gfortran -ffree-form -ffree-line-length-none -g -fconvert=big-endian -fbounds-check -fno-range-check -fno-underscoring -c -I/usr/include/ -I./lib -I./lib create_forcing.f90
create_forcing.f90:1:1:

    1 | /* Copyright (C) 1991-2020 Free Software Foundation, Inc.
      | 1
Error: Invalid character in name at (1)
create_forcing.f90:16:4:

  16 |    <https://www.gnu.org/licenses/>.  */
      |    1
Error: Invalid character in name at (1)
create_forcing.f90:19:1:

  19 | /* This header is separate from features.h so that the compiler can
      | 1
Error: Invalid character in name at (1)
create_forcing.f90:22:4:

  22 |    <features.h> because the implicit include comes before any feature
      |    1
Error: Invalid character in name at (1)
create_forcing.f90:27:1:

  27 | /* glibc's intent is to support the IEC 559 math functionality, real
      | 1
Error: Invalid character in name at (1)
create_forcing.f90:36:1:

  36 | /* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
      | 1
Error: Invalid character in name at (1)
make[2]: *** [Makefile:25: create_forcing.o] Error 1
make[2]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
make[1]: *** [Makefile:13: default] Error 2
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
make: *** [Makefile:12: all] Error 2

This happened trying with Ubuntu 20.04.
DO you have any guess what this is happening?
THanks in advance for your help.
Cheers,
Mishel

shruggy 06-08-2020 01:52 PM

Remove the -C option from the cpp command line. You want C-style comments to be discarded, not to be passed through to the Fortran compiler.

Mishel 06-08-2020 01:57 PM

I did that. AWesome!
But I'm still having issues. Those are my outputs so far:

Code:

(cd Utility_routines;                make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/Utility_routines'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/Utility_routines'
(cd phys;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/phys'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/phys'
(cd IO_code;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/IO_code'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/IO_code'
(cd run;                        make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/run'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/run'
(cd HRLDAS_forcing;                make)
make[1]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
(cd lib; make)
make[2]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
(make -f Makefile all)
make[2]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
(cd lib; make)
make[3]: Entering directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib'
/usr/bin/gfortran -o create_forcing.exe -I./lib -g -fconvert=big-endian -fbounds-check -fno-range-check -fno-underscoring -I./lib create_forcing.o \
        -L./lib -lsmda -L/usr/include/ -lnetcdf -lnetcdff -lbz2 -ljpeg -L/usr/lib/x86_64-linux-gnu/ -ljasper
/usr/bin/ld: ./lib/libsmda.a(module_grib2.o): in function `__module_grib2_MOD_fortran_decode_jpeg2000':
/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib2.f90:146: undefined reference to `info_jpeg2000'
/usr/bin/ld: /home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib2.f90:154: undefined reference to `decode_jpeg2000'
/usr/bin/ld: ./lib/libsmda.a(module_grib.o): in function `__module_grib_MOD_findgrib':
/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:184: undefined reference to `io_fread'
/usr/bin/ld: /home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:201: undefined reference to `io_fread'
/usr/bin/ld: /home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:221: undefined reference to `io_fread'
/usr/bin/ld: /home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:278: undefined reference to `io_ftell'
/usr/bin/ld: ./lib/libsmda.a(module_grib.o): in function `__module_grib_MOD_getgrib':
/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:112: undefined reference to `io_fread'
/usr/bin/ld: ./lib/libsmda.a(module_grib.o): in function `__module_grib_MOD_gribclose':
/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:75: undefined reference to `c_close'
/usr/bin/ld: ./lib/libsmda.a(module_grib.o): in function `__module_grib_MOD_gribopen':
/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing/lib/module_grib.f90:65: undefined reference to `c_gribopen'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:29: create_forcing.exe] Error 1
make[2]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
make[1]: *** [Makefile:13: default] Error 2
make[1]: Leaving directory '/home/mishel/HRLDAS/HRLDAS/HRLDAS_forcing'
make: *** [Makefile:12: all] Error 2


shruggy 06-08-2020 02:07 PM

Undefined references usually mean a library is missing. See this issue though. The solution is to delete the -fno-underscoring in user_build_options.

Mishel 06-09-2020 10:01 AM

Quote:

Originally Posted by shruggy (Post 6132149)
Undefined references usually mean a library is missing. See this issue though. The solution is to delete the -fno-underscoring in user_build_options.

I did that but still. Perhaps is the Ubuntu version I'm using? (20.04)

shruggy 06-09-2020 10:51 AM

But still what? You have the same issue? Or something different? Ubuntu 20.04 ships with four versions of gfortran:
Code:

$ aptitude -F%p search '~Pfortran95-compiler~rnative'
gfortran-10
gfortran-7
gfortran-8
gfortran-9

That's not counting flang-7. None of them works for you?


All times are GMT -5. The time now is 06:34 AM.