Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rjulia on Windows/RStudio #16

Closed
dgromer opened this issue Jun 14, 2015 · 16 comments
Closed

rjulia on Windows/RStudio #16

dgromer opened this issue Jun 14, 2015 · 16 comments

Comments

@dgromer
Copy link
Contributor

dgromer commented Jun 14, 2015

Building rjulia on Windows 7 64-bit with R 3.2.0 and Julia 0.3.9 (using devtools::install_github("armgong/RJulia", args = "--no-multiarch") fails with the following error:

* installing *source* package 'rjulia' ...
** libs
gcc -m64 -I"C:/R/R-32~1.0/include" -DNDEBUG -I"C:\\Julia-0.3.9\\bin"/../../src -I"C:\\Julia-0.3.9\\bin"/../../src/support -I"C:\\Julia-0.3.9\\bin"/../include -I"C:\\Julia-0.3.9\\bin"/../include/julia    -I"d:/RCompile/r-compiling/local/local320/include"     -O2 -Wall  -std=gnu99 -mtune=core2 -c Julia_R.c -o Julia_R.o
In file included from C:\Julia-0.3.9\bin/../include/julia/uv.h:59:0,
                 from C:\Julia-0.3.9\bin/../include/julia/ios.h:5,
                 from C:\Julia-0.3.9\bin/../include/julia/libsupport.h:11,
                 from C:\Julia-0.3.9\bin/../include/julia/julia.h:10,
                 from Julia_R.c:11:
C:\Julia-0.3.9\bin/../include/julia/uv-win.h:241:3: error: unknown type name 'SRWLOCK'
make: *** [Julia_R.o] Error 1
Warning: Ausführung von Kommando 'make -f "Makevars" -f "C:/R/R-32~1.0/etc/x64/Makeconf" -f "C:/R/R-32~1.0/share/make/winshlib.mk" SHLIB="rjulia.dll" WIN=64 TCLBIN=64 OBJECTS="Julia_R.o R_Julia.o dataframe.o embedding.o"' ergab Status 2
ERROR: compilation failed for package 'rjulia'
* removing 'C:/R/R-3.2.0/library/rjulia'
* restoring previous 'C:/R/R-3.2.0/library/rjulia'
Error: Command failed (1)

However, after adding a Makevars.win with the contents of the Makevars plus PKG_CPPFLAGS+= -D_WIN32_WINNT=0x0600 (see JuliaLang/julia#9973) solved this problem.

Now when loading the package from within RStudio, the R session crashes. When loading rjulia in a R session in cmd.exe everything works fine. Any ideas?

@armgong
Copy link
Owner

armgong commented Jun 15, 2015

could you enable RStudio log (https://support.rstudio.com/hc/en-us/articles/200554756-RStudio-Application-Logs ) and see what happend?
recently I am not test on windows , so didn't konw SRWLOCK problem, you can create pull request, I will merge it.

@dgromer
Copy link
Contributor Author

dgromer commented Jun 15, 2015

RStudio writes neither to rdesktop.log nor rsession-USER.log upon crash. Maybe that's due to the fact that RStudio does currently not support crash reports on Windows (https://support.rstudio.com/hc/en-us/articles/200488518).

I guess I will write an issue to RStudio Support.

@armgong
Copy link
Owner

armgong commented Jun 15, 2015

tested on my PC, found these
1 SRWLOCK issue is caused by Rtools have too old winnt.h (I use msys2+mingwbuild gcc 4.9.2 which have the define)

2 julia 0.39 and rjulia crash RStudio 0.99.442 (but run ok on RStudio-0.98.1103 ). this is RStudio 0.99.442 bug, to verify this just run following code ,it will crash rsession

  dyn.load('e:/julia/64/bin/libjulia.dll')

3 julia 0.4 and rjulia run on rstudio

@armgong
Copy link
Owner

armgong commented Jun 15, 2015

to solve this problem,there two way
1 when use julia 0.39 and rjulia stay at RStudio-0.98.1103
2 when use RStudio 0.99.442 , need julia 0.4 and rjulia 0.4 branch

@armgong armgong closed this as completed Jun 15, 2015
@dgromer
Copy link
Contributor Author

dgromer commented Jun 15, 2015

RStudio 0.99.442 still crashes on my machine when using Julia 0.4 nightly build and rjulia 0.4 branch atdyn.load of libjulia.dll

@armgong
Copy link
Owner

armgong commented Jun 15, 2015

Don't load rjulia just run dyn.load('e:/julia/64/bin/libjulia.dll') on rstudio see what happens ,or try rstudio nightly build 99.591

@armgong armgong reopened this Jun 15, 2015
@dgromer
Copy link
Contributor Author

dgromer commented Jun 16, 2015

dyn.load("C:/Julia-0.4.0-dev/bin/libjulia.dll") crashes on both RStudio 0.99.442 and 0.99.591.

@armgong
Copy link
Owner

armgong commented Jun 16, 2015

on my PC both julia 0.3 and 0.4 run ok on RStudio-0.98.1103,so please stay on this version,don't use 0.99.
or somebody can summit a issue to rstudio,wait rstudio to solve it.

@armgong
Copy link
Owner

armgong commented Jun 16, 2015

btw your julia 0.4 is own build or download from julialang.org? mine is own build and it can run on rstudio 0.99.591

@dgromer
Copy link
Contributor Author

dgromer commented Jun 16, 2015

I use a 0.4 nightly build from julialang.org.

It works in RStudio 0.98.1103, so it seems to be a problem with either RStudio 0.99 or the nightly build from julialang.org. I will file an issue to RStudio.

@dgromer dgromer closed this as completed Jun 16, 2015
@armgong
Copy link
Owner

armgong commented Jun 16, 2015

thanks a lot

@yanlinlin82
Copy link

I tried to install rjulia on Windows 7 64-bit with R-3.2.0 and julia-0.3.9. The latest version fixed the SRWLOCK issue. However, I am still stuck at the final linking step.

> devtools::install_github("armgong/RJulia")
Downloading github repo armgong/RJulia@master
Installing rjulia
"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  "C:/Users/yanll/AppData/Local/Temp/RtmpsTNVnH/devtoolse8c6db6341d/armgong-RJulia-288964e"  \
  --library="C:/Users/yanll/Documents/R/win-library/3.2"  \
  --install-tests 

* installing *source* package 'rjulia' ...
** libs

*** arch - i386
gcc -m32 -I"C:/PROGRA~1/R/R-32~1.0/include" -DNDEBUG -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src/support -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include/julia -D_WIN32_WINNT=0x0600    -I"d:/RCompile/r-compiling/local/local320/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c Julia_R.c -o Julia_R.o
gcc -m32 -I"C:/PROGRA~1/R/R-32~1.0/include" -DNDEBUG -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src/support -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include/julia -D_WIN32_WINNT=0x0600    -I"d:/RCompile/r-compiling/local/local320/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c R_Julia.c -o R_Julia.o
R_Julia.c: In function 'R_Julia_MD':
R_Julia.c:120:11: warning: assignment from incompatible pointer type [enabled by default]
R_Julia.c:134:10: warning: assignment from incompatible pointer type [enabled by default]
gcc -m32 -I"C:/PROGRA~1/R/R-32~1.0/include" -DNDEBUG -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src/support -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include/julia -D_WIN32_WINNT=0x0600    -I"d:/RCompile/r-compiling/local/local320/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c dataframe.c -o dataframe.o
gcc -m32 -I"C:/PROGRA~1/R/R-32~1.0/include" -DNDEBUG -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../../src/support -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include -I"C:\\Users\\yanll\\AppData\\Local\\Julia-0.3.9\\bin"/../include/julia -D_WIN32_WINNT=0x0600    -I"d:/RCompile/r-compiling/local/local320/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c embedding.c -o embedding.o
gcc -m32 -shared -s -static-libgcc -o rjulia.dll tmp.def Julia_R.o R_Julia.o dataframe.o embedding.o -ljulia -LC:\Users\yanll\AppData\Local\Julia-0.3.9\bin -Ld:/RCompile/r-compiling/local/local320/lib/i386 -Ld:/RCompile/r-compiling/local/local320/lib -LC:/PROGRA~1/R/R-32~1.0/bin/i386 -lR
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\yanll\AppData\Local\Julia-0.3.9\bin/libjulia.dll when searching for -ljulia
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\yanll\AppData\Local\Julia-0.3.9\bin/libjulia.dll when searching for -ljulia
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ljulia
collect2: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'rjulia'
* removing 'C:/Users/yanll/Documents/R/win-library/3.2/rjulia'
Error: Command failed (1)

I installed julia-0.3.9 with the (Windows Self-Extracting Archive (.exe)) binary package from http://julialang.org/downloads/. I wonder if it is necessary to build julia from scratch.

@armgong
Copy link
Owner

armgong commented Jun 16, 2015

1 try add C:\Users\yanll\AppData\Local\Julia-0.3.9\bin to you system PATH
if 1 don't work
2 try modify Makevar.win latest line:
PKG_LIBS=-L$(libjuliapath) -ljulia

@yanlinlin82
Copy link

I had already added the directory to PATH, otherwise R won't be able to find the correct julia path. The second method does not help either.

I searched in my julia installation directory, and found that there is no any '.lib' or '.a' file. I tried also the Nightly build, but the same error exists.

Therefore, I guess it is necessary to build julia from scratch. I will try this way.

@armgong
Copy link
Owner

armgong commented Jun 17, 2015

basically dynamic link on windows don't need .lib or .a file , just need libjulia.dll. build julia from scratch will not help.

according you compile output, it is R package compile problem,normally R try to compile both 32 and 64 bit package,but your julia in system path is only 32bit or 64 bit, so need use this like @dgromer to compile rjulia

devtools::install_github("armgong/RJulia", args = "--no-multiarch")

@yanlinlin82
Copy link

Thanks! It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants