HydrologicEngineeringCenter / hec-dss

source code for HEC-DSS (Data Storage System)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error

vcloarec opened this issue · comments

When trying to compile under ubuntu 22.04 with GNU Fortran 11.2.0, I have the following error:

putshf.f:227:32:

   49 |         CALL J2SDT ( J,M,CSDT,icen)
      |                            2    
......
  227 |                  call j2sdt(jul,itime,cbuff(idycode+4:idycode+13),i)
      |                                1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
putshf.f:230:34:

   49 |         CALL J2SDT ( J,M,CSDT,icen)
      |                            2      
......
  230 |                  call j2sdt (jul, itime, cbuff(idycode+2:idycode+11),i)
      |                                  1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)

That code in (hec-dss\nws_shef) is really only used by DssVue in windows. Also that code is slated for replacement by using the weather service code here: https://vlab.noaa.gov/web/mdl/shef-information

I'll investigate changes to ignore that code unless on windows.

PR #153 addresses this issue

Hi @vcloarec , would you be willing to try out the branch shef-windows-only
and see if that resolves the build error you reported?

I will try ASAP

@ktarbet , same error not at the same place:

gfortran -c -g -cpp -m64 -fPIC -Werror -Warray-bounds -Wc-binding-type -Wcharacter-truncation -fcheck=all,no-recursion -Isrc/headers    -c src/zdbmod6.f -o Output/./src/zdbmod6.f.o
src/zdbmod6.f:38:31:

   35 |             CALL zptrec6 (IFLTAB, ILBUFF, NWRDS, IADD, .FALSE.)
      |                                  2
......
   38 |          CALL zptrec6 (IFLTAB, IVALUE, 1, IADD, .FALSE.)
      |                               1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)

thanks @vcloarec

I have fixed several of the code issues identified by the gfortran-11 compiler, some errors will not be easy to fix, so we will need to remove option -Werror like you suggested. I'm working in the branch gfortran-11.

@ktarbet , I tried to compile from the branch gfortran-11, and it seems to work for the C library, I obtain the heclib.a file.

But on java side, there is still problem due to not finding the include path.
Adding -I/usr/lib/jvm/default-java/include/ -I/usr/lib/jvm/default-java/include/linux in CFLAGS for Linux in heclib/javaHeclib/Makefile allow the building.

But... I encounter a new issue when building libjavaHeclib.so:
./hec-dss/heclib/heclib_c/src/Internal/zcatInternalSort.c:261: warning: the use of "tempnam" is dangerous, better use "mkstemp"

I already encountered this problem when using heclib.a file from https://www.hec.usace.army.mil/software/hec-dss/downloads.aspx. ANd to be able to build my software using heclib, I need to add the -Wno-error also on my software build, this is quite annoying.

@ktarbet , I purpose this changes #155 in the branch gfortran-11 to make the compilation working.

How to fix this problem, I still have trouble with him
gcc (GCC) 10.3.0

make[1]: Entering directory `/users/p6095/Downloads/hec-dss/heclib/heclib_f'
mkdir -p Output/./src/
gfortran -c -g -cpp -m64 -fPIC -Warray-bounds -Wc-binding-type -Wcharacter-truncation -fcheck=all,no-recursion -Isrc/headers    -c src/zcutsz6.f -o Output/./src/zcutsz6.f.o
mkdir -p Output/./src/
gfortran -c -g -cpp -m64 -fPIC -Warray-bounds -Wc-binding-type -Wcharacter-truncation -fcheck=all,no-recursion -Isrc/headers    -c src/zspdi6.f -o Output/./src/zspdi6.f.o
src/zspdi6.f:336:33:

  332 |             CALL ZPTREC6(IFLTAB, DVALUES, N, IADD, .FALSE.)
      |                                 2
......
  336 |             CALL ZPTREC6(IFLTAB, SVALUES, NORD, IADD, .FALSE.)
      |                                 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/REAL(8)).
src/zspdi6.f:362:31:

  332 |             CALL ZPTREC6(IFLTAB, DVALUES, N, IADD, .FALSE.)
      |                                 2
......
  362 |           CALL ZPTREC6(IFLTAB, IGBUFF, NIHEAD, IADD, .FALSE.)
      |                               1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(8)).
src/zspdi6.f:462:33:

  332 |             CALL ZPTREC6(IFLTAB, DVALUES, N, IADD, .FALSE.)
      |                                 2
......
  462 |             CALL ZPTREC6(IFLTAB, SVALUES, NORD, INFO(NPPWRD+KIADAT),
      |                                 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/REAL(8)).
src/zspdi6.f:510:48:

  442 |      *   ICHEAD, 0, iuhead_copy2, nuhead_copy2, BUFF, NTOT, JTYPE,
      |                                                2
......
  510 |      *   ICHEAD, 0, iuhead_copy2, nuhead_copy2, DVALUES, N, JTYPE,
      |                                                1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/REAL(4)).
make[1]: *** [Output/./src/zspdi6.f.o] Error 1
make[1]: Leaving directory `/users/p6095/Downloads/hec-dss/heclib/heclib_f'
make: *** [all] Error 2

@meteorolog90 You many need to open a new issue, this issue #150 was for gfortran-11. What branch of the code are you using?

actual branch, I try the old one but had the same issues

If you are using the master branch?, you could try editing hec-dss\heclib\heclib_f\Makefile

and change line 10 from:
FWARNINGS=-Warray-bounds -Wc-binding-type -Wcharacter-truncation
to
FWARNINGS=-Warray-bounds -Wc-binding-type -Wcharacter-truncation -fallow-argument-mismatch