Re: [netcdfgroup] Compiling with Gfortran compilers (4.4.1) for 32 vs 64 bit

  • To: "Capehart, William J" <William.Capehart@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Compiling with Gfortran compilers (4.4.1) for 32 vs 64 bit
  • From: Larry Baker <baker@xxxxxxxx>
  • Date: Fri, 13 Aug 2010 10:15:01 -0700
Bill,

I have just finished building netCDF on Linux and Mac OS X with several compilers (GNU, PGI, Intel, PathScale). For the GNU gcc/g++/ gfortran 32-bit compiles, I used:

# ./configure >configure.log 2>&1 \
   --prefix=/usr/local/netcdf \
   CC="gcc -m32" \
   CFLAGS="-g -O3" \
   CXX="g++ -m32" \
   CXXFLAGS="-g -O3" \
   CPPFLAGS="-DNDEBUG -DgFortran" \
   FC="gfortran -m32" \
   FCFLAGS="-g -O3" \
   F77="gfortran -m32" \
   FFLAGS="-g -O3"

For the GNU gcc/g++/gfortran 64-bit compiles, all I had to do is change -m32 to -m64:

# ./configure >configure.log 2>&1 \
   --prefix=/usr/local/netcdf64 \
   CC="gcc -m64" \
   CFLAGS="-g -O3" \
   CXX="g++ -m64" \
   CXXFLAGS="-g -O3" \
   CPPFLAGS="-DNDEBUG -DgFortran" \
   FC="gfortran -m64" \
   FCFLAGS="-g -O3" \
   F77="gfortran -m64" \
   FFLAGS="-g -O3"

On our version of Linux (CentOS 4.5), the GNU compilers default to 32- bit, even though it is x86_64 GNU/Linux. Thus, the -m32/-m64 options. The tests passed in all cases.

gcc is 3.4.6; gfortran is 4.1.1.

My build does not have a library named libnetcdff.a, so I'm not sure if we are configuring netCDF the same way:

[root@hydra ~]# ls /usr/local/netcdf*/lib
/usr/local/netcdf64/lib:
libnetcdf.a  libnetcdf_c++.a  libnetcdf_c++.la  libnetcdf.la  pkgconfig

/usr/local/netcdf/lib:
libnetcdf.a  libnetcdf_c++.a  libnetcdf_c++.la  libnetcdf.la  pkgconfig

[root@hydra ~]# find /usr/local/netcdf* -name libnetcdff.a

Larry Baker
US Geological Survey
650-329-5608
baker@xxxxxxxx

On Aug 11, 2010, at 3:39 PM, Capehart, William J wrote:

When building Netcdf 4.1.1 (and also 4.0.1) on a Mandriva 2010.0 and 2010.1 rigs (both 32 and 64 bit) I’ve run into an annoying problem when working with the GCC 4.4.3 compilers (and like others, I’m getting satisfactory
results with the –DpgiFortran option but that’s another matter).

The resulting library for the libnetcdf.a file for the 32bit build has all
the fortran functions and also reside in the libnetcdff.a library.
Meanwhile those functions do NOT land in the 64bit libnetcdf.a (but they ARE in the libnetcdff.a library). Any Idea as to why that’s happening, how to get the 64 bit build to act like the 32-bit build, or just how to use a little Psychology and Extreme Violence™ to merge the ff.a into the f.a file
(or even if that’s a tolerable idea).

Thanks Much
================================================================
Bill Capehart <William.Capehart@xxxxxxxxx>   Associate Professor
Institute of Atmospheric Sciences               Department Chair
213 Mineral Industries Building
South Dakota School of Mines and Technology Ph:  +1-605-394-1994
501 East Saint Joseph Street                Fax: +1-605-394-6061
Rapid City, SD 57701-3995                Mobile: +1-605-484-5692
=================== http://capehart.sdsmt.edu ==================


_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: