bug message reminder

When adressing a model crash or bug, please remember to include an entire model setup in your post that reproduces the crash or exposes the bug. Also add the XBlog.txt file. This is necessary information for people that are trying to help you. Including your model setup can be achieved by adding the zipped run directory (excluding output) as an attachment to the post.


constants._ "defined twice" error during Fortran linking

Scott Feister, modified 1 Month ago.

constants._ "defined twice" error during Fortran linking

Capillary Posts: 8 Join Date: 10/11/19 Recent Posts
Has anyone run into an error like this one when compiling? It relates to the Fortran linking stage, and claims that constants have been defined twice. Any ideas?
Compile ends with this error:
FCLD libxbeach.la
/usr/bin/ld: .libs/libxbeach_la-constants.o: in function `constants._':
constants.F90emoticon.text+0x0): multiple definition of `constants._'; .libs/libxbeach_la-constants.o:constants.F90emoticon.text+0x0): first defined here
make[4]: *** [Makefile:560: libxbeach.la] Error 1

I wonder if this is a subtle issue with the way XBeach autoconfigures, when not left to be automatically configured via pkg-config. I have compiled this exact svn-checkout of this code successfully before, in Ubuntu -- and in that case I didn't specify any environment variables at all (it was all managed by pkg-config). So, in a sense, I can't verify that this code builds when environment variables are manually set.
Here's the compile script I ran from Linux bash, for this terminal:
set -x

## Load Anaconda Python3 environment with "mako" installed
module load python
source $(conda info --base)/etc/profile.d/conda.sh # required for "conda activate"
conda activate xbeach

## Load MPICH and NetCDF
module load cray-mpich
module load cray-netcdf

## Specify (and create) an installation directory for XBeach
mkdir -p $MY_PREFIX

# Set some compiler flags
export CC=cc
export FC=ftn
export CFLAGS="-I${CRAY_MPICH_DIR}/include"
export FCFLAGS="-I${CRAY_MPICH_DIR}/include"
export CPPFLAGS="-I${CRAY_MPICH_DIR}/include"
export LDFLAGS="-L${CRAY_MPICH_DIR}/lib"
export NETCDF_CFLAGS="-I${NETCDF_DIR}/include"
export NETCDF_LIBS="-L${NETCDF_DIR}/lib"

## Build XBeach
./configure --with-mpi --with-netcdf --prefix="${MY_PREFIX}"
# make install