MATLAB Answers

How to detect a license checkout failure from an MCC call?

14 views (last 30 days)
Patrick Bronneberg
Patrick Bronneberg on 15 Oct 2012
In our project we create standalone executables from M files using the Matlab compiler. The executables are created by our automated build server using MSBuild . To do this, MSBuild calls MCC from the windows commandline. It took some time to get this up & running, but now this actually works very nicely.
The issue that we encounter is that sometimes the executables cannot perform certain functions (eg. image processing) because files needed for this are missing from the CTF file. Detailed analysis shows that the cause of this is a failing license checkout for e.g. the image processing toolbox during the MCC build (in our company we have a large set of floating licenses, but sometimes we can run out of them).
In this case, I would expect MCC to fail. But instead it outputs a detailed error message (error -4) to the command prompt and continues building like nothing ever happened: result is an application that appears to built correctly, but lacks certain functionality.
The call to MCC includes the following flags:
-o [Foo]
-W WinMain:[Foo]
-d [Bar]
-v [Main File]
-a [Included M files]
-p images
-p stats
-T link:exe
-N
-w error:specified_file_mismatch
-w error:repeated_file
-w error:switch_ignored
-w error:missing_lib_sentinel
-w error:demo_license
-R '-logfile,[Foo].log'
As you can see, all known warnings are already returned as error.
Is there a way to also have license checkout failures return as an error? Or is there another way (eg. return value?) through which we can detect this?

Answers (2)

Image Analyst
Image Analyst on 15 Oct 2012
Did you see all the examples they have for the license() function in the help?
  2 Comments
Image Analyst
Image Analyst on 15 Oct 2012
I have a compile.m script that does a bunch of stuff, like refreshing the cache which it always seems to nag me about, and then finally at the end it issues the mcc command with all the umpteen thousand arguments. So I simply say compile on the command line and it does everything needed. You might want to consider doing it that way, where you can check the license status in the script before going ahead with the actual mcc call.

Sign in to comment.


Andreas Goser
Andreas Goser on 15 Oct 2012
When calling MCC or MBUILD from the DOS command line, you may accomplish your goal by using FLEXnet commands. You need to make sure that the license server can be found (path) and you have necessary permissions.
The idea is to use a BAT file with commands like
lmutil lstat
in it. Sorry this is vague...

Community Treasure Hunt

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

Start Hunting!