Re: [netcdfgroup] netcdf-4.1.1 build succeeds with hdf5 on OSX 10.6.3 using Xcode 3.2.2 and gfortran-42-5659.pkg

  • To: Roy Mendelssohn <Roy.Mendelssohn@xxxxxxxx>
  • Subject: Re: [netcdfgroup] netcdf-4.1.1 build succeeds with hdf5 on OSX 10.6.3 using Xcode 3.2.2 and gfortran-42-5659.pkg
  • From: Larry Baker <baker@xxxxxxxx>
  • Date: Mon, 2 Aug 2010 11:29:47 -0700
The important point I want to communicate is to define -m32/-m64 in the compiler/linker variable, not in the flags variables. It is common in makefiles to use CC for the ld step (LD is by default defined as $(CC)?), but do not include CFLAGS (the ld step usually uses LDFLAGS instead). The ld step can either fail or generate mysterious results if the -m32/-m64 flag does not match the object files. Plus, putting it in makefiles, the definition becomes self- documenting.

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

On Aug 2, 2010, at 11:12 AM, Roy Mendelssohn wrote:

I believe the default behavior in many things changed between 10.5.x and 10.6.x. I needed the -m32 flag for my compile (on 10.6.4) because HDF did default to 32 bit while netcdf did not.

-Roy

On Aug 2, 2010, at 11:00 AM, Larry Baker wrote:

My Mac is a 64-bit Mac Pro with 12 GB RAM. The kernel may be 32- bit (uname -a says i386), but that may not be definitive (OS X configures the kernel dynamically at boot.) (I never paid that much attention to it.) Regardless, 64-bit applications are supported. The Intel compilers (icc/icpc/ifort) default to 64-bit, but the GNU compilers (gcc/g++/g95/gfortran) do not.

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

On Aug 2, 2010, at 10:47 AM, John Helly wrote:

Thanks, Larry. I think that's true if you install the 32-bit Snow Leopard kernel. I'll check what this is actually compiling as if I can figure out how to do that on OSX.


Cheers.
--------------
John Helly, UCSD / San Diego Supercomputer Center / Scripps Institution of Oceanography, Climate, Atmospheric Science, and Physical Oceanography / +01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / /www.sdsc.edu/~hellyj




On Aug 2, 2010, at 10:22 AM, Larry Baker wrote:

John,

My recollection using gcc and gfortran on Mac OS X 10.5 (Leopard) is that they both default to 32-bit. My makefiles define CC (and, sometimes, LD) as "gcc -m64", plus FC as "gfortran -m64" to get things to work. Note: the -m64 flag is NOT in defined in the CFLAGS, FCFLAGS and LDFLAGS variables -- since -m64 is really selecting a different compiler/linker, it should be defined as part of those variables, regardless of the rest of the options.

For example, here's my (non-HDF) make configure of netCDF using gcc/g++/gfortran:

        cd netcdf-$(VERSION) ; \
        ./configure >configure.log 2>&1 \
           CC="gcc -m64" \
           CFLAGS="-g -O2" \
           CXX="g++ -m64" \
           CXXFLAGS="-g -O2" \
           CPPFLAGS="-DNDEBUG -DgFortran" \
           FC="gfortran -m64" \
           FCFLAGS="-g -O2"

