How do I install with CMake?
Getting an "relocation R_X86_64_32 against `.bss' cannot be used when making a shared object; recompile with -fPIC"
Like for example the following case
A jasper library that has been linked statically is trying to be linked into a dynamic libgrib_api.so. Libraries linked to a dynamic library must use "relocatable" code, and normally static libraries aren't. Possible solutions are:
- If possible, use a dynamic version of jasper. Build it with support for static libraries. Most rpm or deb packages already include a dynamic version that will be taken in preference. Or
- Build jasper with the "-fPIC" CFLAG. In that case even the static library will be relocatable.
- Use the "--disable-shared" option in grib_api. In this case no dynamic library will be produced (just the static version) and the problem won't be applicable any more.
Get "duplicated symbol" errors in Mac OS X Lion (10.7)
This problem may happen when using the libtool version of grib_api
The reason of this error is the inclusion of the "-fno_common" flag in the compilation of the object files (eg .libs/action_class_alias.o) which is added by autotools. From the Apple gcc man page:
The workaround is to edit the "configure" file and remove -fno-common from the added flags. It should be possible to edit the libtool.m4 file to remove the extra flag too. This way the flag wouldn't have to be removed manually whenever configure.ac changes.
Installing architecture independent files under a different prefix
For some installations you may want to install architecture or compiler dependent files, like executables, libraries and Fortran mod files in one area, while keeping a shared installation of the architecture independent files, like GRIB definitions, templates and samples. This can be achieved by using some autotools features.
With these commands architecture dependent files will go to /usr/bin and /usr/lib and architecture independent files to /data/share/grib_api/. It is also possible to only install binaries or definitions by executing "make install" in a subdirectory, as opposed to at the top level. For example:
Error testing in SPARC architectures (Solaris or Debian): Creating ()_xxx of section at offset xxx over message boundary
grib_api must be installed with the "--enable-memory-align" option in SPARC architectures. Otherwise the result is this error. Do make sure to run "make clean" before running "configure" again
If the option is not used, you will get errors similar to the following