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, 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
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
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
I have also posted this question in MATLAB's forum
from the reply by Sumukh, it appears that compiler.runtime.customInstaller
is basically doing the same as deploytool
, that creates a "reduce-sized" mcr package using only the components returned by requiredMCRProducts.txt
. It is simply an API version of this function - one should not expect further mcr file size reduction by calling this API.
Because of this, the mcr local installer is the best matlab can produce, it is rather a coarse-grained reduction based on the components, but it currently does not support fine-grained file-level trimming.