(I haven't tried -O3, which supposedly invokes the gcc vectorizer/ sse code generator.)

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

On Aug 2, 2010, at 8:36 AM, John Helly wrote:

Hi.

I copied all the source (netcdf-beta.tar and hdf5-1.8.5) to another mac and upgraded Xcode and then installed the gfortran you specified and bingo.

+-------------------------------------------------------------+
| Congratulations! You have successfully installed netCDF!    |
|                                                             |
| You can use script "nc-config" to find out the relevant     |
| compiler options to build your application. Enter           |
|                                                             |
|     nc-config --help                                        |
|                                                             |
| for additional information.                                 |
|                                                             |
| CAUTION:                                                    |
|                                                             |
| If you have not already run "make check", then we strongly  |
| recommend you do so. It does not take very long.            |
|                                                             |
| Before using netCDF to store important data, test your      |
| build with "make check".                                    |
|                                                             |
| NetCDF is tested nightly on many platforms at Unidata       |
| but your platform is probably different in some ways.       |
|                                                             |
| If any tests fail, please see the netCDF web site:          |
| http://www.unidata.ucar.edu/software/netcdf/                |
|                                                             |
| NetCDF is developed and maintained at the Unidata Program   |
| Center. Unidata provides a broad array of data and software |
| tools for use in geoscience education and research.         |
| http://www.unidata.ucar.edu                                 |
+-------------------------------------------------------------+

iceberg:netcdf-4.1.2-beta1 hellyj$

Here's the script I used. Note that this is a 64bit build since I turned off the -m32 option. At least I think it defaults to 64- bit.

#!/bin/bash
make distclean
#export LDFLAGS="-L/usr/local/hdf5-1.8.5-macosx32-static"
#export DYLD_LIBRARY_PATH=/usr/local/hdf5-1.8.5-macosx32-static: $DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/hdf5-1.8.5:$DYLD_LIBRARY_PATH
#export LD_LIBRARY_PATH=/usr/local/hdf5-1.8.5-macosx32-static: $LD_LIBRARY_PATH
#
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
echo "DYLD_LIBRARY_PATH:$DYLD_LIBRARY_PATH"
export CC=/usr/bin/cc
#export CFLAGS='-m32'
#export CPPFLAGS=-Df2cFortran
export F77=gfortran
export FC=gfortran
export FCFLAGS=-qsuffix=cpp=f90
./configure --prefix=/usr/local/netcdf-4.1.2beta --enable- netcdf-4 --enable-f90 --with-hdf5=/usr/local/hdf5-1.8.5

#./configure --prefix=/usr/local/netcdf-4.1.1 --enable-netcdf-4 -- enable-f90 --with-hdf5=/usr/local/hdf5-1.8.5-macosx32-static
#
#export LDFLAGS="-L/usr/local/hdf5-1.8.5-macosx64-static"
#./configure --prefix=/usr/local/netcdf-4.1.1 --enable-netcdf-4 -- enable-f90 --with-hdf5=/usr/local/hdf5-1.8.5-macosx64-static

I'm going to try to reproduce this on my laptops where I was having the previous problems.

Cheers.
--------------
John Helly, UCSD / San Diego Supercomputer Center / Scripps Institution of Oceanography, Climate, Atmospheric Science, and Physical Oceanography / +01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / /www.sdsc.edu/~hellyj




On Aug 2, 2010, at 8:20 AM, John Helly wrote:

Thanks, Roy.  Sounds like just the kind of black magic I need.
Cheers.
--------------
John Helly, UCSD / San Diego Supercomputer Center / Scripps Institution of Oceanography, Climate, Atmospheric Science, and Physical Oceanography / +01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / /www.sdsc.edu/~hellyj




On Aug 2, 2010, at 7:52 AM, Roy Mendelssohn wrote:

Hi John:

I notice you are using HDF-1.8.5. A few days ago I emailed the list about that, and Ed replied that at the moment they do not work with HDF-1.8.5 (i can't find the email but look at the archives). You need to use the version of HDF 1.8.4 that is on the netcdf ftp site. I have been able to compile that with:

1.  the gcc and gfortran from fink

2. the gcc from apple and the gfortran from R at: http://r.research.att.com/tools/ - make certain you scroll down and get the gfortran for Snwo Leopard, not the one at the top of the page.

HTH,

-Roy




Greetings.

I am struggling to compile netcdf-4.1.1 on OSX 10.6.4 with hdf5 and fortran so I can build Dave Pierce's new ncview. I have worked my way through some earlier problems and have come to this script:

#!/bin/bash
make distclean
#export LDFLAGS="-L/usr/local/hdf5-1.8.5-macosx32-static"
export CC=/usr/bin/cc
export CFLAGS='-m32'
#export CPPFLAGS=-Df2cFortran
export F77=gfortran
export FC=gfortran
export FCFLAGS=-qsuffix=cpp=f90
./configure --prefix=/usr/local/netcdf-4.1.1 --enable-netcdf-4 -- enable-f90 --with-hdf5=/usr/local/hdf5-1.8.5-macosx32-static
#
#export LDFLAGS="-L/usr/local/hdf5-1.8.5-macosx64-static"
#./configure --prefix=/usr/local/netcdf-4.1.1 --enable-netcdf-4 --enable-f90 --with-hdf5=/usr/local/hdf5-1.8.5-macosx64-static


This got me past some earlier problems with 32-bit fortran libraries (I think) but now I'm getting complaints about the hdf5 libraries even though they seem to be found for some things.

checking for manual-page index command...
checking hdf5.h usability... yes
checking hdf5.h presence... yes
checking for hdf5.h... yes
checking whether we should try to build netCDF-4... yes
checking for H5Fflush in -lhdf5... no
configure: error: Can't find or link to the hdf5 library. Configure with --disable-netcdf-4 or see config.log for errors.


I'm attaching the config.log for those who might care to look. In the script above, you can see that I experimented with defining the LDFLAGS and this solved the problem of the missing - lhdf5 but introduced a bunch of other even stranger problems that made me think I was overriding some more basic library paths by specifying LDFLAGS. Anyway, I couldn't figure out what those problems were so I backed up to this in hoping that someone out there would have a suggestion.

Any help would be appreciated.

Cheers.
--------------
John Helly, UCSD / San Diego Supercomputer Center / Scripps Institution of Oceanography, Climate, Atmospheric Science, and Physical Oceanography / +01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / /www.sdsc.edu/~hellyj
<config.log>

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

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"

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

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

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

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


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

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"




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