armgong / rjulia

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

Works in OSX!? #24

Closed martinbel closed 8 years ago

martinbel commented 8 years ago

I've tried using the package in OSX and so far it worked ok. I'm using julia 0.4.2 It did give a few warnings in the instalation. Is there something in particular that doesn't work I could try?

Here is the code I've used, perhaps it helps.

Downloading GitHub repo armgong/rjulia@master
Installing rjulia
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/t3/f4r4rwmn7xl80skj6h35ftnh0000gn/T/Rtmpsg8iC9/devtools73f71e07eefe/armgong-rjulia-ef17748'  \
  --library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library'  \
  --install-tests 

* installing *source* package 'rjulia' ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src/support -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include/julia -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Julia_R.c -o Julia_R.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src/support -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include/julia -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c R_Julia.c -o R_Julia.o
R_Julia.c:183:55: warning: format specifies type 'int' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
       snprintf(eltcmd, eltsize, "%selt%d,", VarName, i);
                                       ~~             ^
                                       %zu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
R_Julia.c:193:56: warning: format specifies type 'int' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
       snprintf(eltcmd, eltsize, "%selt%d=0", VarName, i);
                                       ~~              ^
                                       %zu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
R_Julia.c:203:10: warning: incompatible pointer types assigning to 'jl_array_t *' from
      'jl_value_t *' (aka 'struct _jl_value_t *') [-Wincompatible-pointer-types]
      ret=(jl_value_t *)jl_nothing;
         ^~~~~~~~~~~~~~~~~~~~~~~~~
R_Julia.c:364:86: warning: format specifies type 'int' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
   snprintf(evalcmd, evalsize, "%s=PooledDataArray(ASCIIString,Uint32,%d)", VarName, len);
                                                                      ~~             ^~~
                                                                      %zu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
R_Julia.c:366:86: warning: format specifies type 'int' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
   snprintf(evalcmd, evalsize, "%s=PooledDataArray(UTF8String,Uint32,%d)" , VarName, len);
                                                                     ~~              ^~~
                                                                     %zu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
R_Julia.c:461:53: warning: format specifies type 'int' but the argument has type
      'unsigned long' [-Wformat]
    snprintf(eltcmd, eltsize, "%sdfelt%d", VarName, i + 1);
                                      ~~            ^~~~~
                                      %lu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
R_Julia.c:477:56: warning: format specifies type 'int' but the argument has type
      'unsigned long' [-Wformat]
    snprintf(eltcmd, eltsize, "%sdfelt%d=0;", VarName, i + 1);
                                      ~~               ^~~~~
                                      %lu
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
7 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src/support -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include/julia -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c dataframe.c -o dataframe.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../../src/support -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include -I"/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin"/../include/julia -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c embedding.c -o embedding.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o rjulia.so Julia_R.o R_Julia.o dataframe.o embedding.o -L/Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia -ljulia -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rjulia/libs
** R
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rjulia)
> library(rjulia)

julia_init()
> 
> julia_init()
> T <- tryCatch(julia_void_eval("using DataArrays,DataFrames"),
+                           error = function(e) e)
> T
NULL
> x <- matrix(1.01:6.01, 3,2)
> x
     [,1] [,2]
[1,] 1.01 4.01
[2,] 2.01 5.01
[3,] 3.01 6.01
> r2j(x,"tt")
> j2r('println(tt)')
[1.01 4.01
 2.01 5.01
 3.01 6.01]

Sys.info()    
                                                                                            sysname 
                                                                                           "Darwin" 
                                                                                            release 
                                                                                           "13.4.0" 
                                                                                            version 
"Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64" 
                                                                                           nodename 
                                                                      "Martins-MacBook-Pro-2.local" 
                                                                                            machine 
                                                                                           "x86_64" 
armgong commented 8 years ago

I don't have mac , but i think it should work. btw, I will develop rjulia2 in next few month,this version will use julia RCall.jl package, reduce most c code.

martinbel commented 8 years ago

Ok. Cool. Sounds promising!