This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Hi, > > I'm trying to build NetCDF 4.0.1 on Ubuntu (Hardy) x86_64, using the > Intel Fortran compiler: > > ifort (IFORT) 10.1 20080312 > > and the build fails because the Fortran object files are non-PIC: > > /usr/bin/ld: ../f90/.libs/libnetcdff90.a(netcdf4.o): relocation > R_X86_64_32 against `a local symbol' can not be used when making a > shared object; recompile with -fPIC > > (A shared build without Fortran is fine, as is a static build with Fortran.) > > > This appears to be because configure is trying the obsolete ifort -KPIC > option, and concluding that PIC isn't supported: (from config.log) > > configure:18190: checking for ifort option to produce PIC > configure:18447: result: -KPIC > configure:18456: checking if ifort PIC flag -KPIC works > configure:18474: ifort -c -g -KPIC conftest.f >&5 > ifort: command line remark #10148: option '-K' not supported > configure:18478: $? = 0 > configure:18491: result: no > > > This test appears to originate in m4/libtool.m4, and has been changed > (to the modern -fPIC) in the latest libtool: (from the libtool 2.2.6b > ChangeLog) > > 2008-06-19 Ralf Wildenhues <address@hidden> > > * libltdl/m4/libtool.m4 (_LT_COMPILER_PIC) [linux] <icc, icpc>: > Use -fPIC, newer Intel compilers (icc 10, ifort 9) reject -KPIC. > * tests/localization.at: Skip test if the compiler fails merely > due to the locale setting. > * THANKS: Update. > Report by Vincent Lefevre. > > Perhaps a libtool update is needed in the source tree? (This problem > still occurs with netcdf-4.1-snapshot2010020500 as well.) Howdy Zak! Thanks for suggesting this, just in time for the 4.1 release. I have upgraded the libtool version on the machine that produces the release, to take advantage of the latest bug fixes. > > As a local workaround, I'm changing the configure script by hand to > choose -fPIC for ifort; the build then proceeds without problems. > It is never necessary to edit the configure file. Simply set environmental variable CFLAGS to -fPIC before calling the configure script (first doing a make clean). Thanks, Ed Ticket Details =================== Ticket ID: CBL-968606 Department: Support netCDF Priority: Normal Status: Closed