why does the error regarding gcc is occuring in matlab? - matlab

I have download that code from github.
Whenever that code tries to check mexopencv (a file inside lib folder). It shows an error on Matlab 2017a that is:
[error 3] please make sure gcc >= 4.4 g++ >= 4.4 is installed ...
I am having a gcc version of 8.8.0
Following is the description of system
Window 10
Visual Studio 2012
Matlab 2017a
opencv 2.4.10
mexopencv (install from your folder LIB)

You might lack of standard libraries (.dll in Windows but .lib in Linux). The code was developed under Linux (help is also only provided for Linux systems) and once tested under Windows 7.
The method was tested under OS linux lubuntu 14.04, CPU intel i5 and
16GB of RAM. This guide was written under a linux-based distribution
scope, more precisely debian. Unfortunately we lack experience to
address bugs or any problem that could emerge in non-linux OS, we will
provide only linux OS help regarding execution problems, we apologise.
we tested this code on Windows7. We successfully installed opencv
2.4.10 following this tutorial: [http://www.learnopencv.com/install-opencv3-on-windows/]
This suggests that the mex-function is also linux-based. The error should vanish if you compile the source code yourself on your system, e.g. with MinGW (also GCC), see here.
EDITED:
the README.markdown file (under LIB/mexopencv-master.zip) provides a little guide through the installation process of both, openCV and the mexopencv function for unix (including ubuntu 14.04) and Windows systems. The latter states:
Browse to mexopencv root folder, and type the following in the MATLAB
command window:
>> mexopencv.make
By default, mexopencv assumes the OpenCV library is installed in
C:\opencv. If this is not the case, specify the path as an argument:
>> mexopencv.make('opencv_path', 'c:\your\path\to\opencv')
Note that if you build OpenCV from source, this path specification
might not work out of the box. You need to replace dll files in the
OpenCV package with newly built binaries. Or, you need to modify
+mexopencv/make.m to correctly link your MEX-files with the library.
To remove existing mexopencv binaries, use the following command.
>> mexopencv.make('clean', true)
It requires a standard C++ compiler supported by Matlab (see here), any Visual Studio installation should be OK, as an open-source option MinGW is recommended. Just remember to pick the right system (usually 64-bit).

Related

How to install MinGW-w64 C/C++ compiler for use in MATLAB 2016b?

I am installing the MinGW-w64 C/C++ compiler for use in MATLAB 20176b but there is several errors for that. How can install this compiler with all the necessary adjustments to use in Matlab 2016b?
As the first way directly from Matlab:
Downloaded the MinGW-w64 C/C++ compiler for Windows from here:
https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c++-compiler
After running true Matlab and approval for installation and installing the packages, it gives an error as:
There was a problem installing the third-party software. To resolve
this issue, contact Technical Support
The second approach is to install the MinGW-w64 C/C++ compiler separately and then adjust to use in Matlab. But After installation Matlab doesn't recognize it.
The details provided on Matlab not recognizing the MinGW installation are a bit vague, but I'll take a shot at it.
When installing MinGW, the default installation directory is one with spaces in the path (Program Files). For some reason, this is not supported by Matlab (https://www.mathworks.com/help/matlab/matlab_external/compiling-c-mex-files-with-mingw.html):
Do not install MinGW in a location with spaces in the path name. For example, do not use: C:\Program Files\TDM-GCC-64
In my situation, I installed MinGW directly on the C drive. As such, my installation directory has the following layout:
C:\mingw64
C:\mingw64\bin
C:\mingw64\etc
C:\mingw64\*...
Once that is installed, all you need to do is point Matlab to the installation directory, in my case, I need to run the following command:
setenv('MW_MINGW64_LOC','C:\mingw64')
After that, you should be squared away to run the mex compilation command.

How to use mxnet on windows with matlab bindings

Can anyone tell me if it is possible to use mxnet with matlab on windows? Using the windows packaged releases from https://github.com/dmlc/mxnet/releases, there is no "matlab" directory, which I can see is present in the newer versions, which do not have windows packages.
is there a way to get the best of both worlds?
Yes, it works, even thought I doubt it has been extensively tested. Their Matlab wrapping assumes the library lies in the lib directory, which is inconsistent with their python wrapping that assumes it lies in the build directory. So you will either have to copy libraries or change paths in callmxnet.m. Also, the demo needs data that is currently fetched by a bash script -- not very Windows friendly but it runs flawlessly with MSYS2.
IMHO the Matlab demo is currently more a proof-of-concept than a real Matlab wrapper. It is nowhere near the python bindings.
The matlab directory is directly on the repo not as a release:
https://github.com/dmlc/mxnet/tree/master/matlab
Maybe you can compile it for windows using cygwin or msys2, On the documentation it say that it was tested for matlab version:
Matlab binding has been tested with the following version:
R2016b (9.1.0.441655) 64-bit (glnxa64)
Which is a linux version; I think that it should be posible to reproduce the instructions in the readme to make it work woth cygwin or msys2 with windows

Matlab supportpackageinstaller not presemt

I have just installed a fresh copy of elementary OS freya in my lappy and after that did an installation of matlab R2012b. First I tried using the image acquisition commands but they didn't work as the library was not there. To install I typed
supportpackageinstaller
but it gave an error
Undefined function or variable 'supportPackageInstaller'.
This is the first time I am installing matlab on linux so I don't know how to solve the problem.
copied from: http://www.mathworks.com/matlabcentral/answers/88896-how-to-install-add-on
the supportPackageInstaller is a new feature in R2013b and doesn't exist in older releases than R2013b. Which version are you using? If its not 13b you need to look up the support package on the File Exchange. Only for example Simulink Support Package for Arduino Mega 2560 Hardware (R2012a)
refer to another:
http://148.204.81.206/simulink/ug/start-support-package-installer.html#
Start Support Package Installer
You can use Support Package Installer to install support for specific third-party hardware and software products.
Support Package Installer guides you through the process of downloading and installing a support package.
To start Support Package Installer, use one of the following methods:
In a MATLABĀ® Command Window, enter targetinstaller.
In a model, select Tools > Run on Target Hardware > Install/Update Support Package.
Double-click a *.mlpkginstall file.
On the MATLAB tool strip, click Add-Ons and select Get Hardware Support Packages.

Error: Invalid MEX file, the specified module could not be found

I have compiled Mex file successfully on my laptop. But when I am running it, it says Invalid mex file 'c:\newfolder\filename.mexw32' The specified module could not be found.
System specification:
OS: windows 7
MATLAB 2010a
Microsoft Visual Studio 2008.
The same mex file is compiled and run successfully on my PC under XP SP3.
This MathWorks support link suggests two possible reasons to your problem:
You do not have all of the necessary libraries that the MEX-function is dependent upon.
You are running a MEX-file on a different version of MATLAB than it was compiled on.
Either way, to locate the source of this error it says that you need to list all dependent library files and verify their existence in the system you're trying to run the MEX file on, and also recommends the Dependecy Walker as the tool to to do that.
Do you you the mex file on another system than the one it is created on?
If so, then you need to install the Microsoft Visual C++ Redistributable on that machine.
I had this problem also when upgrading from Matlab2010a/VS2008 to Matlab2013a/VS2010.
All my environment variables were sent correctly.
A reboot fixed problems with OpenCV dlls not being found, I assume that it was still trying to link to the OpenCV dlls for VS2008 (even though I had changed the path). However still my mex file could not find libmex.dll.
When I installed Matlab2013a, I did not uninstall the old version (in case I wanted to go back).
However that was the cause of my problem.
Once I uninstalled the old version of Matlab and rebooted again, the problem was gone.
I had a similar problem. I was only linking against 1 'lib' so I simply copied that lib into the same folder as the mexw64 and it worked.
I have not poked around for the correct place to tell MATLAB to add the lib's real location to whatever path it's looking at.

How to install a compiler on Windows? (For a Matlab program)

I have downloaded this code;
http://www.cs.sfu.ca/%7Emori/research/superpixels/superpixels64.tar.gz
In the readme file, it says;
Run mex -largeArrayDims on *.c in yu_imncut directory
-largeArrayDims is needed for 64bit architectures (thanks to Richard Lowe for providing fixes for 64bit MATLAB)
Obtain mfm-pb boundary detector code from
http://www.cs.berkeley.edu/projects/vision/grouping/segbench/
Change path names in sp_demo.m and pbWrapper.m
Get a fast processor and lots of RAM
Run sp_demo.m
I tried to do the mex -.. one but it told me that I don't have any compiler. How can I fix this? Can you please help me with this? I am using 64 bit Windows 7
As far as I know GCC for Windows is not supported by Matlab. Visual Studio Express Editions will work, but 2010 may require a patch dependent on the version of Matlab you are running (http://www.mathworks.com/support/compilers/R2011a/win32.html). This page lists all supported compilers for Matlab.
Here's a link to GCC for windows
http://gcc.gnu.org/install/specific.html#windows