Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in develop\sample.m #29

Open
sandeepganji opened this issue Aug 13, 2020 · 2 comments
Open

bug in develop\sample.m #29

sandeepganji opened this issue Aug 13, 2020 · 2 comments

Comments

@sandeepganji
Copy link

In develop\sample.m fprintf(fid, '%d unterminated\n, i); is not properly terminated. this can accuse issues in mcc (code compilation)

@scottclowe
Copy link
Owner

The sample file is there to allow the user to see how a colour scheme looks. It is intended to show all syntax highlighting options in a single succinct file. This line is intentionally not terminated in order to demonstrate what an unterminated string looks like, hence why the text for the sting is the word "unterminated". So it's not a bug, it is a feature. This is not a file that you need to run in order to use any of the functionality of the package, and so you should not be attempting to compile it.

But why are trying to compile the code with mcc in the first place? Is this something MATLAB is doing automatically on your behalf, or is there some motivation for you to manually compile the package?

@apjanke
Copy link

apjanke commented Jan 24, 2021

I can actually support @sandeepganji's use case here: At my work, and in my contracting gigs, I often "compile" Matlab code to deployable programs or libraries using the Matlab Compiler (mcc), so they can be run by users that don't have Matlab licenses, run in the Matlab Production Server or Matlab Parallel Server, included in custom applications in C# or other languages, distributed in an obfuscated, no-Matlab-license-required manner, and so on.

For larger Matlab applications, using depfun and Matlab Compiler's automatic dependency resolution to pick up the source files to go in to the mcc program is not adequate: it misses any dynamic dependencies used by eval, feval, or other dynamic dispatch mechanisms, and it doesn't pick up resource files. The easiest way to deal with this is to must use the -a option to sweep up your entire codebase, including any third-party libraries you're using, which is probably where Sandeep's pulling in Matlab Schemer. Multiple Matlab Compiler libraries cannot be composed together, so you need to compile the whole shebang, including all your dependencies, at once.

Regardless of how you do it, any syntax error in any .m file that's included in an mcc build will break the entire build, regardless of whether that file actually gets called anywhere.

The straightforward fix to this is to not have the develop/ directory on your Matlab path when you're running mcc. Is that feasible, @sandeepganji ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants