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 encountered some problems creating a shared lib on x86_64 platform > when linking against a static libnetcdf. > > Error msg was : > relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a > shared object; recompile with -fPIC > > When using '--disable-shared', the source files are not compiled with > -fPIC, this is only done with '--enable-shared'. This problem could be > solved by settting CFLAGS manually, or even better by adding another > configure option '--with-pic'. It would be great to let this be set > automatically or to have a note about this in the INSTALL file. > > I am surely not an expert, but is there any drawback from using -fPIC > for static builds? > > kind regards > ralf > > I don't know of any drawback to using -fPIC. As you say, the way to do this is by setting CFLAGS before running configure. Good luck! Ed Ticket Details =================== Ticket ID: CKG-467716 Department: Support netCDF Priority: Normal Status: Closed