xcode5 - Compiling embedded MATLAB functions in Simulink, Mac OSX 10.9 Mavericks, Xcode 5, MATLAB 2012b -
after updated latest osx mavericks, i've had issues compiling simple matlab function blocks in simulink, diagram , attached code below.
function y = fcn(t) %#codegen %simple matlab .m function compiled diagram y = sin(t)+cos(t);
i had same problem under osx 10.8 mountain lion, able solve problem downloading mathworks patch , following instructions on this site.
with new os , having upgraded xcode 5, followed instructions in this post change compiler , sdk info in mexopts.sh
file from
#patch: macosx10.8 cc='llvm-gcc-4.2' cxx='llvm-g++-4.2' sdkroot='/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk/' macosx_deployment_target='10.8' archs='x86_64'
to
#patch: macosx10.9 cc='llvm-gcc' cxx='llvm-g++' sdkroot='/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.9.sdk/' macosx_deployment_target='10.9' archs='x86_64'
after running mex -setup
and restarting matlab, following error when trying run simulink model function block (the behavior same models these blocks):
making simulation target "mextest_sfun", ... /applications/matlab.app/bin/mex -c -o -dmatlab_mex_file -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../simulink/include -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../extern/include -i/applications/matlab.app/stateflow/c/mex/include -i/applications/matlab.app/stateflow/c/debugger/include mextest_sfun.c clang: warning: treating 'c' input 'c++' when in c++ mode, behavior deprecated /applications/matlab.app/bin/mex -c -o -dmatlab_mex_file -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../simulink/include -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../extern/include -i/applications/matlab.app/stateflow/c/mex/include -i/applications/matlab.app/stateflow/c/debugger/include mextest_sfun_registry.c clang: warning: treating 'c' input 'c++' when in c++ mode, behavior deprecated /applications/matlab.app/bin/mex -c -o -dmatlab_mex_file -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../simulink/include -i/applications/matlab.app/toolbox/stateflow/stateflow/../../../extern/include -i/applications/matlab.app/stateflow/c/mex/include -i/applications/matlab.app/stateflow/c/debugger/include c2_mextest.c clang: warning: treating 'c' input 'c++' when in c++ mode, behavior deprecated /applications/matlab.app/bin/mex -silent ldflags="\$ldflags " -output mextest_sfun.mexmaci64 mextest_sfun.o mextest_sfun_registry.o c2_mextest.o /applications/matlab.app/stateflow/c/mex/lib/maci64/sfc_mex.a /applications/matlab.app/stateflow/c/debugger/lib/maci64/sfc_debug.a -l/applications/matlab.app/bin/maci64 -lfixedpoint -lut -lmwmathutil -lemlrt -lmwblascompat32 -l/applications/matlab.app/bin/maci64 -lippmwipt undefined symbols architecture x86_64: "sf_debug_api(int, mxarray_tag**, int, mxarray_tag const**)", referenced from: _mexfunction in mextest_sfun_registry.o "_callcustomfcn", referenced from: _mdl_start_processing in sfc_mex.a(sfc_sf.o) _mdlterminate in sfc_mex.a(sfc_sf.o) "_sf_machine_global_initializer", referenced from: _mdl_start_processing in sfc_mex.a(sfc_sf.o) "_sf_machine_global_method_dispatcher", referenced from: _call_sf_machine_global_method_dispatcher in sfc_mex.a(sfc_sf.o) "_sf_machine_global_terminator", referenced from: _mdlterminate in sfc_mex.a(sfc_sf.o) ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) mex: link of ' "mextest_sfun.mexmaci64"' failed. gmake: *** [mextest_sfun.mexmaci64] error 1
i'm thinking it's undefined symbols architecture x86_64
key message here, not know. have had same issues, or have solution this? appreciated. thanks!
after searching internet , waiting answers on forum no results, solution problem became upgrading matlab 2013a.
in addition, little modification mexopts.sh
file needed. replace instances of 10.7
either 10.8
or 10.9
. both of these worked me, ended replacing 10.9
i'm running mavericks.
the "official" solution can found on this site.
Comments
Post a Comment