[R] libR.so - not recognized

Duncan Temple Lang duncan at research.bell-labs.com
Mon Mar 10 14:24:42 CET 2003

Elena Zheleva wrote:
> i have a problem executing my code. it compiles just
> fine but during execution it gives me the following
> error:
> "./r_main: error while loading shared libraries:
> libR.so: canot open shared object file: No such file
> or directory"
> in my makefile, i have specified: 
> "LIBR=-L$(top_builddir)/bin -lR 'gtk-config --libs' 
> #(the path to the executable libR.so is correct) 
> r_main:r_main.o
>          gcc -o r_main r_main.o $(LIBR)"
> any ideas why it is not working? thanks in advance for
> yor help!!!

I assume you are working on Linux/Unix.  The problem is likely to be
that the dynamic loader (not linker) can't find libR.so.  You need to
have $R_HOME/bin (i.e. $top_builddir/bin) in your LD_LIBRARY_PATH so
that the loader can find the library.  You can use the program 'ldd'
to find out what shared libraries is linked against and will try to
load when it starts and that will also tell you where it found them
and which it did not find.

In some cases, rather than creating a stand-alone application that
embeds R, you can run your code from within R and have the same effect
but avoiding issues such as libR.so, LD_LIBRARY_PATH, etc.  And since
you are using Gtk, it might be possible to program the GUI entirely
within R via RGtk and related packages.

Good luck.

> elena zheleva
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Duncan Temple Lang                duncan at research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       

More information about the R-help mailing list