krlmlr / r-appveyor

Tools for using R with AppVeyor (https://appveyor.com)
132 stars 60 forks source link

rJava #85

Closed mattfidler closed 6 years ago

mattfidler commented 7 years ago

I am having problems using rJava on certain systems. I get errors like:

  Error: .onLoad failed in loadNamespace() for 'rJava', details:
    call: inDL(x, as.logical(local), as.logical(now), ...)
    error: unable to load shared object 'C:/Users/appveyor/AppData/Local/Temp/1/RtmpWa3KNC/RLIBS_bdc2913935/rJava/libs/i386/rJava.dll':
    LoadLibrary failure:  %1 is not a valid Win32 application.

Apparently, there are some issues using rJava on Windows anyway; See:

http://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r

Is there any information about how appveyor installs the java environment?

krlmlr commented 7 years ago

Is this a mismatch between 32-bit and 64-bit architectures? I don't have any experience with rJava, but the error looks independent of the Jave environment.

mattfidler commented 7 years ago

I'm not really sure myself, unfortunately.

On Mon, Mar 20, 2017, 5:06 PM Kirill Müller notifications@github.com wrote:

Is this a mismatch between 32-bit and 64-bit architectures? I don't have any experience with rJava, but the error looks independent of the Jave environment.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/krlmlr/r-appveyor/issues/85#issuecomment-287912989, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfa2nxbBjsB38ttCZYMwSAObJYnJcN8ks5rnvhJgaJpZM4LxCET .

rplzzz commented 7 years ago

FWIW, I am also having this issue, with more or less the same error message. From what I've been able to tell, the problem seems to be caused by running a 32-bit version of R, which does seem to be what is happening:

* using log directory 'C:/projects/iamrpt/iamrpt.Rcheck'
* using R version 3.4.1 Patched (2017-09-16 r73293)
* using platform: i386-w64-mingw32 (32-bit)

~So, it looks like we need to specify that the R version needs to be 64-bit. Setting Platform: x64 in appveyor.yml doesn't do the trick; it gets you a 64-bit host, but you still get the 32-bit version of R.~

Derp. This seems to be controlled by the R_ARCH environment variable. I'll try that and let everyone know if that does the trick.

rplzzz commented 7 years ago

Installing 64-bit R using R_ARCH did the trick. So, if you landed on this issue because you're getting this error, your fix is to add the following to appveyor.yml:

platform: x64

environment:
  R_ARCH: x64
krlmlr commented 7 years ago

@rplzzz: Thanks for looking into it. Would you like to submit a PR that adds this information to the README?

rplzzz commented 7 years ago

Sure, happy to.

MansMeg commented 6 years ago

Hi all!

I still have the same problem. I get:

Error: package or namespace load failed for 'mallet':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/appveyor/AppData/Local/Temp/1/RtmpgdOTOJ/RLIBS_89876f6184f/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

With both

* using log directory 'C:/projects/rmallet/mallet.Rcheck'
* using R version 3.4.3 Patched (2018-03-02 r74345)
* using platform: i386-w64-mingw32 (32-bit)

and

* using log directory 'C:/projects/rmallet/mallet.Rcheck'
* using R version 3.4.3 Patched (2018-03-02 r74345)
* using platform: x86_64-w64-mingw32 (64-bit)

Here is the appveyor run: https://ci.appveyor.com/project/MansMeg/rmallet

And the codebase/appveyor file: https://github.com/MansMeg/RMallet

krlmlr commented 6 years ago

@MansMeg: The error for x64 in the artifacts of your most recent AppVeyor build looks different from the i386 error.

MansMeg commented 6 years ago

@krlmlr Yes. It does. I can't really what is the problem?

krlmlr commented 6 years ago

Maybe rJava doesn't work on i386? The x64 builds looked better to me -- not like a failure to install rJava but a different problem.