Using mcc to compile a DLL from command line?

7 Ansichten (letzte 30 Tage)
Danielle MacDonald
Danielle MacDonald am 21 Feb. 2021
Hi, I'm trying to automate the build of a DLL from matlab code that our lab uses. I'm using VS Code, Visual Studio 2019, and Windows 10, and Matlab R2020b. I have a build script that I use for my code projects in Powershell. When I attempt to run mcc from that script (so within Powershell environment) I get a weird set of errors as follows:
PS ...\lib\Matlab\src> mcc -W cpplib:blMatlab -T link:lib calibrate_zero
Warning: The environment variable 'PATH' is more than 8,000 characters long which might cause build time errors. See https://www.mathworks.com/help/matlab/matlab_env/understanding-file-locations-in-matlab.html#br5u0i7-1 for information.
Building with 'Microsoft Visual C++ 2019'.
'cl' is not recognized as an internal or external command,
operable program or batch file.
The following command:
""D:\opt\MATLAB\R2020b\bin\mbuild" -client mbuild -O -output "blMatlab" "blMatlab.cpp" DEFFILE"=""blMatlab.def""" LINKEXPORT"=""/DLL /def:\"$DEFFILE\"""" LDEXT"="".dll""" LDTYPE"="" -shared -static""" MTCMDLINE"=""mt -outputresource:$EXE;2 -manifest $MANIFEST""""
failed with error code -1.
I verified that cl is in fact on my PATH. I also tried this in the MS build Developer Powershell to make sure CL could be found, same outcome. There are not actually >8k characters on my user or sys PATH (maybe still a lot with 4k?), so is the mcc modifying it's environment and making it's PATH longer?
It took me a minute to realize it may be the shell that's the problem, so I tried to run it in normal cmd.exe and it works fine there. I'd like to know if this is a bug in the application, or is this something there is a suggested work around for? I can subshell cmd.exe and finish my build process, but it seems odd that it's failing when executed natively in Powershell.

Antworten (0)

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by