ktisha / TheRPlugin

R language plugin for IntelliJ platform.
MIT License
18 stars 6 forks source link

Does not work on MacOS with IntelliJ IDEA 2016.2 #33

Open pranasblk opened 8 years ago

pranasblk commented 8 years ago

Looks like *.so binary is not compatible with El Capitan ...

I'm not sure if it is config/plugin/IDE issue. It works from cmd:

$ /usr/local/bin/R --no-save --quiet
>

But not from R run-time configuration: Script: location to .r script Working Directory: location to .r script

/usr/local/bin/R --no-save --quiet
Error in dyn.load("/Users/pranas/Library/Application Support/IntelliJIdea2016.2/TheRPlugin/libtherplugin_device64.so") : 
  unable to load shared object '/Users/pranas/Library/Application Support/IntelliJIdea2016.2/TheRPlugin/libtherplugin_device64.so':
  dlopen(/Users/pranas/Library/Application Support/IntelliJIdea2016.2/TheRPlugin/libtherplugin_device64.so, 6): no suitable image found.  Did find:
    /Users/pranas/Library/Application Support/IntelliJIdea2016.2/TheRPlugin/libtherplugin_device64.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Execution halted

Process finished with exit code 1
sproshev commented 8 years ago

Hello! This binary could be disabled by renaming. It's responsible for graphics integration into IDEA.

HuilinChen commented 8 years ago

Hi Sproshev, I'm using Intellij Community 2016 and Mac OS X EL Capitan and I have the same error as pranasblk.

dltacube commented 8 years ago

I'm having the same issue as well. Renaming libtherplugin_device64.so allows me to run R code again.

HuilinChen commented 8 years ago

Heyoni, Does the R Graphics work properly in your intellij after renaming the file? It still doesn't work for me, though the error message is gone.

dltacube commented 8 years ago

No, graphics don't work after renaming that file.

sproshev commented 8 years ago

@HuilinChen @heyoni Graphics integration is based on this file. When plugin can't find .so-file, it disables integration.

tuabache commented 8 years ago

Maybe we need to configure /usr/local/bin/Rscript as R interpreter instead? However, the script specified in the run configuration seems not to be passed to the interpreter in my case:

/usr/local/bin/Rscript --no-save --quiet

Process finished with exit code 1

Environment: IntelliJ 2016.2.3, OS X 10.11.6, R 3.3.1.

sproshev commented 8 years ago

@tuabache The script is passed but not directly. Could you please setup environment variable as shown below (Run - Edit Configurations) and attach output?

screenshot - 09082016 - 05 33 06 pm

tuabache commented 8 years ago

@sproshev Thanks for your message. Still the same output:

/usr/local/bin/Rscript --no-save --quiet

Process finished with exit code 1

with runtime config as suggested: 2016-09-08_19-02-29

sproshev commented 8 years ago

@tuabache What do you see after running /usr/local/bin/Rscript in terminal? Any GUI?

arnauldvm commented 8 years ago

Hello, nice tool! (Well, potentially)

But I suffer from the same problem as described above. ther.debugger.io=true had no visible effect

It seems that, for some reason, the name of the script is not given as argument to Rscript:

/usr/local/bin/Rscript --no-save --quiet --args xxx
file name is missing

Process finished with exit code 1

Expected: /usr/local/bin/Rscript --no-save --quiet myscript.r --args xxx

FYI:

$ uname -a
Xxxxx Xxxxx.local 14.5.0 Darwin Kernel Version 14.5.0: Mon Aug 29 21:14:16 PDT 2016; root:xnu-2782.50.6~1/RELEASE_X86_64 x86_64
$ grep -A1 CFBundleGetInfoString ~/Applications/IntelliJ\ IDEA\ CE.app/Contents/Info.plist
    <key>CFBundleGetInfoString</key>
    <string>IntelliJ IDEA 2016.2.4, build IC-162.2032.8. Copyright JetBrains s.r.o., (c) 2000-2016</string>
