Recompiling mex file: Error using mex clang: error: unsupported option '-fopenmp'

8 次查看(过去 30 天)
I am trying to compile a mex file with the following commands:
% minFunc
fprintf('Compiling minFunc files...\n');
mex -outdir minFunc/compiled minFunc/mex/mcholC.c
mex -outdir minFunc/compiled minFunc/mex/lbfgsC.c
mex -outdir minFunc/compiled minFunc/mex/lbfgsAddC.c
% mex -outdir minFunc/compiled CXX='g++' CXXFLAGS='\$CXXFLAGS -O3 -funroll-loops -fopenmp' LDFLAGS="\$LDFLAGS -fopenmp" minFunc/mex/lbfgsProdC.cpp
mex -v -outdir minFunc/compiled CXX='g++' CXXFLAGS='\$CXXFLAGS -O3 -fopenmp' LDFLAGS="\$LDFLAGS -fopenmp" CXXOPTIMFLAGS='-O3' minFunc/mex/lbfgsProdC.cpp
% mex -v -outdir minFunc/compiled -fopenmp -O3 minFunc/mex/lbfgsProdC.cpp
% mex -v -outdir minFunc/compiled CXX='g++' CXXFLAGS='\$CXXFLAGS -O3 -msse4 -ftree-vectorize -ftree-vectorizer-verbose=5 -ftree-loop-distribution -funroll-all-loops -ftracer -funroll-loops -fopenmp' LDFLAGS="\$LDFLAGS -fopenmp" minFunc/mex/lbfgsProdC.cpp
% mex -outdir minFunc/compiled CXX='g++' CFLAGS='\$CFLAGS -O3 -msse4 -ftree-vectorize -ftree-vectorizer-verbose=5 -ftree-loop-distribution -funroll-all-loops -ftracer -funroll-loops -fopenmp' LDFLAGS="\$LDFLAGS -fopenmp" minFunc/mex/lbfgsProdC.c
mex -v -outdir minFunc/compiled COMPFLAGS="-DUSE_WINDOWS /openmp /O3 $COMPFLAGS" minFunc/mex/lbfgsProdC.cpp
And I get the following error message:
Error using mex clang: error: unsupported option '-fopenmp'
Error in mexAll (line 7)
mex -v -outdir minFunc/compiled CXX='g++' CXXFLAGS='\$CXXFLAGS -O3 -fopenmp' LDFLAGS="\$LDFLAGS -fopenmp" CXXOPTIMFLAGS='-O3'
minFunc/mex/lbfgsProdC.cpp
The code was running fine on Matlab R2016a, but now that I have upgraded to R2017a, my programm runs crashes. I the tried to recompile the mex file and got the error. Also, it might be worth mentioning that I have updated my OS to High Sierra.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by