Finalmente eu encontrei a resposta, O compilador cross resolve o problema, em caso de erro eu edito o makefile e o recompilo.
try
rtwbuild(modelName);
catch
% If it is linux try to compile using cross compiler
% This required the cross compile to be installed
disp('Compilation faild');
if strcmp(computer, 'GLNXA64')
disp('Trying to compile for linux using cross-compiler')
cd([modelName '_ert_shrlib_rtw'])
C_FILE = 'wesys_control.mk';
fid = fopen(C_FILE,'r');
f=fread(fid,'*char')';
fclose(fid);
% Replacing the stop time
f = strrep(f,'CC = gcc','CC = i686-w64-mingw32-gcc');
f = strrep(f,'LD = gcc','LD = i686-w64-mingw32-gcc');
f = strrep(f,'CPP = g++','CPP = i686-w64-mingw32-g++');
f = strrep(f,'CPP_LD = g++','CPP_LD = i686-w64-mingw32-g++');
f = strrep(f,'AR = ar','AR = i686-w64-mingw32-ar');
fid = fopen(C_FILE,'w');
fprintf(fid,'%s',f);
fclose(fid);
!make -f wesys_control.mk all
cd ('..')
end
end