[R] R and external C library " cannot open shared object file" while LD_LIBRARY_PATH is set

Pierre Lindenbaum pierre.lindenbaum at univ-nantes.fr
Mon Jul 28 10:52:02 CEST 2014

Thanks but that doesn't work: R cannot load a simple external library 
even if the full path to the directory  is specified in the LD_LIBRARY_PATH.

I posted a minimal example on gist.github:


The simple C file is compiled but I'm not able to load the library.


> ( cross-posted on SO: http://stackoverflow.com/questions/24955829/ )
> I'm building a C extension for R, this library also uses the HDF5 library.
> I compiled a dynamic library (gcc flags: -fPIC -shared -Wl,-soname,libmy.so
> the library seems to be loaded but R is still missing the symbols from the
> hdf5 library:
>> I am not any kind of expert, so that this as just a vague possibility
>> from someone who just wants to try to help. But I am "concerned" about
>> the options in the above. In particular, you have
>> "-Wl,-soname,libmy.so" Which looks slightly wrong to me, based on the
>> man for "ld". I think that, perhaps, this should be:
>> ""-Wl,-soname=libmy.so". Notice the = instead of the ,

More information about the R-help mailing list