Can MATLAB run a Linux binary by Lima VM on MacOs ?

4 Ansichten (letzte 30 Tage)
Nicola Petacco
Nicola Petacco am 13 Sep. 2023
Beantwortet: Kshittiz am 27 Sep. 2023
I should run a Linux binary on MacOS. To do it, I installed Lima Virtual Machine (LINK). Now, I can run lima from the terminal (switching to the Linux OS) and than execute the binary with the following lines:
lima % to run the Virtual Machine
./Hydro % to execute the Linux binary
I would like the same with MATLAB. I wrote the following line in the command window:
[~,b] = system('lima ./Hydro')
but the following error occurs:
b =
'/bin/bash: lima: command not found
'
I know that a similar procedure (launch a VM from Matlab and then run a Linux binary is possible on Window OS, the VM is 'wsl').
Can you help me? Or can you give hint or suggestions?
Thanks

Antworten (1)

Kshittiz
Kshittiz am 27 Sep. 2023
Hi Nicola,
I understand that you want to run a Linux binary by Lima Virtual Machine on MacOS and you are facing issues while executing it in MATLAB.
It seems like the issue you are encountering is related to MATLAB not recognizing the lima command. This might be because lima is not in the system's PATH when MATLAB is running.
You can try the following workarounds to fix this issue:
  1. Instead of just using 'lima', provide the full path to the lima executable.
  2. You can modify MATLAB's PATH environment variable to include the directory containing lima. You can do this using the ‘setenv’ function in MATLAB. Please make sure to restart MATLAB after modifying the PATH.
To learn more about the ‘setenv’ function, please refer to the following documentation: https://in.mathworks.com/help/matlab/ref/setenv.html
I hope this will help you in fixing the issue.
Regards,
Kshittiz

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by