MATLAB compilation - matlab

I'm try to compile a matlab project on RHEL 7.6,
Whene I try to run the follow command:
mcc -m SliceViewerMain.m -a <PATH>/*.fig -a <PATH>/*.bmp -a <PATH>/*.m
I get this error:
Error: You specified the file "<PATH>/pause_e.bmp" without using the "-a" option.
Is anyone know why I get that?

You don't specify, but I suspect you're using mcc at the shell command-prompt, rather than in MATLAB? In which case, the shell is expanding the * wildcard before mcc gets to see it, so it's as if you said:
$ mcc ... -a <PATH>/pause_a.bmp <PATH>/pause_b.bmp <PATH>/pause_c.bmp ...
The fix is either run the command inside MATLAB, or hide the wildcard expansion from the shell and let mcc expand by doing
$ mcc ... -a '<PATH>/*.fig' ...
I.e. use single quotes.

Related

Where to find mcr_root on macOS to run compiled MATLAB program?

I'm trying to build a standalone executable for a MATLAB function on macOS 11.1. I'm using MATLAB_R2019a.
Compile the function cli.m and write to build-binary
mcc -m -R -singleCompThread -R -nodisplay -R -nojvm cli.m -d build-binary
Try running ./build-binary/run_cli.sh and get the following error
Usage:
./run_cli.sh <deployedMCRroot> args
I installed the MATLAB runtime by downloading it from here and running
./install -mode silent -agreeToLicense yes
But I have no idea where it installed to or what to pass into <deployedMCRroot>
Thanks for any help.

Powershell - Run SCP command using CYGWIN but also expand variables

I need to expand variables before running the SCP command as a result I can't use single quote. If I run the script using double quotes in Powershell ISE it works fine.
But doesn't work if I run the script through command prompt.
I'm using zabbix to run the script which calls the script as [cmd /C "powershell -NoProfile -ExecutionPolicy Bypass -File .\myscript.ps1"]
Here is the code that needs to run SCP using Cygwin bash.
if ((test-path "$zipFile"))
{
C:\cygwin\bin\bash.exe -l "set -x; scp /cygdrive/e/logs/$foldername/dir1/$foldername.zip root#10.10.10.10:~/"
}
Output:
/usr/bin/bash: set -x; /cygdrive/e/logs/myfolder/dir1/server.zip root#10.10.10.10:~/: No such file or directory
If I run the same command above in Cygwin manually it works.
I even tried to use bash -l -c but then the SSH session is stuck maybe because the root#10.10.10.10 becomes $1 according to the documentation.
Documentation link
-c If the -c option is present, then commands are read from
the first non-option argument command_string. If there are
arguments after the command_string, the first argument is
assigned to $0 and any remaining arguments are assigned to
the positional parameters. The assignment to $0 sets the
name of the shell, which is used in warning and error
messages.
Figured it out. It was halting when using bash -c was due to StrictHostKeyChecking, the known hosts thing (where you get a prompt to type yes/no). I set the -v switch to SCP and it showed me the Debug logs where it was halting.
Had to set scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null options.
The complete line now looks like the following:
c:\$cygwin_folder\bin\bash.exe -c ("/usr/bin/scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -v -i /cygdrive/c/cygwin/home/myuser/.ssh/id_rsa /cygdrive/e/logs/$foldername/dir1/$foldername.zip root#10.10.10.10:~/")

Why is "-H" command not found?

I have a strange error with linux somehow interpreting sudo -H as two separate commands.
I'm on Cent OS 7, and I get the following:
/var/tmp/<random string>: line 8: -H: command not found
This is very vexing to me. Why would it not know this uption of sudo?
My guess would be that you have an alias or bash function that is suppressing your call to sudo. Try running the command with the full pathname for sudo (/usr/bin/sudo) on both systems, and type type sudo to see if there is an alias or bash function that is being called instead of the executable.
If there is, check the usual places like ~/.bashrc for where it is being defined so you can remove it.
Alternatively, it could be unrelated to sudo, and instead be related to whatever script you are calling with sudo.

Missing 'libexpat-1_.dll' error for executable made with pp

I made exe file with pp using Strawberry Perl, but when I run it on another machine, I get following error:
The program can't start because libexpat-1__.dll is missing from your computer. Try reinstalling the program to fix this problem.
I make the executable with this command:
pp -M FindBin -M DateTime -M DateTime::Format::JSON::MicrosoftDateFormat -M DateTime::Format::DateParse -M REST::Client -M JSON::XS -M Spreadsheet::ParseExcel -M Spreadsheet::ParseXLSX -M Log::Log4perl::Tiny -o test.exe test.pl
I tried using -a "c:\strawberry\c\bin\libexpat-1_.dll" (didn't help) and -l "c:\strawberry\c\bin\libexpat-1_.dll" ("Can't find shared library.." error).
How can I resolve this issue?
I had a typo in DLL name. Using -l option resolved issue. Specifying modules in the command wasn't necessary, as pp scans script for the used modules, and includes them automatically. Built it with:
pp -l "libexpat-1__.dll" -o test.exe test.pl

Perl Returning error for ls -l command

I am running a perl script from Nagios to check some files for certain characteristics on a windows machine. When I run the script from Nagios it responds with a result of:
UNKNOWN ERROR - execution of LANG=C ls -l resulted in an error 32512 -
My Code is from this GitHub with a single modification of line 168 so I can use it with windows:
use lib 'C$\Progra~1\Nagios\NRDS_Win\plugins';
The odd thing is the program actually outputs the expected result from the command line on the windows machine.
Here is the command:
check_files.pl -D c:\logs -F Health.log -a '~,300'
Here is an example:
CRITICAL - Health.log is 10703 (more than 300) seconds old - 1
Health.log files found
I modified line that defined LANG=C ls -l in the code but now i just get:
UNKNOWN ERROR - could not execute ls -l - No such file or directory
ls is unix command and by default there is no such command in windows.
If you need it, you can install it e.g. from GNU CoreUtils
You also need to change shell command on line 639 from LANG=C ls -l to just ls -l because in windows you can't set environment variables like that.