Using mcc to compile code which calls mex files
이전 댓글 표시
I need to compile code which calls an outside function (GAMS) using mex files. I can compile the code with mcc and receive no errors. However, when I run the executable I get the following error,
sh: gams: command not found
Could not run (null): check gams.path
Error in ==> multistart_GAMS_initializer_v2_1>(parfor body) at 521
Error in ==> parallel_function at 477
Error in ==> multistart_GAMS_initializer_v2_1 at 501
Error in ==> restart at 7
MATGAMS:exec
where gams is the mex file calling the outside program.
gams is in the system folder containing the program, GAMS, to be called. The file pathdef.m is included in the folder from which matlab is being called so that the folder containing gams is on the matlabpath.
This code runs fine when it is not compiled.
My compile command is as follows:
/opt/MATLAB/R2011a/bin/mcc -m -a /opt/gams/23.5.1/gams.m -a /opt/gams/23.5.1/wgdx.m -a /opt/gams/23.5.1/writegdx.m -a /opt/gams/23.5.1/rgdx.m -a /opt/gams/23.5.1/readgdx.m -a /opt/gams/23.5.1/full2sp.m -a /opt/gams/23.5.1/sp2full.m -a /opt/gams/23.5.1/gams.mexa64 -a /opt/gams/23.5.1/gdxInfo.mexa64 -a /opt/gams/23.5.1/rgdx.mexa64 -a /opt/gams/23.5.1/wgdx.mexa64 -R -nodisplay -R -nodesktop
답변 (2개)
Kaustubha Govind
2012년 8월 1일
0 개 추천
The error says "sh: gams: command not found" - so it seems like the "outside" program is not on the System path?
댓글 수: 6
Tricia
2012년 8월 1일
Kaustubha Govind
2012년 8월 2일
Try printing getenv('PATH') from the MATLAB version and the compiled version, and see if the path to gams is missing in the latter?
Tricia
2012년 8월 2일
Kaustubha Govind
2012년 8월 3일
Ah! I just realized that you seem to be running the MEX-file from a parfor body. If you are working in a distributed cluster configuration, could it be that some of your workers don't have gams installed, or are a different platform (32-bit, 64-bit difference or Linux/Windows difference)? What happens if you change it to a regular "for" loop?
I'm not 100% sure, but the way the error message is displayed "sh: gams: command not found" - with the "sh" in the beginning tells me that it's a system shell error.
Tricia
2012년 8월 4일
Kaustubha Govind
2012년 8월 6일
Tricia: Sorry, I've run out of ideas. Perhaps you should contact MathWorks Tech Support to see if they have any ideas?
Titus Edelhofer
2012년 8월 6일
0 개 추천
Hi,
if you look into the file "multistart_GAMS_initializer_v2_1" that (from your error message) tries to start gams: does it do anything to the system path there? Or does it start some local shell script there (gams.sh or whatsoever) which is not there in the compiled application?
Titus
카테고리
도움말 센터 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!