[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #YQG-383700]: Fortran name mangling does not agree with F90 mangling



> When linking a F90 program to libnetcdff, I get a bunch of errors
> starting with
> 
> undefined reference to `nf_put_vars_text_'
> 
> After some inspection, I see that the F90 wrappers are using symbols
> with only one trailing underscore while the defined symbols all have two
> trailing underscores.
> 
> $ nm /usr/lib/libnetcdff.a |g nf_def_dim
> 000000000000046c T nf_def_dim__
> U nf_def_dim_
> 
> The undefined symbol is referenced by the F90 wrapper indicating that
> this is a result of incorrect name mangling (gfortran's standard ABI
> uses only one underscore).
> 
> $ objdump -d --prefix-addresses -M intel /usr/lib/libnetcdff.so |g 
> 'nf_def_dim_[^_]'
> 000000000000da58 <nf_def_dim_@plt> jmp    QWORD PTR [rip+0x25a062]        # 
> 0000000000267ac0 <_GLOBAL_OFFSET_TABLE_+0x100>
> 000000000000da5e <nf_def_dim_@plt+0x6> push   0x1d
> 000000000000da63 <nf_def_dim_@plt+0xb> jmp    000000000000d878 <_init+0x18>
> 000000000001ab42 <__netcdf_MOD_nf90_def_dim+0x2> jmp    000000000000da58 
> <nf_def_dim_@plt>
> 
> My config.log is attached.
> 
> Jed
> 
> 
> 

Gfortran changed the way that it mangles names. I don't remember the version.

This is controlled by setting a pre-processor flag. For gfortran, try 
-Dgfortran.

Set this in CPPFLAGS, then reconfigure and rebuild netcdf. Do a make check to 
see if the fortran APIs are working.

Please let me know if this doesn't help.

Thanks,

Ed

Ticket Details
===================
Ticket ID: YQG-383700
Department: Support netCDF
Priority: Critical
Status: Closed