MATLAB codegen gives a build error status code 2 (gmake access denied)
Show older comments
I am trying to compile a MATLAB function into a "MEX" file to improve speed. I have successfully done this conversion via the "codegen" function in MATLAB on my work computer, using MATLAB ver. R2012a (64 bit) on a Windows 7 Enterprise 64-bit PC. I have installed and chosen "Microsoft Software Development Kit (SDK) 7.1" as the default compiler in MATLAB.
With the exact same setup as above on my personal laptop (same MATLAB version with the same license, 64 bit, same compiler) and Windows 7 Home Premium 64 bit, I keep getting a build error with the same piece of code. When I looked into the Target build log, it says that the error was "gmake: Access is Denied", as you can see below.
1 cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD -DMX_COMPAT_32 /O2 /Oy- /DNDEBUG /fp:strict /I "C:\PROGRA~1\MATLAB\R2012a\extern\include" /I "C:\PROGRA~1\MATLAB\R2012a\simulink\include" /I "C:\PROGRA~1\MATLAB\R2012a\toolbox\shared\simtargets" /I "C:\PROGRA~1\MATLAB\R2012a\rtw\ext_mode\common" /I "C:\PROGRA~1\MATLAB\R2012a\rtw\c\src\ext_mode\common" /I "C:\Users\Litetaker\Desktop\MATLAB\LTE_Link_Level_1.7_r1089\codegen\mex\func_mcma_mult_miso2" "func_mcma_mult_miso2_mexutil.c"
2 func_mcma_mult_miso2_mexutil.c
3 cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD -DMX_COMPAT_32 /O2 /Oy- /DNDEBUG /fp:strict /I "C:\PROGRA~1\MATLAB\R2012a\extern\include" /I "C:\PROGRA~1\MATLAB\R2012a\simulink\include" /I "C:\PROGRA~1\MATLAB\R2012a\toolbox\shared\simtargets" /I "C:\PROGRA~1\MATLAB\R2012a\rtw\ext_mode\common" /I "C:\PROGRA~1\MATLAB\R2012a\rtw\c\src\ext_mode\common" /I "C:\Users\Litetaker\Desktop\MATLAB\LTE_Link_Level_1.7_r1089\codegen\mex\func_mcma_mult_miso2" "func_mcma_mult_miso2_data.c"
4 func_mcma_mult_miso2_data.c
5 gmake: *** Access is denied.
6 . Stop.
Can someone help me fix this error? I don't know what I am doing wrong. Note that this gmake executable is in the MATLAB install directory at: C:\Program Files\MATLAB\R2012a\bin\win64\gmake and when I call it on its own from the command line, it seems to work fine. But through MATLAB, it seems to fail.
5 Comments
Ryan Livingston
on 24 Jul 2013
I would start by checking the permissions/security on the directory containing func_mcma_mult_miso2_data.c and other files which are being built by gmake.
Can you try to change your output directory with:
codegen ... -d C:\some\new\directory\with\read\write\access
and see if that succeeds?
Abhijit Kiran
on 24 Jul 2013
Denis Gurchenkov
on 30 Jul 2013
Hi Abhijit, can you try three things: - Disable antivirus protection one your computer - Open a command prompt window with administrator rights, and run the codegen-created batch file from there - If the above does not help, use codegen again, but use "-d" flag as Ryan suggested above, giving it some destination folder that you definitely have read and write access to?
This "access denied" error seem to be related to your computer configuration, somehow the destination folder (where the C compiler places .obj files) is either write-protected, or unavailable.
Abhijit Kiran
on 31 Jul 2013
Denis Gurchenkov
on 31 Jul 2013
Hi Abhijit, I just noticed that the desitnation folder (where your MATLAB and C files are) is in your Desktop folder (C:\Users\Litetaker\Desktop\MATLAB..). I just learned that Windows has some tricky file permission rules for files under "Desktop" - not all software is allowed to create files there. I don't know the details, but perhaps you can try reproducing the issue outside of the desktop folder (e.g. create c:\Work\MATLAB\, copy all files there, and run codegen command from there). I wonder if this would help. -- Denis.
Answers (1)
Walter Roberson
on 30 Jul 2013
0 votes
The access that is being denied is potentially to one of the output files.
If you had a "stuck" gmake and then ran gmake again, you could encounter this.
If you had one of the output files open and then ran gmake you could encounter this.
If gmake is working in parallel (building multiple files simultaneously) then you could potentially encounter this.
2 Comments
Abhijit Kiran
on 30 Jul 2013
Walter Roberson
on 30 Jul 2013
The created directories might not have access authorization for your account at home.
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!