this is the session of building exe file in matlab 7.1.
I think I have a problem with the compiler.
mbuild -setup
Please choose your compiler for building standalone MATLAB
applications: Would you like mbuild to locate installed compilers
[y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
*****************************************************************************
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit binaries,
Microsoft Visual C++ 2008 Express Edition requires that these two
packages be properly installed.
*****************************************************************************
Trying to update options file: C:\Users\****\AppData\Roaming\MathWorks\MATLAB\R2010a\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mbuildopts\msvc90freecompp.bat
Done . . .
>> mcc -m mainmain.m -o mainmain
Could not find the compiler "cl" on the DOS path.
Use mbuild -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Unable to locate compiler.
Error: An error occurred while shelling out to mbuild (error code = 2).
Unable to build executable (specify the -v option for more information).
??? Error using ==> mcc
Error executing mcc, return status = 1 (0x1).
if the problem is with the compiler, how can I install another compiler?
I have windows 7 (64 bits) and I want that the exe file will work on windows operating system.
This is probably the result of one of two issues.
1) You don't have the Windows SDK installed (as indicated in the error message). According to this MathWorks page regarding supported compilers
Both Microsoft Visual Studio 2008 and Windows Software Development Kit (SDK) 6.1 must be installed. When installing Microsoft Visual Studio, you must choose "X64 Compilers and Tools" when installing Microsoft Visual Studio; this is not selected by default.
Now, keep in mind, this reference is for the most recent release of MATLAB, but I'm betting that this information is still relevant to your issue.
You can download the SDK here.
2) It's also possible that the compiler that you're using simply isn't supported for your release of MATLAB. See here for info on supported compilers for MATLAB 7.1.
Related
This question already has answers here:
matlab compiler installation problems
(2 answers)
Closed 7 years ago.
i try to use SPArse Modeling Software [ Version: 2.5,matlab interface ], it need to compiler first.so i run the compiler.m in MATLAB 2012b .but it goes wrong.
Here is the log
>> compile
Warning: Directory already exists.
> In compile at 144
compilation of: -I./linalg/ -I./decomp/ -I./prox/ -I./dictLearn/ dictLearn/mex/mexArchetypalAnalysis.cpp
Error: Could not find the compiler "g++-4" on the DOS path.
Use mex -setup to configure your environment properly.
D:\PROGRA~2\MATLAB\R2012B\BIN\MEX.PL: Error: Unable to locate compiler.
Error using mex (line 206)
Unable to complete successfully.
Error in compile (line 440)
mex(args{:});
I guess the problem is the MATLAB 2012b mismatching the compiler in PC.
And I try to use visual studio 2013 as my the default C compiler for MATLAB 2012b.
when i using the mex -setup command.
only two choice as follow ,and do not see the visual studio 2013 compiler.
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
I know MATLAB 2014b can use visual studio 2013 C compiler.
But how the lower version MATLAB to use high edition visual studio C compiler.
Someone else encountered this problem ?
My OS is windows 7 X64 , visual studio 2013 PRO, MATLAB 2012b.
I reference this ,but seems did't work.
Using Visual Studio 2013's C compiler for MATLAB
The compiler you are trying to use is not supported by your matlab version, you have to use one of the supported compilers.
I have a problem with my r2013a Matlab.
I want to protect a model using Simulink.ModelReference.protect('test') command. For this
I have to configure my compiler. I'm using the mex -setup command, and the xpcsetCC -setup command.
At first, Matlab says that is all ok with the compiler, but when i try to execute the Simulink.ModelReference.protect('model') command it shows an erro saying that there is no compiler avaiable.
Here are the sequences of commands:
PART 1 - 'mex -setup'
INPUT
mex -setup
OUTPUT
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n?
INPUT
y
OUTPUT
Select a compiler:
[1] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker) in C:\Program Files (x86)\Intel\ComposerXE-2011\
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) in C:\Program Files (x86)\Intel\ComposerXE-2011
[3] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[4] Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler:
INPUT
4
OUTPUT
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?
INPUT
y
OUTPUT
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 require
that Microsoft Visual Studio 2010 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\Guilherme\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2013a\bin\win64\mexopts\msvc100opts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
PART 2 - 'xpcsetCC -setup'
INPUT
xpcsetCC -setup
OUTPUT
Select your compiler for xPC Target.
[1] Microsoft Visual C++ Compilers 2010 Professional in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler:
INPUT
1
OUTPUT
Verify your selection:
Compiler: Microsoft Visual C++ Compilers 2010 Professional
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?Y
Done...
Until now everthing is ok, but next there is an error:
Part 3 - Simulink.ModelReference.protect('test')
INPUT
Simulink.ModelReference.protect('test')
OUTPUT
### Model reference SIM target (test_msp.mexw64) for model test is out of date because test_msp.mexw64 does not exist.
### Updating model reference SIM target for model: test
Warning: The model 'test' does not have continuous states, hence Simulink is using the solver 'VariableStepDiscrete' instead of solver 'ode45'.
You can disable this diagnostic by explicitly specifying a discrete solver in the solver tab of the Configuration Parameters dialog, or by
setting the 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics tab of the Configuration Parameters dialog
Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal to or less than this value. You can disable
this diagnostic by setting 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics page of the configuration parameters
dialog
### Build procedure for model: 'test' aborted due to an error.
Error using Creator.protect (line 287)
An installed compiler was not detected. Certain simulation modes, as well as host-based coder builds require that a compiler be installed. Please
install one of the supported compilers for this release as listed at:
http://www.mathworks.com/support/compilers/R2013a/win64.html
MATLAB must be restarted after the compiler is installed.
Error in C:\Program Files\MATLAB\R2013a\toolbox\simulink\simulink\+Simulink\+ModelReference\protect.p>protect (line 74)
[harnessHandle, neededVars] = protectedModelCreator.protect(varargin{:});
I've already tried all different choices of available compilers. I also tried to choose no for the fist question of mex -setup ("Would you like mex to locate installed compilers [y]/n?") and choose the compiler manually. None of this worked.
I am using Eclipse Juno parallel version. I have installed
cuda plugin. But while building a sample cuda helloworld
program I am getting error -
make all
make: *** No rule to make target `exe_cuda', needed by `all'. Stop.
******Makefile snapshot**************
all: exe_cuda
# Tool invocations
#echo 'No tool found that can build the extension specified with the build
artifact name $#'
# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS) exe_cuda
-#echo ' '
Any suggestion......
I agree that the toolchain does not appear to be set up properly for C projects.
My suggestions are:
Create a C++ project instead. That seems to work.
Use Nsight Eclipse Edition instead. It is installed automatically with the linux CUDA 5 package (just type nsight from a terminal window).
You could report the problem to fixstars corporation, the developer of that cuda plugin. It seems they have not updated it since 2011, so I don't know if it's actively maintained. But the help page is here which includes a link for a mailing list you could use.
say, if choose mexopts.sh as the configuration files for mex,
then how does mex decide which option listed in the mexopts.sh is used for compiling?
for example, using 32bit matlab on 64bit mac os x:
mexopts.sh looks like:
,,maci
........
,,maci64
......
Then, maci or maci64 is used when compiling?
What commands or way can I do in order to compile 32bit lib instead of 64bit lib?
Further explanation of my process and the error message I got :
I am using mac os x 10.8 (64bit) with matlab R2010a (32bit) to produce a binary mex-file.
The Xcode is 4.6 version, I installed Command Line Tools on my machine. Then I downloaded the patch from matlab for 2011 and 2012 version anyway. (if I don't install the patch, I got a lot of link errors saying some header files are missing).
After I installed the patch ( I believe it changes my mexopts.sh file), when I run mex a.cpp, I got error message saying that /Applications/MATLAB_R2010a.app/bin/maci64 cannot be found. Of course, it cannot find the maci64 folder, it is 32bit, there is only maci folder.
So Anyone knows what I should do in order to make matlab look for maci folder instead of maci64 folder? Thanks a lot!
MATLAB does not support cross compilation of MEX files. So your 32-bit MATLAB installation should be producing 32-bit MEX files even though the OS is 64-bit.
Also, from the article I've linked
Further, beginning with R2010b, a 32-bit version of MATLAB is no longer produced for the Mac.
If you're running R2010b or later, your MATLAB is not 32-bit anyway.
To see what switches the MEX script is invoking the compiler with, use the -v option.
You can also use the file tool to check whether the generated binary is 32 or 64-bit.
As its been explained, MATLAB produces MEX files of the same bit-ness as itself, not that of the OS. This is true at least on Windows with recent MATLAB versions, where you can have either 32-bit or 64-bit MATLAB running on 64-bit Windows. Other platforms are moving towards 64-bit versions only.
Here is another way to get the configured mex switches:
>> cc = mex.getCompilerConfigurations
>> cc.Details
In my case I get:
>> cc = mex.getCompilerConfigurations
cc =
CompilerConfiguration with properties:
Name: 'Microsoft Visual C++ 2010'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '10.0'
Location: 'C:\Program Files\Microsoft Visual Studio 10.0'
Details: [1x1 mex.CompilerConfigurationDetails]
LinkerName: 'Microsoft Visual C++ 2010'
LinkerVersion: '10.0'
>> cc.Details
ans =
CompilerConfigurationDetails with properties:
CompilerExecutable: 'cl'
CompilerFlags: [1x115 char]
OptimizationFlags: '/O2 /Oy- /DNDEBUG'
DebugFlags: '/Z7'
LinkerExecutable: 'link'
LinkerFlags: [1x327 char]
LinkerOptimizationFlags: ''
LinkerDebugFlags: '/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"'
To answer my own question, just for those who may be interested in it,
I checked the contents of mexopts.sh and modified the part for maci (specifically set ARCH=i386) , then compile. The error message is gone.
I intend to work with OpenCV 1.1 version and Matlab2011 together. The program uses call to load library. However, it returns an error
> In loadlibrary at 347
In Untitled at 4
Error using loadlibrary (line 421)
There was an error loading the library "C:\Program Files
(x86)\OpenCV1.1\bin\cxcore110.dll"
C:\Program Files (x86)\OpenCV1.1\bin\cxcore110.dll is not a valid
Win32 application.
I have tested the program in Matlab 2008 and 2010 where it gives error of a different kind I have installed x64 Compilers and Tools and my system has Visual Studio2008 and 2010 with SDK7 and 6.1. Also, on doing MEX setup I get the following options
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[2] Microsoft Visual C++ 2010 Express in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
This also returns the error
Error in ==> untitled at 5
loadlibrary(...
I am perplexed at what to do as this problem is persistently appearing. I even followed the thread in link where tit mentions that 2011 supports load library. So,why does it not work?Please help.
Applications compiled for 32bits don't mix with applications compiled for 64bits. If your OpenCV was compiled for 32bits, make sure Matlab is 32bits as well as your compilers.
BTW, seriously consider moving to a more recent version. OpenCV 1.1 is jurassic!