help > C++ Compiler in Matlab Installation Error
Showing 1-4 of 4 posts
Display:
Results per page:
Jan 3, 2014  09:01 PM | BIBA_Lab
C++ Compiler in Matlab Installation Error
Hello,
I am trying to set up the W2MHS program and am running into a bit of trouble.

I am using MATLAB 2007a and have 3 C++ compilers available within matlab, none of which work to compile the mex files.

">> installW2MHS
______________________________________________________________________

Wisconsin White Matter Hyperintensity Segmentation and Quantification:
Filepath "/apps/W2MHS" successfully added to Matlab.

Compiling MEX files...
??? Error using ==> installW2MHS at 19
Could not compile MEX files! Make sure you have a compatible C++ compiler installed.

To set up compilers run the command:
 mex -setup

For help finding compatible compilers see MathWorks.com

>> mex -setup

    Options files control which compiler to use, the compiler and link command
    options, and the runtime libraries to link against.

    Using the 'mex -setup' command selects an options file that is
    placed in ~/.matlab/R2007a and used by default for 'mex'. An options
    file in the current working directory or specified on the command line
    overrides the default options file in ~/.matlab/R2007a.
 
    To override the default options file, use the 'mex -f' command
    (see 'mex -help' for more information).

The options files available for mex are:

  1: /usr/local/MATLAB/R2007a/bin/f90opts.sh :
      Template Options file for building Fortran 90 MEX-files via the system ANSI compiler
 
  2: /usr/local/MATLAB/R2007a/bin/gccopts.sh :
      Template Options file for building gcc MEX-files
 
  3: /usr/local/MATLAB/R2007a/bin/mexopts.sh :
      Template Options file for building MEX-files via the system ANSI compiler
 

  0: Exit with no changes

Enter the number of the compiler (0-3):
2

Overwrite /home/biba1/.matlab/R2007a/mexopts.sh ([y]/n)?
y

/usr/local/MATLAB/R2007a/bin/gccopts.sh is being copied to /home/biba1/.matlab/R2007a/mexopts.sh"

It just repeats for each of the 3 compilers. I have a feeling I simply do not have something within matlab set up correctly but am hoping someone here can spot the issue.
Any thoughts are appreciated.

Thank you!
Megan
Jan 7, 2014  06:01 PM | BIBA_Lab
RE: C++ Compiler in Matlab Installation Error
UPDATE:

After some google searching, I discovered that my version of gcc was too new for the version of matlab that I am using (2012a). [Edit: I realize my earlier post said matlab 2007, I switched to our newer version of matlab hoping it would solve the problem, but I get the same error.] I downloaded gcc-4.4 which is compatible with 2012a and followed the steps suggested here (http://huhmaster.blogspot.com/2012/06/co...).
I was able to successfully compile a tester file through matlab, however I am getting the same error when running installW2MHS.m.
Still hoping for some suggestions, thank you for your time!
Jan 8, 2014  11:01 PM | Christopher Lindner
RE: C++ Compiler in Matlab Installation Error
Hi Megan,

Thanks for your interest in out toolbox.

As with many compile errors it is very hard to pin down the problem with your specific compiler. What version of Windows / Linux are you running? I may be able to give you some precompiled files.

Chris
Jan 9, 2014  11:01 PM | BIBA_Lab
RE: C++ Compiler in Matlab Installation Error
To close out the forum, Chris suggested the following work arounds and the last one was successful for me.

Try going into the source folder and manually compiling this mex file:
W2MHS/RegionGrowing_mex.cpp

Then go to W2MHS/rf_codes and run the MatLab script:
mx_compile_cartree.m

This script should compile the Random Forest code we sue. If this doesn't work try to manually compile this c program in that same folder.
mex -O best_cut_node.cpp GBCR.cpp GBCP.cpp GBCC.cpp
mex mx_eval_cartree.c