Version 3 (modified by 12 years ago) ( diff ) | ,
---|
Problems Compiling Shared HDF5 Objects
Symptom: When trying to compile C project that used the HDF5 library as a shared object (i.e., an .so
file) I received the following message:
ld: /usr/local/hdf5_intel_9.0/lib/libhdf5.a(H5.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
Problem: The HDF5 library to which I was linking was not compiled using the -fPIC
option, which is used when compiling a shared object.
Solution: Either recompile your system's HDF5 library or obtain the source code and build a new local copy. The latter is recommended, other applications will be using the system's HDF5 library. Either way, the library should be compiled using the -fPIC
flag:
cd HDF5_SOURCE_DIR CFLAGS=-fPIC ./configure --prefix=TARGET_DIR make install
Note:
See TracWiki
for help on using the wiki.