Forum

Compiling problems: gfortran and the C_LOC function

Marcello Magaldi, modified 5 Years ago.

Compiling problems: gfortran and the C_LOC function

Youngling Post: 1 Join Date: 6/5/13 Recent Posts
Hello everybody!
After many years I downloaded again d3d, specifically tag #59659, revision #65450. I know the process is painful as I had compiled previous versions in the past: all prerequisites are installed. 
I am now in an Ubuntu 16.04.6 LTS (xenial) 64bit machine which comes with GNU compilers (ver 5.4.0). I edited the build.sh script to point to the right directories of all prerequisistes and started building d3d with the -gnu and -64bit options. 
The logs/configure.log and logs/make.log files go thru without problems.
Unfortunately the bulding process stops for the logs/make_dflowfm.log file which terminates as below:

1
libtool: compile:  /opt/mpich/mpich_3_2_1_gcc5.4/bin/mpif90 -DHAVE_CONFIG_H -I. -I../../../../.. -I./../include -I./../../dflowfm_lib/include -I./../include -I../../../../../utils_lgpl/ec_module/packages/ec_module/src -I../../../../../utils_lgpl/io_netcdf/packages/io_netcdf/src -I../../../../../utils_lgpl/gridgeom/packages/gridgeom/src -I../../../../../utils_lgpl/deltares_common/packages/deltares_common/src -I../../../../../utils_lgpl/deltares_common/packages/deltares_common_mpi/src -I../../../../../utils_gpl/morphology/packages/morphology_data/src -I../../../../../utils_gpl/morphology/packages/morphology_io/src -I../../../../../utils_gpl/morphology/packages/morphology_kernel/src -I../../../../../utils_gpl/trachytopes/packages/trachytopes_io/src -I../../../../../utils_gpl/trachytopes/packages/trachytopes_kernel/src -I../../../../../utils_gpl/flow1d/packages/flow1d_core/src -I../../../../../utils_gpl/flow1d/packages/flow1d_io/src -I../../../../../third_party_open/kdtree2/src-f90 -I../../../../../third_party_open/libsigwatch -I../../../../../utils_lgpl/kdtree_wrapper/packages/kdtree_wrapper/src -DWITH_DELFTONLINE -DHAVE_DISPLAY=0 -I/opt/netcdf/netcdfC/netcdfC_4_6_1_gcc5.4/include -I/opt/netcdf/netcdfC/netcdfC_4_6_1_gcc5.4/include -I/opt/netcdf/netcdfF/netcdfF_4_4_4_gcc5.4/include -O2 -ffree-line-length-none -cpp -c ../../dflowfm_lib/src/unstruc_bmi.F90  -fPIC -o ../../dflowfm_lib/src/.libs/unstruc_bmi.o
2
../../dflowfm_lib/src/unstruc_bmi.F90:1567:19:          x = c_loc(valdambreak(1, item_index))
3
                   1
4
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
5
../../dflowfm_lib/src/unstruc_bmi.F90:1570:19:          x = c_loc(valdambreak(2, item_index))
6
                   1
7
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
8
Makefile:839: recipe for target '../../dflowfm_lib/src/unstruc_bmi.lo' failed
9
make[3]: *** [../../dflowfm_lib/src/unstruc_bmi.lo] Error 1
10
make[3]: Leaving directory '/home/magaldi/Delft3dOct19/src/engines_gpl/dflowfm/packages/dflowfm_kernel/src'
11
Makefile:493: recipe for target 'install-recursive' failed
12
make[2]: *** [install-recursive] Error 1
13
make[2]: Leaving directory '/home/magaldi/Delft3dOct19/src/engines_gpl/dflowfm/packages/dflowfm_kernel'
14
Makefile:494: recipe for target 'install-recursive' failed
15
make[1]: *** [install-recursive] Error 1
16
make[1]: Leaving directory '/home/magaldi/Delft3dOct19/src/engines_gpl/dflowfm/packages'
17
Makefile:493: recipe for target 'install-recursive' failed
18
make: *** [install-recursive] Error 1
19
make: Leaving directory '/home/magaldi/Delft3dOct19/src/engines_gpl/dflowfm'

This looks to be a known issue: Intel compilers are more permissive while NAG and Gfortran compilers both generate errors when argument to the C_LOC function do not have a TARGET or POINTER attribute set (see https://www.pgroup.com/userforum/viewtopic.php?t=6364 ).
Did anyone else stumble on the same problem?
Any hints to solve and allow the building process to finish?
Thank you in advance,
Marcello