Soc Builder stuck on Build software application 'error using copy file'

I get error the folllowing errorr "Build sofware application> error using copy file cannot copy or move a file or directory onto itself. am using soc builder to build a model from simulink.

1 Comment

Torsten
Torsten on 4 Oct 2026 at 12:06
Edited: Torsten on 4 Oct 2026 at 12:08
Answer from AI:
This error error using copy file cannot copy or move a file or directory onto itself usually happens in SoC Builder because the code generation folder conflicts with your current MATLAB working directory, or leftover build artifacts from a previous run are blocking the process.
Here are the most effective steps to fix this:
1. Change the Code Generation Folder Structure
If SoC Builder tries to copy files into the exact same folder structure it is reading from, the process fails.
  1. In Simulink, open Simulink Preferences (go to the Modeling tab -> Environment -> Simulink Preferences).
  2. Navigate to General.
  3. Look for the Code generation folder structure option.
  4. Change it from ModelSpecific to Target environment subfolder (or TargetSpecific). This forces Simulink to create a dedicated, isolated sub-folder for the build files.
2. Change Your Current MATLAB Working Directory
Ensure your current MATLAB active folder (pwd) is not the same folder where the generated C/C++ code or the SoC build target directory is located.
  • In the MATLAB file browser, move up one level to a parent directory before launching the SoC Builder again.
3. Perform a Clean Build (Delete Old Build Folders)
Sometimes, file locks or permission issues from a previous failed build prevent files from being overwritten.
  1. Close the SoC Builder tool and save your Simulink model.
  2. Manually delete the automatically generated folders in your file explorer (look for folders named your_model_name_ert_rtw or slprj).
  3. In the MATLAB Command Window, run clear mex and bdclose all to release any hidden file locks.
4. Check Long Path Lengths (Windows)
If you are on Windows and your project is buried deep inside multiple folders, the path might exceed the Windows character limit, causing file copy operations to fail with generic errors. Try moving your project folder closer to the root directory (e.g., C:\Projects\SoC_Model\).
If all this doesn't help, contact support:

Sign in to comment.

Answers (0)

Asked:

on 4 Oct 2026 at 3:01

Edited:

on 4 Oct 2026 at 12:08

Community Treasure Hunt

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

Start Hunting!