lgautier / Rif.jl

Julia-to-R interface
GNU General Public License v2.0
54 stars 25 forks source link

using Rif error #36

Open egoecho opened 10 years ago

egoecho commented 10 years ago

My julia version is 0.4.0-dev+728 and my R version is 3.1.1, compiled with --enable-R-shlib. I always have below problem to use Rif. Anyone has the same problem?

julia> using Rif ERROR: could not load module /home/MyName/.julia/v0.4/Rif/deps/librinterface: /home/MyName/.julia/v0.4/Rif/deps/librinterface: cannot open shared object file: No such file or directory in dlopen at c.jl:28 in include at ./boot.jl:246 in include_from_node1 at ./loading.jl:128 in include at ./boot.jl:246 in include_from_node1 at ./loading.jl:128 in reload_path at loading.jl:152 in _require at loading.jl:67 in require at loading.jl:51 while loading /home/MyName/.julia/v0.4/Rif/src/embeddedr.jl, in expression starting on line 19 while loading /home/MyName/.julia/v0.4/Rif/src/Rif.jl, in expression starting on line 76

sherrinm commented 10 years ago

I got this working on a Centos (Redhat) Linux system and also on a Mint (Debian) one. The Centos was using julia v0.4 and the Mint julia v0.3 both buillt from source

For Centos:

After building R as a shared library and installing I needed to put the directory of the libraries on my LD_LIBRARY_PATH environment variable, which in my case was ...

export LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/usr/local/lib64/R/lib

... putting it in my .bash_profile so it's picked up each time.

For Debian, probably that includes Ubuntu as well as Mint, the default install directory was /usr/local/lib

I did not have a lot of success with adding it to the /etc/ld.so.config but probably that was me and I'll try again as its a cleaner solution if you have root access.

The error you are getting is because the first use of "using Rif" builds a library librinterface.so BUT the file embeddedr.jl refers to it without the '.so'

I chose to change line19 in the embeddedr.jl source but perhaps a symbolic link in the Rif package deps directory [ librinterface -> librinterface.so ] would work as well

So restarting julia and it worked fine for me

I've not tried it on OSX yet but will eventually but looking at your home directory it looks like you are on a Linux OS.

Hope that helps

Malcolm