Main Content

Production Server Archive Compiler

Package MATLAB programs for deployment as MATLAB Production Server archives

Since R2025a

Description

The Production Server Archive Compiler packages MATLAB® programs into applications that can run outside of MATLAB. The interactive menus and dialog boxes used in the compiler apps build compiler.build commands that are customized to your specification.

Compiler app advantages include:

  • You can perform deployment tasks with a single intuitive interface.

  • You can organize your files in a MATLAB project.

  • Your project state persists between sessions.

  • You can load previously stored compiler tasks from a prepopulated menu.

  • You can package applications with an installer for distribution.

For more information, see Target-Specific Compiler Apps for MATLAB Code Deployment.

Open the Production Server Archive Compiler App

  • MATLAB toolstrip: On the Apps tab, under Application Deployment, click the app icon.

  • MATLAB command prompt: Enter productionServerArchiveCompiler.

Parameters

expand all

Files implementing MATLAB functions. Files must have one of the following extensions: .m, .p, .mlx, or .mexa64.

All files must be located in the project root folder to be added to the project. To add MATLAB functions to the deployable archive., click Add Exported Function and select your MATLAB file. In the Project panel, the file you selected gains the labels Design and Exported Function File.

Output Location

Path to folder where the build artifacts are generated.

Build Settings

Name of the generated deployable archive. The default value is MyProductionServerArchive.

Obfuscate folder structures, file names, and user code in the deployable archive.

If you enable this property, then folder structures and file names in the deployable archive are obfuscated from the end user, and user code and data contained in .m, .mlapp, .p, .mat, MLX, SFX, and MEX files are placed into a user package within the archive. Additionally, all .m files are converted to P-files before packaging.

During runtime, MATLAB code and data is decrypted and loaded directly from the user package rather than extracted to the file system. MEX files are temporarily extracted from the user package before being loaded.

To manually include additional file types in the user package, add each file type in a separate extension tag to the file matlabroot/toolbox/compiler/advanced_package_supported_files.xml.

The following are not supported:

  • ver function

  • Calling external libraries such as DLLs

  • Out-of-process MATLAB Runtime (C++ shared library for MATLAB Data Array)

  • Out-of-process MEX file execution (mexhost, feval, matlab.mex.MexHost)

  • Before R2023b: .mat files other than v7.3

Enabling this option is equivalent to using mcc with -j and -s specified.

If you do not enable this property, then the deployable archive is not obfuscated. This is the default behavior.

Files Required for Archive to Run

Support packages to include in the deployable archive. The dependency analysis process detects and includes the required support packages automatically. Only the specified support packages are included. To list installed support packages or those used by a specific file, see compiler.codetools.deployableSupportPackages.

Additional files and folders to include in the deployable archive. To add the contents of a folder, click Add Folder. To add an individual file, click Add File.

Additional files to include in the deployable archive. The dependency analysis process detects and includes required data files automatically unless Automatically include data files that are provided as inputs to functions such as load and fopen is disabled.

To view the file analysis results, click View Analysis. To perform the dependency analysis process again, click Reanalyze.

Automatically include data files in the deployable archive.

  • If you enable this property, then data files that you provide as inputs to certain functions (such as load and fopen) are automatically included in the deployable archive. This is the default option.

  • If you disable this property, then you must add data files to the package in the Custom Requirements section.

Limitations

  • The Production Server Archive Compiler app supports testing but not packaging of archive-level routes that map request URLs to web handler functions stored within the archive. If you test routes defined in an archive-level routes JSON file and then build the archive, the routes file is not included in the archive and the routes do not work. To package archive-level routes, use the mcc command instead. For more details on web request handlers, see Handle Custom Routes and Payloads in HTTP Requests (MATLAB Production Server) and Test Web Request Handlers.

Version History

Introduced in R2025a

expand all