Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Both MPAS.7.0 and 6.3 failed with error ld returned 1 exit status

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

518er2005

Member
Hello everyone. I'm trying to compile the MPAS 7.0 Atmosphere. I'm following the installation script provided in, https://www2.mmm.ucar.edu/people/duda/f ... llation.sh. Also, instead of using NetCDF-c-4.7.0 in the script, I'm using NetCDF-c-4.7.4. I am encountering an error while compiling both MPAS7.0 and 6.3. The error I am getting is "collect2: error: ld returned 1 exit status ". I have done exactly how it was given in the installation except for the NetCDF library. Any sort of help in this regard will be much obliged. I am attaching the log file for MPAS 6.3 and the screenshot of the error for MPAS7.0, but for both cases the error is similar. I am using Ubuntu 20.04 WSL2 under Windows 10. The gfortran details are gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04).
 

Attachments

  • mpas_compile_error.7.0.jpg
    mpas_compile_error.7.0.jpg
    575.9 KB · Views: 1,352
  • make.log
    138.7 KB · Views: 45
The linking errors you're seeing, e.g.,
Code:
/usr/bin/ld: /mnt/d/scratch/duda/mpas-libs-gnu8.3.0/lib/libpioc.a(pio_getput_int.c.o): in function `PIOc_put_att_tc':
/mnt/d/ParallelIO/src/clib/pio_getput_int.c:165: undefined reference to `nc_put_att_text'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:168: undefined reference to `nc_put_att_schar'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:171: undefined reference to `nc_put_att_short'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:174: undefined reference to `nc_put_att_int'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:177: undefined reference to `nc_put_att_long'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:180: undefined reference to `nc_put_att_float'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:183: undefined reference to `nc_put_att_double'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:187: undefined reference to `nc_put_att_uchar'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:190: undefined reference to `nc_put_att_ushort'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:193: undefined reference to `nc_put_att_uint'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:197: undefined reference to `nc_put_att_longlong'
/usr/bin/ld: /mnt/d/ParallelIO/src/clib/pio_getput_int.c:200: undefined reference to `nc_put_att_ulonglong'
suggest that the NetCDF C library isn't available to the linker. I did notice in your make.log file that the final linking step doesn't include any NetCDF C or Fortran libraries:
Code:
mpif90 -O3 -m64 -o init_atmosphere_model driver/*.o -L. -ldycore -lops -lframework -L/mnt/d/scratch/duda/mpas-libs-gnu8.3.0/lib -lpiof -lpioc -L/mnt/d/scratch/duda/mpas-libs-gnu8.3.0/lib -lpnetcdf -L/mnt/d/scratch/duda/mpas-libs-gnu8.3.0/lib -lhdf5_hl -lhdf5 -ldl -lz -I./external/esmf_time_f90 -L./external/esmf_time_f90 -lesmf_time
(while we would generally expect to see "-lnetcdff -lnetcdf" somewhere in this line).

The NetCDF C and Fortran libraries are added to the list of libraries to link with by the top-level Makefile when the NETCDF environment variable is set.

Can you verify that the NETCDF environment variable is set when you try to build the init_atmosphere core?
 
Yes the NETCDF environment was set. Actually i did exactly how it was given in the script mentioned abive by exporting the libraries before building init_atmosphere core
 
Hello, sorry for the late reply. Actually what I did is that, I again reinstalled all the libraries from scratch and now it seems I have successfully installed MPAS v7.0. The libraries which I used for my installation is as follows: mpich-3.3, zlib-1.2.11, hdf5-1.10.5, parallel-netcdf-1.8.1, netcdf-c-4.7.4,fortran-4.4.5, pio1_7_4.tar. I successfully all the libraries and got MPAS complied. Now, I am confused about how to run it. Anyways, thanks for the concern shown before to help me. If any errors I face I will do contact again and I guess it must be in the "run" subsection.
Cheers,
Have a great day ahead.
 
Thanks for following up, and I'm glad to hear you were able to get the model compiled. Please don't hesitate to create new topics should you encounter any other issues, and we'll be glad to help.
 
Top