help > Compiling problems
Showing 1-4 of 4 posts
Mar 21, 2018 01:03 AM | ericb
Compiling problems
Hello,
I am hoping to try out this tool box for WMH. However, I am having trouble with the compiler script.
Running Ubuntu 17.10 and Matlab 2018a, there is a bit of an issue where the only approved compiler is gcc 6.3, yet that is not available for Ubuntu 17.10. Running with either gcc 6.4 or 7.2, I get an error.
Specifically trying to compile RegionGrowing_mex.cpp, I get the error pasted below.
Please let me know if you have any suggested workarounds.
Thanks very much.
>> mex RegionGrowing_mex.cpp
Building with 'g++'.
Warning: You are using gcc version '7.2.0'. The version of gcc is not supported. The
version currently supported with MEX is '6.3.x'. For a list of currently supported
compilers see: .
Error using mex
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp: In function 'void
mexFunction(int, mxArray**, int, const mxArray**)':
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:167:47: error: cannot
convert 'const mwSize* {aka const long unsigned int*}' to 'const int*' in
initialization
const int* pSize = mxGetDimensions(prhs[0]);
^
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:201:74: error: cannot
convert 'const int*' to 'const mwSize* {aka const long unsigned int*}' for argument
'2' to 'mxArray* mxCreateNumericArray_730(mwSize, const mwSize*, mxClassID,
mxComplexity)'
plhs[0] = mxCreateNumericArray(lNDims, pSize, mxLOGICAL_CLASS, mxREAL); //
create output array
^
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:203:102: error: cannot
convert 'const int*' to 'const mwSize* {aka const long unsigned int*}' for argument
'2' to 'mxArray* mxCreateNumericArray_730(mwSize, const mwSize*, mxClassID,
mxComplexity)'
bool *pbCandidate = (bool*) mxGetData(mxCreateNumericArray(lNDims, pSize,
mxLOGICAL_CLASS, mxREAL)); // create output array
I am hoping to try out this tool box for WMH. However, I am having trouble with the compiler script.
Running Ubuntu 17.10 and Matlab 2018a, there is a bit of an issue where the only approved compiler is gcc 6.3, yet that is not available for Ubuntu 17.10. Running with either gcc 6.4 or 7.2, I get an error.
Specifically trying to compile RegionGrowing_mex.cpp, I get the error pasted below.
Please let me know if you have any suggested workarounds.
Thanks very much.
>> mex RegionGrowing_mex.cpp
Building with 'g++'.
Warning: You are using gcc version '7.2.0'. The version of gcc is not supported. The
version currently supported with MEX is '6.3.x'. For a list of currently supported
compilers see: .
Error using mex
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp: In function 'void
mexFunction(int, mxArray**, int, const mxArray**)':
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:167:47: error: cannot
convert 'const mwSize* {aka const long unsigned int*}' to 'const int*' in
initialization
const int* pSize = mxGetDimensions(prhs[0]);
^
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:201:74: error: cannot
convert 'const int*' to 'const mwSize* {aka const long unsigned int*}' for argument
'2' to 'mxArray* mxCreateNumericArray_730(mwSize, const mwSize*, mxClassID,
mxComplexity)'
plhs[0] = mxCreateNumericArray(lNDims, pSize, mxLOGICAL_CLASS, mxREAL); //
create output array
^
/usr/local/MATLAB/R2018a/toolbox/W2MHS/RegionGrowing_mex.cpp:203:102: error: cannot
convert 'const int*' to 'const mwSize* {aka const long unsigned int*}' for argument
'2' to 'mxArray* mxCreateNumericArray_730(mwSize, const mwSize*, mxClassID,
mxComplexity)'
bool *pbCandidate = (bool*) mxGetData(mxCreateNumericArray(lNDims, pSize,
mxLOGICAL_CLASS, mxREAL)); // create output array
Mar 21, 2018 12:03 PM | ericb
RE: Compiling problems
I may have solved the problem.
I was able to get it to compile by changing int to mwSize in the functions that were giving errors. mwSize is is apparently recommended insteat of int by Matlab for cross-platform compatibility.
I am posting this for others but also if anyone thinks this may cause problems, please let me know.
EDIT: See below for better solution--this compiles but doesn't run correctly.
I was able to get it to compile by changing int to mwSize in the functions that were giving errors. mwSize is is apparently recommended insteat of int by Matlab for cross-platform compatibility.
I am posting this for others but also if anyone thinks this may cause problems, please let me know.
EDIT: See below for better solution--this compiles but doesn't run correctly.
Mar 22, 2018 02:03 PM | ericb
RE: Compiling problems
Sorry for the 1-person conversation, however I should point out
that the above solution did not work. The file compiles but errors
occur.
However, I found a more promising solution, that compiles, runs and appears to produce images as expected.
When compiling, the following flag is required:
mex -compatibleArrayDims RegionGrowing_mex.cpp
However, I found a more promising solution, that compiles, runs and appears to produce images as expected.
When compiling, the following flag is required:
mex -compatibleArrayDims RegionGrowing_mex.cpp
Mar 22, 2018 03:03 PM | Vamsi Ithapu
RE: Compiling problems
Hello.
We haven't encountered this problem with earlier versions of Matlab/Ubuntu. Please check out with an earlier Matlab version if possible. The mex-compile of Matlab doc will provide more info.
We haven't encountered this problem with earlier versions of Matlab/Ubuntu. Please check out with an earlier Matlab version if possible. The mex-compile of Matlab doc will provide more info.