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

1 view (last 30 days)
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
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
Matt J on 26 Oct 2012
Edited: 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.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 26 Oct 2012
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?
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
Image Analyst
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
Matt J on 31 Oct 2012
Edited: Matt J on 9 Nov 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.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!