armgong / rjulia

R package which integrating R and Julia
GNU General Public License v2.0
145 stars 23 forks source link

help with installation: julia.h present but not found #1

Closed bbolker closed 10 years ago

bbolker commented 10 years ago

attempting to install via devtools::install_github, on Ubuntu 12.04. I have Julia installed via apt-get install: julia --version gives julia version 0.3.0-prerelease+3461. locate julia.h gives /usr/include/julia/julia.h. Any suggestions for telling the installer how to locate header files etc.?

library(devtools)
install_github("RJulia","armgong")
Installing github repo RJulia/master from armgong
Downloading master.zip from https://github.com/armgong/RJulia/archive/master.zip
Installing package from /tmp/Rtmpo0ZIqO/master.zip
arguments 'minimized' and 'invisible' are for Windows only
Installing rjulia
'/usr/local/lib/R/bin/R' --vanilla CMD INSTALL  \
  '/tmp/Rtmpo0ZIqO/devtoolsbe071783747/RJulia-master'  \
  --library='/media/sf_Documents/LOCAL/lib/R/site-library' --install-tests 

* installing *source* package 'rjulia' ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include -DNDEBUG -I"/include" -I"/../src"  -I"/../src/support" -I"/include/julia" -I/usr/local/include    -fpic  -g -O2  -c Julia_R.c -o Julia_R.o
Julia_R.c:6:19: fatal error: julia.h: No such file or directory
compilation terminated.
make: *** [Julia_R.o] Error 1
ERROR: compilation failed for package 'rjulia'
* removing '/media/sf_Documents/LOCAL/lib/R/site-library/rjulia'
Error: Command failed (1)
armgong commented 10 years ago

currently Rjulia will need Define JULIA_SRC env variable,pls see the file Makevar in src dir in your system export JULIA_SRC=/usr should be ok

bbolker commented 10 years ago

Hmm, still not working

library(devtools)
Sys.setenv(JULIA_SRC="/usr")
Sys.setenv(LD_LIBRARY_PATH="/usr/lib/i386-linux-gnu/julia/")
file.exists("/usr/lib/i386-linux-gnu/julia/libjulia.so")
[1] TRUE
install_github("RJulia","armgong")
gcc -std=gnu99 -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o rjulia.so Julia_R.o R_Julia.o embedding.o -L/usr/bin -ljulia -L/usr/lib -ljulia -L/usr/lib/julia -ljulia -L/usr/local/lib/R/lib -lR
/usr/bin/ld: cannot find -ljulia

I created a symbolic link from /usr/lib/libjulia.so to /usr/lib/i386-linux-gnu/julia/libjulia.so, got a little bit farther:

Error : .onLoad failed in loadNamespace() for 'rjulia', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/usr/local/lib/R/site-library/rjulia/libs/rjulia.so':
  /usr/lib/i386-linux-gnu/julia/libjulia.so: undefined symbol: uncompress

This is using julia version 0.3.0-prerelease+3789

armgong commented 10 years ago

this problem cause by libjulia.so can't find zlib.so(uncompress) or maybe more .so files,I think it can be solve by following 2 ways: 1 set in your .bashrc or .profile(Don't set this in R), LD_LIBRARY_PATH="/usr/lib/i386-linux-gnu/:/usr/lib/i386-linux-gnu/julia/:$LD_LIBRARY_PATH", this is prefer way 2 if 1 don't work,then create symbolic link from /usr/lib/libz.so to /usr/lib/i386-linux-gnu/libz.so

this should work