E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
19 stars 16 forks source link

Linking issue on pioperf_rearr with legacy Fortran interface #530

Closed dqwu closed 10 months ago

dqwu commented 1 year ago

Steps to reproduce on ANL GCE nodes:

module load cmake/3.20.5-zyz2eld
module load gcc/11.1.0-qsjmpcg
export PATH=/nfs/gce/projects/climate/software/linux-ubuntu20.04-x86_64/mpich/4.0/gcc-11.1.0/bin:$PATH

git clone https://github.com/E3SM-Project/scorpio.git
cd scorpio

mkdir build
cd build

CC=mpicc CXX=mpicxx FC=mpifort \
cmake -Wno-dev \
-DWITH_NETCDF=OFF \
-DPnetCDF_PATH=/nfs/gce/projects/climate/software/linux-ubuntu20.04-x86_64/pnetcdf/1.12.2/mpich-4.0/gcc-11.1.0 \
-DPIO_USE_MALLOC=ON \
-DPIO_ENABLE_TESTS=ON \
-DPIO_ENABLE_EXAMPLES=ON \
-DPIO_USE_FORTRAN_LEGACY_LIB=ON \
..

make
make tests

Linking error:

[ 62%] Linking Fortran executable pioperf_rearr
/usr/bin/ld: CMakeFiles/pioperf_rearr.dir/pioperformance_rearr.F90.o: in function `pioperformance_rearrtest.3':
pioperformance_rearr.F90:(.text+0x1eaa): undefined reference to `pio_readdof_'

If we comment out pio_readdof calls in pioperformance_rearr.F90, the same linking issue is reproducible with pioperf:

[ 62%] Linking Fortran executable pioperf
/usr/bin/ld: CMakeFiles/pioperf.dir/pioperformance.F90.o: in function `pioperformancetest.3':
pioperformance.F90:(.text+0x26dd): undefined reference to `pio_readdof_'