Why is the build process failing with error code: "NMAKE: fatal error U1073: don't know how to make 'C:\Program'"?
117 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 6 Jun. 2013
Bearbeitet: MathWorks Support Team
am 1 Sep. 2022
When I try to build a built-in model, I get an error message stating that the build has failed. I have a supported Microsoft C/C++ compiler (Windows SDK/Visual Studio) installed and properly set up.
The error message will look similar to the following:
ERROR: NMAKE : fatal error U1073: don't know how to make 'C:\Program'
Stop.
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
A similar error may occur in the build log for models that are run in Accelerator mode, or when building the model for Simulink Coder, Embedded Coder, or Simulink Real-Time.
Akzeptierte Antwort
MathWorks Support Team
am 1 Sep. 2022
Bearbeitet: MathWorks Support Team
am 1 Sep. 2022
The problem with the build process is due to the following lines in the "model.mk" makefile. The .mk file contains the following code:
MATLAB_ROOT = C:\Program Files\MATLAB\R2013a
ALT_MATLAB_ROOT = C:\Program Files\MATLAB\R2013a
MATLAB_BIN = C:\Program Files\MATLAB\R2013a\bin
ALT_MATLAB_BIN = C:\Program Files\MATLAB\R2013a\bin
Since the MATLAB_ROOT and ALT_MATLAB_ROOT variables have the same value, the makefile is using the MATLAB_ROOT value with spaces. The build process does not know how to handle files with spaces in the path. MATLAB normally populates ALT_MATLAB_ROOT with the short path name, usually "C:\PROGRA~1". This issue may occur:
(1) If the generation of short path names is disabled on your Windows system.
(2) If MATLAB was itself installed in a path with a space in it (such as C:\Program Files) for R2014b and earlier. In the R2015a SP1 and later releases, the issue was fixed and would not occur.
The proper code should have been as below:
MATLAB_ROOT = C:\Program Files\MATLAB\R2013a
ALT_MATLAB_ROOT = C:\PROGRA~1\MATLAB\R2013a
MATLAB_BIN = C:\Program Files\MATLAB\R2013a\bin
ALT_MATLAB_BIN = C:\PROGRA~1\MATLAB\R2013a\bin
See the following documentation page for further details:https://www.mathworks.com/help/rtw/ug/enable-build-process-for-folder-names-with-spaces.html
There are a few methods for resolving this issue:
This is perhaps the easiest of the solutions. There is a setting in Windows registry that enables/disables the generation of short names for file paths. Please use the following steps to change this setting:
(NOTE: Due to Windows security settings on the Program Files folder, this method may not work. If you receive a message during step 4 that says "Error: Access is denied.", please use one of the other solutions.)
1. Go to Windows Start menu and search for "regedit.exe". A new window will open.
2. Navigate to the following location:3. Change the value of "NtfsDisable8dot3NameCreation" to 0.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation
Changing the value to 0 will enable the usage of short names in Windows paths. More information about this could be found at Microsoft's website:https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc959352(v=technet.10)
4. However, changing the value above will only set short names for files and folders that are created after making the change. To set a short name for use the "fsutil" function in Windows command prompt. The syntax to set the short name is as follows:For the example of "C:\Program Files" the user would issue the following command to set the short name for "Program Files" to "PROGRA~1".The directory needs to be in quotations because it has spaces.
> fsutil file setshortname <FileName> <ShortName>
> fsutil file setshortname "C:\Program Files" PROGRA~1
5. To check that the short name was set correctly use the "dir" command with "/x" option to show short names.More information for "fsutil" can be found here:https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc788058(v=ws.11)
> dir C:\ /x
1. Open a Windows Command Prompt. And go to the C: directory.
2. Create the symbolic link to the location where your MATLAB versions are installed. The syntax is as follows:For example, a typical MATLAB installation folder is C:\Program Files\MATLAB. To make a link to that folder called MyMatlab use the following command:If you open the new MyMatlab folder, you should see the folders for each version of MATLAB that are installed.
> mklink /d <Link> <Target>
> mklink /d C:MyMatlab "C:\Program Files\MATLAB"
3. Create a new shortcut for MATLAB. This can go on your desktop or wherever you would like.
4. Right-click on the shortcut and open Properties.
5. Go to the 'Shortcut' tab. In the 'Target:' option there will be a path to the executable that is used to launch MATLAB from this shortcut. Modify this path to use the newly created symbolic link. For the example above the, it should read6. Launch MATLAB from this shortcut. Verify the location by typing "matlabroot" without quotations in Command Window, this should have no spaces in it now.
C:\MyMatlab\R2013a\bin\matlab.exe
7. If you have multiple versions of MATLAB, repeat steps 3-6 for each version so that they will be launched from a location with no spaces in the path.
This solution will work for the newly created shortcuts. If you launch MATLAB from a different location it will not use the symbolic link and there will be the same issue with spaces in the path.
The reason we use short paths is to avoid white spaces in the paths. By reinstalling MATLAB at a location without any spaces in the paths, you can workaround the build issue. However, this will require you to download and reinstall MATLAB.
For example, MATLAB can be installed at a path as belowMuch like Solution 2, this solution will require you to reinstall MATLAB for all versions that you use.
C:\MATLAB_Install\MATLAB\R2013a
Another way around this issue is to encase the file names in double-quotes. This will cause the build process to treat the file names enclosed in double-quotes literally which will cause the build to succeed.
To do this, open the template makefile that you are using for code generation. Make a copy of this file and rename it. Inside this file, wherever "$(MATLAB_ROOT)" is used as part of a path, put a double quote before the "$" sign and after the last character in the path. For example, if the original line in the TMF was:The line would be replaced with:In "Configuration Parameters" -> "Code Generation" make sure that the "Template makefile" option points to the modified TMF, or else the changes will not be reflected in the generated code.
{$(MATLAB_ROOT)\toolbox\rtw\targets\xpc\target\build\xpcblocks}.c.obj :
{"$(MATLAB_ROOT)\toolbox\rtw_targets\xpc\target\build\xpcblocks"}.c.obj :
This method will need to be repeated for each template makefile that is used.
A useful documentation page for MATLAB R2017a discussing the methods of enabling build processes for folder names with spaces can be found at the following link: https://www.mathworks.com/help/rtw/ug/enable-build-process-for-folder-names-with-spaces.html
The limitations mentioned in the section 'Build Process Folder Support on Windows' are addressed in the methods mentioned above.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multicore Processor Targets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!