Compilation error for MAC OS with xlf95_r

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
thaned
Posts: 5
Joined: Thu May 25, 2006 2:36 am
Location: University of Colorado, boulder

Compilation error for MAC OS with xlf95_r

#1 Unread post by thaned »

I am using Mac G5 with "xlf95_r" to compile the ROMS version 2.2. I got an error at the very last step. I have feeling that it might be problem with flush_ but I am not quite sure. Then I tried to check "Utility/mp_routines.F" by change "AIX" to "XLF" but still not solving this problem. Can anyone know how to deal with this problem. Part of the error message I got is:

xlf95_r -c -qsuffix=f=f90 -qmaxmem=-1 -qextname -O3 -qstrict master.f90
** ocean === End of Compilation 1 ===
1501-510 Compilation successful for file master.f90.
xlf95_r -qsuffix=f=f90 -qmaxmem=-1 -qextname -O3 -qstrict master.o ocean_control.o -o oceanS libNLM.a libUTIL.a libMODS.a -L/usr/local/netcdf-3.6.1/lib -lnetcdf
ld: Undefined symbols:
_nf_close_
_nf_put_var1_double_
_nf_sync_
_nf_strerror_
_nf_open_
_nf_inq_varid_
_nf_get_var1_double_
_nf_inq_var_
_nf_inq_attname_

abarth

#2 Unread post by abarth »

Hi

For some reason, the compiler can't find the netcdf functions.
Can you run the following commands?
nm close_io.o | grep nf_close
nm /usr/local/netcdf-3.6.1/lib/libnetcdf.a | grep nf_close

Both commands should give the same function names (including underscores). If you have compiled netcdf will the gcc, you probably need either to compile it with xlf or with somethink like "gcc -fleading-underscore".

Alex

thaned
Posts: 5
Joined: Thu May 25, 2006 2:36 am
Location: University of Colorado, boulder

#3 Unread post by thaned »

You are right. The results are different. One from model provide underscore at before and after the file names.

nm close_io.o | grep nf_close
U _nf_close_
nm /usr/local/netcdf-3.6.1/lib/libnetcdf.a | grep nf_close
00000818 T _nf_close
U _nf_close

How can I correct this problem? I did reinstall netCDF with same xlf compiler with option of "cc -fleading-underscore" but problem still persist.
I 'll try to see if there any .F file I can modify
Thanks for suggestion.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#4 Unread post by kate »

The problem is with -qextname. This is an xlf option to put a trailing underscore on the name (_nf_close_) instead of leaving it be (_nf_close). First, check to see if -qextname was used when building the netcdf library. If not, take it out of the compile options on the Mac. Now you will get a link error on missing flush_. To fix this, go into mp_routines and look for my_flush. It does something in the case of AIX - add DARWIN to the list (#if defined AIX || defined DARWIN). I helped someone with this just last week. :)

Post Reply