필터 지우기
필터 지우기

couldn't run codegen under matlab

조회 수: 13 (최근 30일)
Qingyan
Qingyan 2011년 5월 25일
I have trial version of matlab coder,and download a sample coder from mathwork: hello_world. and followed the instruction of how to setup and run the sample.
when I tried to run codegen to generate mex function within matlab, I get a error message like: >> codegen hello_world ??? cp: preserving permissions for `/var/local/scratch/qguan/coder2/coderdemo_hello_world/codegen/mex/hello_world/mexopts.sh': Operation not supported
I checked uid and gid for the current workfolder, it is set all fine and rw enabled.
what else I should be looking into? or is it known issue?
Thanks so much for your help! Qingyan

채택된 답변

John Elliott
John Elliott 2011년 5월 26일
The codegen command uses
>> copyfile(<source_file>,<dest_dir>,'f')
to copy mexopts.sh, which is typically found in [matlabroot '/bin']. You could try executing this command to see if it fails.
If the issue is related to permissions, you might try running mex -setup. This can be used to copy mexopts.sh to your prefdir (to which I presume you have write permission) and you could then modify the permissions on the file in your prefdir. The codegen command will give preference to the mexopts.sh file in the prefdir over the one in the bin directory.
-John
  댓글 수: 6
Qingyan
Qingyan 2011년 5월 31일
as this is a matlab code, it only uses copyfile(), which actually run cp -p in OS system. doesn't that mean that I have modify matlab function copyfile()? otherwise, I don't know how to strip out the -p.
I think what I will do is to modify matlab startup folder, so it can land to local directory, to avoid involving NFS files.
Thanks everyone for help!
Walter Roberson
Walter Roberson 2011년 5월 31일
If it actually invokes "cp" then the operating system is going to use the PATH environment variable to search for "cp". If you have provided a PATH environment variable that first lists a different directory that has your own version of "cp" in it, the operating system would look there first. The program you have in that location could process the arguments, remove the "-p" and start the _real_ "cp" program with those arguments.
But changing your start-up directory is probably easier ;-)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 5월 25일
It sounds as if at some point the script is executing the Linux command
cp -p SomeFile /var/local/scratch/qguan/coder2/coderdemo_hello_world/codegen/mex/hello_world/mexopts.sh
(Or --preserve instead of -p)
and that for some reason keeping the permissions is not possible.
Sometimes preserving permissions is not possible with networked file systems.
What I would probably do is fine the "cp" line and remove the "-p" or "--preserve" option.
  댓글 수: 6
Walter Roberson
Walter Roberson 2011년 5월 25일
The documentation for copyfile is inconsistent with copyfile being equivalent to cp -p . The copyfile documentation indicates, "The read-only and archive attributes of source are not preserved in destination." but the point of cp -p is to preserve at least the read-only attribute.
Kaustubha Govind
Kaustubha Govind 2011년 5월 26일
@Qingyan: Have you tried running either:
!cp -p /some/source /some/destination
or
system('cp -p /some/source /some/destination')
Do they work okay?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by