Error using:mtimesx_build.m

Hi everyone
I am very interested in using mtimesx , but I am new to compiling. When I Run mtimex_build.m, I get the following error:
>>Error using: mtimesx_build (line 446)
Unable to compile mtimesx.c
Can anybody help me? Thank you and best wishes,

4 Kommentare

Did you successfully
mex -v -setup C
?
zb li
zb li am 14 Jan. 2019
hi,Roberson
I successfully
mex -setup C++
Walter Roberson
Walter Roberson am 14 Jan. 2019
mtimesx needs to setup C, not C++
Bruno Luong
Bruno Luong am 14 Jan. 2019
Bearbeitet: Bruno Luong am 14 Jan. 2019
I believe setup C++/C actually can be used with the same command
mex -setup C++

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Bruno Luong
Bruno Luong am 14 Jan. 2019
Bearbeitet: Bruno Luong am 14 Jan. 2019

0 Stimmen

If you run recent MATLAB you also must change the line #166 of mtimex_build.m to
mexopts = [prefdir '\mex_C_win64.xml'];

8 Kommentare

zb li
zb li am 14 Jan. 2019
Bearbeitet: zb li am 14 Jan. 2019
hi Luong,
I have changed the line #166 of mtimex_build.m and mex -setup successfully.When I Run mtimex_build.m, I get the following error:
>>Error using: mtimesx_build (line 446)
Unable to compile mtimesx.c
can you help me?
thankyou very much
Bruno Luong
Bruno Luong am 14 Jan. 2019
Please comment the lines 386 (try) and 436-465 (catch block) run mtimex_build and copy the full error message here.
zb li
zb li am 15 Jan. 2019
Hi Luong,
Here are full error message,after comment the lines 386 (try) and 436-465 (catch block) run mtimex_build
Error Using mex
C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft\libmwblas.lib: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
Error Using mtimesx_build (line 428)
mex('-f',xname,cname,largearraydims,lib_blas,['-DCOMPILER=' compiler]);
Thankyou
Please tell us the output of
>> mex -setup C
then create a breat point at #428 of mtimex_build.m run it and the output of
>> xname
>> cname
>> largearraydims
>> compiler
before error occurs
Can you change the line #421 to
if( 1 || isempty(xname) )
Then rerun the code mtimex_build?
zb li
zb li am 16 Jan. 2019
answer "create a breat point at #428 of mtimex_build.m run it and output"
>> mex -setup C
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
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.
K>> xname
xname =
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_mexopts.bat
K>> cname
cname =
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c
K>> largearraydims
largearraydims =
-largeArrayDims
K>> compiler
compiler =
GCC
zb li
zb li am 16 Jan. 2019
answer : change the line #421
>> mtimesx_build
... Build routine for mtimesx
... Checking for PC
... Finding path of mtimesx C source code files
... Found file mtimesx.c in D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c
... Found file mtimesx_RealTimesReal.c in D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_RealTimesReal.c
... Opened the mexopts.bat file in C:\Users\Dell\AppData\Roaming\MathWorks\MATLAB\R2016a\mex_C_win64.xml
... Reading the mexopts.bat file to find the compiler and options used.
... GCC is the selected compiler
... Assuming that GCC will link with Microsoft libraries
... OpenMP compiler potentially detected
... Checking to see that the ' -fopenmp' compile option is present
... The ' -fopenmp' compile option is not present ... adding it
... Creating custom options file D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_mexopts.bat with the ' -fopenmp' option added.
... Using BLAS library lib_blas = 'C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft\libmwblas.lib'
... Now attempting to compile ...
mex('D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c','-largeArrayDims',lib_blas,'-DCOMPILER=GCC')
Building with 'MinGW64 Compiler (C)'.
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c: In function 'mexFunction':
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c:592:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ans = mexGetVariablePtr("caller","OMP_SET_NUM_THREADS");
^
... Well, *that* didn't work ...
This may be because an OpenMP compile option was added that the
compiler did not like. Attempting to compile again, but this time
will not add the ' -fopenmp' option.
... OpenMP compiler potentially detected, but not checking for ' -fopenmp' compile option
... Using BLAS library lib_blas = 'C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft\libmwblas.lib'
... Now attempting to compile ...
mex('D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c','-largeArrayDims',lib_blas,'-DCOMPILER=GCC')
Building with 'MinGW64 Compiler (C)'.
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c: In function 'mexFunction':
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c:592:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ans = mexGetVariablePtr("caller","OMP_SET_NUM_THREADS");
^
... Well, *that* didn't work either!
The mex command failed. This may be because you have already run
mex -setup and selected a non-C compiler, such as Fortran. If this
is the case, then rerun mex -setup and select a C/C++ compiler.
Error using mtimesx_build (line 446)
Unable to compile mtimesx.c
K>> xname
xname =
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_mexopts.bat
That's odd. Normally this file is no longer used by MTIMESX V 20110223
And I told you to change the line #166 so this file won't be read.
Not sure why it's still read.
Please rename mtimesx_mexopts.bat or delete to make sure it be inglored by mtimesx_build

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 14 Jan. 2019

Kommentiert:

am 16 Jan. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by