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

[netCDF #FVK-122895]: Problem with installing netCDF.



> Hi Russ,
> 
> I see that you did
> 
> CPPFLAGS='-DNDEBUG -DgFortran'
> LDFLAGS=-m32
> ./configure --enable-netcdf-4 --with-hdf5=/share/ed/local/mort
> 
> do I still need to do
> export LD_LIBRARY_PATH={DIR1}/lib:$LD_LIBRARY_PATH
> CPPFLAGS=-I{DIR1}/include LDFLAGS=-L{DIR1}/lib
> and ./configure --prefix={DIR1}
> as described in 
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

Nope, sorry, those links were about building the older netCDF version 4.1.3, 
which unlike the newer
version you're trying to use, did not separate the C and Fortran libraries, 
leading to all kinds of
build problems.

I didn't mean for you to start over and try to build 4.2.1.1 using something 
that worked for 4.1.3. 
I just meant to point out that the particular problem you are now seeing:

  > >> /usr/bin/libtool: unknown option character `f' in: -force_load

only occurs on OSX platforms, and is a symptom of mismatching gcc and gfortran 
versions.  However,
it has a solution that sometimes works without changing compilers, which is to 
use the additional
environment variable:

  lt_cv_ld_force_load=no

for configure.

It seems like you had everything working fine with the build and install of the 
netCDF-4.2.1.1 C version, so you
shouldn't need to build the C library again.  The problem you're seeing is only 
with the Fortran build of
netcdf-fortran-4.2, and I think that can be fixed in either of two ways:

  -  Following the instructions for building netCDF-Fortran that you used, 
except adding the above environment
      variable before invoking configure, or
or

  -  Make sure you are using gcc and gfortran from the same source, such as 
macports.org

Sorry I confused things by pointing you at a URL that contained that 
information but also had lots of other
irrelevant information about building 4.1.3.  You have gotten so far with the 
newer netCDF 4.2.1.1 that you
definitely should stick with it to build the Fortran library, or just use the 
macports netcdf-fortran install to
get the port command to build it all for you.

--Russ

> On Mar 27, 2013, at 5:01 PM, Unidata netCDF Support <address@hidden> wrote:
> 
> > Yanshi,
> >
> > Here's the problem:
> >
> >  http://lists.gnu.org/archive/html/libtool/2011-01/msg00011.html
> >
> > and here's what I recommended last year:
> >
> >  http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11369.html
> >
> > with this correction of a typo:
> >
> >  http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11371.html
> >
> > --Russ
> >
> >> Hi Russ,
> >>
> >> I an trying to reinstall netcdf to my Mac OS X 10.8.2, and
> >>
> >> $gcc --version
> >> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 
> >> 5658) (LLVM build 2336.11.00)
> >>
> >> $gfortran --version
> >> GNU Fortran (GCC) 4.2.3
> >>
> >> And I did
> >> cd netcdf-4.2.1.1
> >> export FC="gfortran -m64"
> >> ./configure --prefix=/usr/local --disable-netcdf-4
> >> make
> >> make check
> >> sudo make install
> >>
> >> These ran without error.
> >> Then
> >>
> >> cd ../netcdf-fortran-4.2
> >> CPPFLAGS=-I$/usr/local/include
> >> DYLD_LIBRARY_PATH=/usr/local/lib
> >> LDFLAGS=-L/usr/local/lib
> >> ./configure --prefix=/usr/local
> >>
> >> which ran OK, then
> >> make gives
> >>
> >> ……..
> >> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DDLL_EXPORT -g -O2 -MT 
> >> fort-varsio.lo -MD -MP -MF .deps/fort-varsio.Tpo -c fort-varsio.c  
> >> -fno-common -DPIC -o .libs/fort-varsio.o
> >> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DDLL_EXPORT -g -O2 -MT 
> >> fort-varsio.lo -MD -MP -MF .deps/fort-varsio.Tpo -c fort-varsio.c -o 
> >> fort-varsio.o >/dev/null 2>&1
> >> /bin/sh ../libtool --tag=FC   --mode=link gfortran -m64  -g -O2  
> >> -version-number 5:3:1   -o libnetcdff.la -rpath /usr/local/lib 
> >> fort-attio.lo fort-control.lo fort-dim.lo fort-genatt.lo fort-geninq.lo 
> >> fort-genvar.lo fort-lib.lo fort-misc.lo fort-v2compat.lo fort-vario.lo 
> >> fort-var1io.lo fort-varaio.lo fort-varmio.lo fort-varsio.lo  
> >> ../f90/libnetcdff90.la -lnetcdf
> >> libtool: link: gfortran -m64 -dynamiclib -Wl,-undefined -Wl,dynamic_lookup 
> >> -o .libs/libnetcdff.5.dylib  .libs/fort-attio.o .libs/fort-control.o 
> >> .libs/fort-dim.o .libs/fort-genatt.o .libs/fort-geninq.o 
> >> .libs/fort-genvar.o .libs/fort-lib.o .libs/fort-misc.o 
> >> .libs/fort-v2compat.o .libs/fort-vario.o .libs/fort-var1io.o 
> >> .libs/fort-varaio.o .libs/fort-varmio.o .libs/fort-varsio.o   
> >> -Wl,-force_load,../f90/.libs/libnetcdff90.a  
> >> /usr/local/lib/libnetcdf.dylib -lm -lz -lcurl  -m64   -install_name  
> >> /usr/local/lib/libnetcdff.5.dylib -compatibility_version 9 
> >> -current_version 9.1 -Wl,-single_module
> >> /usr/bin/libtool: unknown option character `f' in: -force_load
> >> Usage: /usr/bin/libtool -static [-] file [...] [-filelist 
> >> listfile[,dirname]] [-arch_only arch] [-sacLT]
> >> Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist 
> >> listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] 
> >> [-compatibility_version #] [-current_version #] [-seg1addr 0x#] 
> >> [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table 
> >> <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] 
> >> [-noall_load]
> >> make[3]: *** [libnetcdff.la] Error 1
> >> make[2]: *** [all] Error 2
> >> make[1]: *** [all-recursive] Error 1
> >> make: *** [all] Error 2
> >>
> >>
> >> Any idea how to fix this? The config.log file for Fortran library is 
> >> attached.
> >> Thank you so much!
> >> Yanshi.
> >>
> >>
> >>
> >> OK, here are the relevant lines from config.log:
> >>
> >> configure:17833: gfortran -g -O2 -c conftestf.f
> >> configure:17836: $? = 0
> >> configure:17839: gfortran -o conftest -g -O2  conftestf.o conftest.o
> >> ld: warning: ignoring file conftest.o, file was built for unsupported file 
> >> format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 
> >> 0x 0 0x 0 0x 0 )  which is not the architecture being linked (i386): 
> >> conftest.o
> >> Undefined symbols for architecture i386:
> >> "_sub_", referenced from:
> >> _MAIN__ in conftestf.o
> >> ld: symbol(s) not found for architecture i386
> >>
> >> Your gfortran is compiling for i386, a 32-bit architecture, but your gcc is
> >> apparently compiling for a different architecture, probably 64-bit x86_64.
> >> You have to use the same architecture if you want to link the software 
> >> together.
> >> You could do this by either using the right flags for gcc, for example 
> >> -m32 or
> >> maybe -arch i386, or use a flag for gfortran, maybe -m64 or -arch x86_64.  
> >> If
> >> you installed netcdf-fortran from MacPorts, you may have a gfortran that 
> >> produces
> >> 64-bit objects with a long name something like
> >> /opt/local/bin/x86_64-apple-darwin-gfortran-mp-4.7
> >> but it might be easier to just use the gfortran you have and make gcc 
> >> produce
> >> 32-bit objects.
> >>
> >> --Russ
> >>
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: FVK-122895
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> >
> 
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: FVK-122895
Department: Support netCDF
Priority: Normal
Status: Closed