Matlab Coder: Build Failed: The system cannot find the path specified.

I am attempting to build a very basic MEX file from an existing m-file to test the Matlab to C functionality.
I have been unable to move beyond this error.
Originally I presumed the system could not find the path specified because the Matlab files were in a folder structure that contained spaces in the folder names.
To kill 2 birds I downloaded the updated, current version of Matlab and installed Matlab in a directory structure containing no spaces in the folder names.
Much to my dismay, I have attempted the MEX file generation and am still receiving exactly the same error.
The most troubling aspect is that Matlab does not tell me EXACTLY which path it cannot find.
Also, I have manually double-checked that the folder paths in the target build log do exist.
Any assistance would be greatly appreciated! Thank you in advance!
The Matlab Coder output is below as well as the code generation report:
Coder Output: ??? Build error: Compilation returned error status code 2. See the target build log in the report for further details.
Error in ==> ComputeDistanceObjectNOW Line: 1 Column: 1 Code generation failed: Open error report.
Report: (Target Build Log)
1 lcc -c -I"C:\MATLAB\R2012a\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -DMX_COMPAT_32 -DNDEBUG -I"C:\MATLAB\R2012a\extern\include" -I"C:\MATLAB\R2012a\simulink\include" -I"C:\MATLAB\R2012a\toolbox\shared\simtargets" -I"C:\MatlabCcode\codegen\mex\ComputeDistanceObjectNOW" -I"C:\MatlabCcode" "ComputeDistanceObjectNOW_initialize.c"
2 The system cannot find the path specified.
3 gmake: *** [ComputeDistanceObjectNOW_initialize.obj] Error 1

10 Comments

You are using 32-bit MATLAB correct? Did you run "mex -setup" to choose lcc? I wonder if you could try with Visual Studio?
FYI: I removed "MATLAB Compiler" from the Products and tags categories for your question, because it is a separate product that seems to have nothing to do with this issue.
Hello Kaustubha--thank you for your assistance!
Yes, I am using 32-bit MATLAB, and yes, I ran "mex -setup" and already chose lcc... it was the only option for my system.
I am very new to the coding world outside of MATLAB, so I'm afraid I don't have any knowledge about Visual Studio. What do you recommend specifically? (feel free to point me to a website, I don't want you to have to write too much!) :o)
Thank you again for your continued help!
Are you able to generate code from the one of the demos? For example, see this page.
Btw, could you check your system PATH variable and see if there is an & character anywhere?
Thank you for your continued help Kaustubha.
I hope to try the demos soon... that was also the next step I was planning to take, but just haven't had time yet.
I took a look at the Matlab "path" variable and I removed the directory for my user/Matlab folder, but otherwise, every other folder was somewhere in a subfolder of the C:\MATLAB folder and none of those folders contain an "&" character. Once again, I still had an error after removing the one folder, just in case the "^" character in my user folder was causing issues.
I will be busy for a few days, but hope to try the demos soon.
Thank you again for your help!
T-squared: I meant for you to check the system PATH variable, not the MATLAB path variable. Could you examine that for ampersands also please? You can run "getenv PATH" to get its value in MATLAB.
Kaustubha, thank you for the clarification, I was not aware of the difference in the two paths previously.
I did not find any ampersands in the system PATH variable.
Below is the output from "getenv PATH":
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\texmf\miktex\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\MATLAB\R2012a\runtime\win32;C:\MATLAB\R2012a\bin;C:\Program Files\MATLAB\R2011b\runtime\win32;C:\Program Files\MATLAB\R2011b\bin;C:\Program Files\MATLAB\R2008b\bin;C:\Program Files\MATLAB\R2008b\bin\win32;C:\Program Files\Common Files\Adobe\AGL;OIT_LI~1\F-Secure\Ssh;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\MIT\Kerberos\bin;C:\Program Files\OpenAFS\Common;C:\Program Files\OpenAFS\Client\Program;C:\Program Files\QuickTime\QTSystem\
Kaustubha,
Again, thank you for continuing to help me with this issue. I really appreciate your help.
I attempted to run the demo code that you linked to in one of your previous posts. I received the same error ("The system cannot find the path specified.") when I ran the "codegen run_balls -args 0" portion of the example code.
I don't believe I am doing anything wrong, so any advice or recommendation you have about how I should proceed would be greatly appreciated. Thank you!
I have also now tried downloading Windows SDK to use that compiler and I am still receiving the same error.
I am beginning to think my Windows user name may be causing issues...? User name is "T^2".
Could the "^" symbol be causing issues behind the scenes? I have never had any problem with my user name in the past, with any other program...

Sign in to comment.

 Accepted Answer

T-squared
T-squared on 16 Aug 2012
Edited: T-squared on 16 Aug 2012
Kaustubha,
Thank you for all your help.
I am now able to generate mex files using Matlab Coder. (I tested functionality on your hyperlinked example)
I have changed several things since I first asked this question, so I will update that info below.
I believe the most important change was that I performed a clean installation of my operating system and this time elected to create a Windows user name with NO special characters. (I had used a "^" character in my original user name)
Thank you again for your help.
Things I changed: *I upgraded (clean-install) my operating system from 32bit Vista Home Basic to 64bit Windows 7 Ultimate. *I made sure my Windows account user name contained no special characters (including spaces, presumably important also) *I installed MATLAB into a folder structure that contained no spaces (e.g., C:\MATLAB)
Again, I believe the most important change was to the Windows user name. I believe MATLAB Coder may have been attempting to call a file (mex options file) in the AppData folder of my user directory, which is where I believe the trouble was introduced.
See the first two topics linked under this Mathworks article for Mathworks' similar description of this problem.

1 Comment

Glad you were able to troubleshoot and resolve the issue, T-squared. Thanks so much for posting your findings - I'm sure someone else will come along in the future and benefit from your answer. :)

Sign in to comment.

More Answers (1)

T-squared: I'm quite stumped at this point. There might be a variety of reasons, so I would recommend contacting MathWorks Technical Support.

Categories

Products

Community Treasure Hunt

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

Start Hunting!