compiler.runtime.customInstaller fails to reduce mcr installer size
99 views (last 30 days)
Show older comments
I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool - without using the customInstaller - is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, 'RuntimeDelivery', 'installer');
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
- 'MATLAB Runtime - Core'
- 'MATLAB Runtime - Graphics'
- 'MATLAB Runtime - Non Interactive MATLAB'
- 'MATLAB Runtime - Numerics'
- 'MATLAB Runtime - Image Processing Toolbox Addin'
1 Comment
Sumukh
on 29 Oct 2024 at 6:44
Can you please provide the "myapp.m" file to reproduce the issue and try to resolve it on my PC?
Answers (2)
Rik
on 29 Oct 2024 at 6:45
I don't know why the size doesn't decrease when using the new function. Do you only have these toolboxes installed? If so 'required' and 'all' wouldn't be different.
The point is that the MCR is essentially a full copy of Matlab. Your function might be 7MB, but running it requires Matlab. If you want to decrease the size, you need to convert your code to C or C++. This is not possible with all functions (and it requires the compiler toolbox).
0 Comments
Sumukh
on 30 Oct 2024 at 5:19
Hi Sadiya,
The command “compiler.runtime.customInstaller” creates an installer that installs the MATLAB Runtime components required by the toolbox, and not the complete MATLAB Runtime. The installer has minimal footprint by default as it installs the MATLAB Runtime components from the MathWorks® website during application installation. This is specified by the “RuntimeDelivery” name-value argument that is set to “web” by default. You can refer to the following documentation to know more about this argument:
The installer includes the MATLAB Runtime components within the installer if the “RuntimeDelivery” option is set to “installer”. This increases the size of the installer. The total size of the MCR components specified in the “requiredMCRProducts.txt” file is close to 1.2GB. This can be verified from the installation dialog box when using the “web” installer to install the Runtime components. The size of the MATLAB Runtime components has significantly increased owing to the addition of features release after release since MATLAB R2016a.
You can set the “RuntimeDelivery” option to “web” to have a much smaller installer size (1.9MB). The installer automatically installs the necessary MATLAB Runtime components for the toolbox from the internet wherever the installer is executed.
0 Comments
See Also
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!