Problem compiling mex file in Matlab Coder. "'bin' is not recognized as an internal or external command, operable program or batch file."

Even when attempting to compile the trivial function:
function r = testCoder(x1,x2)
r = x1 + x2;
end
I am unable to compile functions to mex files in the MATLAB Coder. I have no trouble when compiling to C/C++ Static Library.
I get the error:
??? Build error: Compilation returned error status code 255. See the target build log in the report for further details.
and the report states:
'bin' is not recognized as an internal or external command, operable program or batch file.
I am using 2012b (32-bit) and have already run mex -setup and selected "Lcc-win32 C 2.4.1" as my compiler.

10 Comments

What does your compilation line look like? Your mcc or mex line? What does the rest of the error (the part you omitted) look like? Post all it reports, don't just cut out a small part.
The build dialog says:
>> coder -build test.prj
Warning: The specified compiler (lcc) does not support the OpenMP library; turning off parallelization.
??? Build error: Compilation returned error status code 255. See the target build log in the report for further details.
Error in ==> testCoder Line: 1 Column: 1
Code generation failed: Open error report.
When I open the error report, the build log says:
1 'bin' is not recognized as an internal or external command,
2 operable program or batch file.
There is no other text there than I omitted.
Not sure what you mean by my mcc or mex line. I am using the 'coder' command which opens a dialog from which I attempt to build a mex.
Could you also tell me from where you are trying to compile (directory of the m file)?
Could you try generating code using the following syntax:
codegen testCoder -args {2,3}
You could paste the error message if generated using the command line syntax too.
Thanks Lokesh,
I had the project file, test.prj, in the same folder as testCoder. That folder was my current working folder in MATLAB. The Paths tab in the Project Settings dialogue has the following options selected:
Working folder: Project folder
Build folder: A subfolder of the project folder
Search paths: <empty>
Running the code you provided yields:
>> codegen testCoder -args {2,3}
Warning: The specified compiler (lcc) does not support
the OpenMP library; turning off parallelization.
??? Build error: Compilation returned error status code 255. See the target build log in the report for further details.
Error in ==> testCoder Line: 1 Column: 1
Code generation failed: Open error report.
Error using codegen
Opening the error report yields the same 'bin' not recognized command mentioned before.
Hi John,
Can you provide the full path to the folder for your MATLAB installation, and for the folder containing your test MATLAB program?
An initial guess is that spaces or other funny punctuation in the path may be causing this problem.
Thanks,
Fred
MATLAB installation: C:\Program Files\MATLAB\R2012b
Working folder: C:\MATLAB_FILES\MEX_TEST\
Test Program: C:\MATLAB_FILES\MEX_TEST\testCoder.m
The working folder and the test program look to be good. Can you make sure there are not files named testCoder in the path by using
which -all testCoder
Make sure your path is not corrupted. Mex a sample file yprime.c, found in your matlabroot/extern/examples/mex/ folder.
This will check if there is a compiler issue.
Only seems to be one testCoder in the path:
>> which -all testCoder
C:\MATLAB_FILES\MEX_TEST\testCoder.m
mex yprime.c works fine and the resulting yprime.mex32 works as it should.
Could you see copy-paste the path of your computer? If you are unable to do so, could you check if there are weird path names.
Other things to check are the generated BAT file and Makefiles in the codegen directory. An error like this usually occurs when an unescaped space or other punctuation character is in a path. E.g.:
C:\path\to\some\ bin
could try to run bin. Also, you could check for ampersands (&) in those files and your system path like Lokesh mentioned.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Asked:

on 12 Jul 2013

Community Treasure Hunt

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

Start Hunting!