Compiling an app with mogl?


I'm trying to deploy a PTB routine in order to run it on a machine that doesn't have MATLAB installed. I'm using the 'Application Compiler' tool in MATLAB. Upon running the compiled binary, I receive an error from the console indicating that MATLAB OpenGL (mogl) hasn't been added to the search path:

Error using InitializeMatlabOpenGL (line 88)

Failed to initialize OpenGL for Matlab: Add the 'core' and 'wrap' directories of mogl to the MATLAB search path!

Note that this is on the same machine that I compiled from; i.e. this computer has a working PTB installation on it. Manually adding the entire PTB directory to the search path with the following code doesn't appear to help:


Does anyone have any ideas why the compiled version of the app isn't finding mogl?

Use of such compiled apps is not officially supported. But if you look at the source of that error it doesn't find a M-File which should be in the 'wrap' folder, so i guess something is wrong with what is included. Or the matlab compiler thingy doesn't include the missing glmConst.m file because it doesn't understand it is needed, given that the glmConst function isn't executed, the code just tests for its exist()ence as a proxy for the folder being present.

I expect there will be more things like runtime libraries, e.g., if you use PsychPortAudio, or which are needed by PTB and included in the distro, but which the Application compiler tool will fail to recognize as dependencies, because it is not clever enough. Teaching the application compiler about all this stuff manually will be your job.

Quick update: I've managed to compile an app by specifically adding the *contents* of the 'core' and 'wrap' directories. It turns out that simply specifying the directories isn't good enough; the MATLAB compiler doesn't see these as directories and thus doesn't add the contents.

Those were the only dependencies that apparently aren't automatically recognised as being required in order to compile an app. However, I haven't yet tried running it on a non-PTB or non-MATLAB machine.

Hi, I am in a similar situation with the compilation.
It would greatly help me if you can show me how you managed to add the contents of the core and wrap directories.

Hi, I’m interested in this as well!