Running Linux executables in R using WSL - r

I have exhaustively tried to get the program to compile properly on Windows, but it has been a futile struggle. However, Linux seems to handle it just fine. Using Ubuntu on WSL and running make, I get an executable which I can run in bash with ./. I would like to use this and call it in R, though I am not sure if this is possible. I can do this using a Windows executable by doing system(), however, this does not seem to translate to a Linux executable. Is there a proper way to call a Linux executable inside an R script?

To run a Linux binary in WSL from the Windows environment, use the wsl commandline utility. In R, that would look like
system2("wsl", "your_binary --arg1 --arg2 ...")

Related

Bad EXE format when running an .exe with wine64 [duplicate]

I'm trying to generate an executable from Linux for Windows using pyinstaller.
pyinstaller --onefile --windowed montecarlo.py
I run this command and get a single executable that works on Linux just fine, but if I try on Windows, it's just a simple file. Why?
I was trying to do this same thing today and ran across this answer. It pointed to the FAQ, which says cross-compiling is not supported. It recommends using Wine.

How to use windows subsystem for linux with z shell, instead of bash, in Rstudio?

I'm using wsl with zsh as my default shell. however, in windows Rstudio I only have access to PowerShell, CMD, and bash in the terminal settings. How can I add zsh to these options? I know that it is possible to use custom shells as terminal in Mac and Linux Rstudio but I'd like to have the same feature in windows rstudio.
You can define any preferred default shell for your WSL environment have a look here on a valid method - https://medium.com/#vinhp/set-and-use-zsh-as-default-shell-in-wsl-on-windows-10-the-right-way-4f30ed9592dc and after that, if you have WSL (properly) installed, you should be able to select Bash (WSL) as your default Terminal.
After having done some testing ie trying all sorts of workarounds on the zsh of my WSL2 I have come to the conclusion that based on this: https://support.rstudio.com/hc/en-us/articles/115010737148-Using-the-RStudio-Terminal?version=1.2.5033&mode=desktop#lifetime
[x] Custom shell via path to executable ==> is NOT available for Windows IDE (written at the beginning of Appendix A)
Judging by that - on WIN RStudio Desktop 1.2.5033 - imho you can only start it via issuing zsh as the first command in your WSL bash terminal.

RStudio not reading system variables when started via launcher

I'm having a few problems with system environment variables with RStudio. In ~/.bashrc some custom environment variables are set which I want to access in my program using Sys.getenv().
When I'm calling Rstudio from the command line, this works fine. However, when I'm using the Ubuntu launch function (Alt+F2) to start RStudio, my environment variables are not found. For portability, I would kind of prefer for this to work, too...
Can someone help?
You need to find Rstudio's desktop launcher. In Ubuntu, launchers are simple text files with the extension .desktop. You can read more about the file format here. The most common locations for these are /home/user/.local/share/applications (user-specific) and /usr/local/share/applications (system-wide). The easiest way to edit these files is to use an app called menulibre.
You can install menulibre by running the following command in the terminal:
sudo apt-get update && sudo apt-get install menulibre
You can then use menulibre to find and edit the Rstudio launcher.
I have just tried using Sys.getenv() on my Rstudio installation, and it works fine. My Rstudio launcher command is /usr/lib/rstudio/bin/rstudio %F
Edit: I am running Rstudio Version 0.99.491

Sqlite3 will not execute in Cygwin

I just downloaded the Sqlite3 command line shell for windows (http://www.sqlite.org/download.html). However when I try to run the executable in Cygwin it does not load and just hangs.
The Sqlite3 shell itself works as if I browse to it in Windows explorer it runs or if I open it in cmd it runs. How do I get it to work with Cygwin?
Cygwin currently doesn't work well with interactive native programs. It has to do with the way the Cygwin terminal code works, in order to provide expected POSIX semantics to Cygwin programs.
Therefore, your best bet is to use Cygwin's own SQLite package.
If you absolutely must use the native sqlite3.exe, you'll have use cmd.exe to run sqlite3.

Google Closure Compiler shell script in Mac OS

On my PC I'm using this bat script to compile my JavaScript project:
https://github.com/ChristianDen/fx.js/blob/master/build/compile.bat
And it works great!
Now, I want to run that on Mac using Terminal.
So far, I've renamed the script with an .sh extensions and made sure Java is installed.
I don't have a lot of Mac experience, but it won't run.
Have you any experience with this?

Resources