Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Compiled .EXE can't find mex, but I can see it in the CTF archive!

Asked by Matt J on 25 Oct 2012

I've compiled an application, which contains a mex file called iprodFloat.mexw32. On the machine where I compile, it runs fine. I'll footnote here that this machine is 64-bit, running Windows 7, but I compiled the application within a 32-bit MATLAB installation.

On the target 32-bit machine, the application launches successfully, but quits with an error part way through, saying that it cannot find iprodFloat.mexw32. However, the error message gives the full path to the ctf archive folder where it failed to find the file, and when I go there, I can see the mex file sitting there in plain view. Obviously, I'm at a loss as to why the application cannot find it!

To double check, I deleted the CTF archive on the target machine and ran the .exe again. This regenerated the CTF archive, again containing iprodFloat.mexw32, but again the .exe quit with the same error.

The only thing that looks a bit suspicious to me is that the CTF archive also contains a file called iprodFloat.mexw32.auth. I'm wondering what the purpose of such a file is, and if it restricts access permission to the file somehow.

Would be grateful for any insights!

2 Comments

George on 25 Oct 2012

Hi Matt, I do not know what the iprodFloat.mexw32.auth file is or does.

I think that the user running the exe must have read & write permission to the directory where iprodFloat.mexw32 exists. Is that condition met on the machine where it fails?

Matt J on 26 Oct 2012

Hi George, since the application partially runs, and uses other files in that directory, that seems to suggest that permissions to access the directory are present. Also, the .exe creates that directory. It doesn't seem likely that it would create it, but then not be able to access it.

Matt J

Products

1 Answer

Answer by Image Analyst on 26 Oct 2012
Accepted answer

What platform is this on? Windows 7? If so, the exe unpacks the actual executable to some hidden folder in the c:\users\Matt\blah blah blah folder. Put this line in your startup code to see where it actually lives:

ctfroot

It may not be where you thought it was. So if it is in your Users folder, permissions would not be an issue. UNLESS you did a cd() in your code - which is usually not advised. Is there a cd anywhere in your code?

Have you also gone through the items in the FAQ: http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F

Is the application that tries to use your mex file a MATLAB-compiled executable, or some other program, like one created in Visual Studio?

5 Comments

Matt J on 26 Oct 2012

Well, I guess it can't hurt to check. But wouldn't a missing dependent file be mentioned by name in the error messages? Why would only the mex that calls it be mentioned?

Image Analyst on 26 Oct 2012

If a DLL or mex is missing a dependent file, you won't know about it since it will only mention the main one. Well it might if it uses late binding but that's rarely the case in situations I've seen - they're almost always early binding. In other words, it checks in advance for all the dependent files that it may possibly need even if it never actually does call them all. With late binding, it doesn't check for a dependent file until the time when it actually needs to call that file.

Matt J on 31 Oct 2012

I overlooked Item 7 in the FAQ. It was missing the MS Visual C Redistributable.

For whatever reason, though, this is only an issue when compiling under a 32-bit MATLAB version. When I compile under 64-bit, there's no problem.

Image Analyst

Contact us