0

I'm trying to compile a program which is a chemical emission preprocessor.

This is the offical tutorial of its compile process.


enter image description here


I have already upload the original source code here.

With predefine the netcdf_dir, the source code should be compiled well.

But when I use ./make_util megan_bio_emiss, the error appear showing like:

=========================================================================
Using gfortran fortran compiler
=============================================================================
=============================================================================
netcdf top level directory = /disk2/hyf/lib/netcdf
=============================================================================
gfortran -g -ffree-line-length-none  -c -I/disk2/hyf/lib/netcdf/include misc_definitions_module.f90
gfortran -g -ffree-line-length-none  -c -I/disk2/hyf/lib/netcdf/include constants_module.f90
gfortran -g -ffree-line-length-none  -c -I/disk2/hyf/lib/netcdf/include bio_types.f90 
......
...... 
......

gfortran -o megan_bio_emiss misc_definitions_module.o constants_module.o   bio_types.o area_mapper.o bio_emiss.o -L/disk2/hyf/lib/netcdf/lib -lnetcdf -lnetcdff 
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/disk2/hyf/lib/netcdf/lib/libnetcdff.a(fort-attio.o): In function `nf_put_att_text_':
fort-attio.c:(.text+0x11c): undefined reference to `nc_put_att_text'
......

It seems that something(dwarf?) on the source code is uncompatiable with my system.

usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.

By the way, the operation system I'm using is CentOS 5.0 & I have installed netCDF-4.1.3(The last version that C & Fortran binary code are combined ) with GCC-4.9.2

Is there something I can change in the Makefile of the megan_bio_emiss to successfully compile?

Any advice will be appreciate!

-------------------------------- 2016-9-10 ADD --------------------------------

I add the -gdwarf-2 swith to the specific line of Makefile. enter image description here

The compilation still got wrong.

enter image description here

Community
  • 1
  • 1
Han Zhengzu
  • 3,694
  • 7
  • 44
  • 94

1 Answers1

3

The problem is that gcc 4.9 generates dwarf-4 by default, but you haven't updated to a recent version of the linker which also understands dwarf-4.

A simple workaround is the -gdwarf-2 compiler option.

janneb
  • 36,249
  • 2
  • 81
  • 97
  • Thanks for your reply! I have tried to add the swith `-gdwarf-2` to compile, but the problem seems not resolved. How to update to a recent version of the linker? – Han Zhengzu Sep 11 '16 at 01:23
  • 1
    Are you sure you have recompiled all objects? If so, you could try adding -gdwarf-2 to the link line as well, though I'm not sure that is necessary. – janneb Sep 11 '16 at 05:42
  • Sorry for replying you later. Where is the link line? I'm not quite familiar with compilation. Now with the addition of `-gdwarf2`, it compile each __.f90__ files like _gfortran -g -ffree-line-length-none -gdwarf-2 -c -I/disk2/hyf/lib/netcdf/include misc_definitions_module.f90_. – Han Zhengzu Sep 13 '16 at 10:38