$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
$ Rscript -e "R.version.string"
[1] "R version 3.3.1 (2016-06-21)"
tuabache commented 8 years ago

@sproshev There's no GUI coming up when running /usr/local/bin/Rscript in terminal; here's the output (as I'd expect):

$ /usr/local/bin/Rscript
Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args]

--options accepted are
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=list
                      Where 'list' is a comma-separated set
                        of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

'file' may contain spaces but not shell metacharacters
Expressions (one or more '-e <expr>') may be used *instead* of 'file'
See also  ?Rscript  from within R
aristotll commented 7 years ago

same problem ...

ottbot commented 7 years ago

Any idea where is the source is for these libraries? The binaries are checked into the repo, where did they come from?

sproshev commented 7 years ago

@ottbot Here is the source https://github.com/sproshev/TheRPlugin_Device

steinmb commented 7 years ago

Same problem here - PhpStorm2016.3 and MacOS 10.12.2 - R installed with homebrew.

Error in dyn.load("/Users/steinmb/Library/Application Support/PhpStorm2016.3/TheRPlugin/libtherplugin_device64.so") : 
  unable to load shared object '/Users/steinmb/Library/Application Support/PhpStorm2016.3/TheRPlugin/libtherplugin_device64.so':
  dlopen(/Users/steinmb/Library/Application Support/PhpStorm2016.3/TheRPlugin/libtherplugin_device64.so, 6): no suitable image found.  Did find:
    /Users/steinmb/Library/Application Support/PhpStorm2016.3/TheRPlugin/libtherplugin_device64.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Execution halted

If I try to use Rscript as runner the R script files is not passed as argument.

holgerbrandl commented 7 years ago

@sproshev

  1. Would you mind if I import the code from https://github.com/sproshev/TheRPlugin_Device into the codbase of https://github.com/holgerbrandl/r4intellij. There is no license in your code at the moment, so I'm not sure about how I could use it

  2. Could you provide some hints how to build it? I've tried on MacOS but struggled. Maybebecuase TheRPlugin_Device/cmake/modules/FindR.cmakedoes not contain configuration branch for MacOS? But even when adding

    elseif (APPLE)
    set(R_INCLUDE_DIRS "/Library/Frameworks/R.framework/Versions/3.3_devel/Resources/include/") # Default include directory
    
    set(R_64_LIBRARIES R_64_LIBRARIES-NOTFOUND)
    set(R_32_LIBRARIES R_32_LIBRARIES-NOTFOUND)
    
    if (R_BIT EQUAL 64)
        find_library(R_64_LIBRARIES NAMES R HINTS "/Library/Frameworks/R.framework/Versions/Current/Resources/lib") # Default lib directory
    elseif (R_BIT EQUAL 32)
        find_library(R_32_LIBRARIES NAMES R HINTS "/Library/Frameworks/R.framework/Versions/Current/Resources/lib") # Default lib directory
    endif ()
    endif ()

    make dies with the error

    [  8%] Building CXX object CMakeFiles/therplugin_device64.dir/Evaluator.cpp.o
    In file included from /Users/brandl/Desktop/TheRPlugin_Device/Evaluator.cpp:2:
    In file included from /Users/brandl/Desktop/TheRPlugin_Device/Evaluator.h:6:
    /Users/brandl/Desktop/TheRPlugin_Device/ScopeProtector.h:6:10: fatal error: 'Rinternals.h' file not found
    #include <Rinternals.h>
         ^
    1 error generated.
    make[2]: *** [CMakeFiles/therplugin_device64.dir/Evaluator.cpp.o] Error 1
    make[1]: *** [CMakeFiles/therplugin_device64.dir/all] Error 2
    make: *** [all] Error 2

Any help would be highly appreciated.

sproshev commented 7 years ago

@holgerbrandl

  1. Feel free to use it in the same way as this plugin :)

  2. I was reading this CMakeLists.txt and all its dependecies while writing TheRPlugin_Device/cmake/modules/FindR.cmake and TheRPlugin_Device/CMakeLists.txt. It's better to check how RStudio developers setup their environment for MacOS.