Make 32 and 64 bit executable?

4 vues (au cours des 30 derniers jours)
D G
D G le 11 Juil 2012
Hello!
I have a script that makes an executable for an application. We used to just create a 64bit executable, but now we want a 32bit executable as well. I installed the 32bit MATLAB, but now whenever I create the 64bit executable it crashes right after starting (Windows', "x.exe has stopped working" error).
I have tried changing the compiler, but it has not had an effect.
How can I fix this?
Thanks!

Réponse acceptée

Image Analyst
Image Analyst le 11 Juil 2012
What crashes: MATLAB while compiling, or your application while running on the target computer? You need to be running the 32 bit version of MATLAB when you compile an executable for a 32 bit computer, and you need to be running the 64 bit version of MATLAB when you compile an executable for a 64 bit computer. You can do both of these on your 64 bit computer - you don't need a 32 bit computer. But you do need to re-run "mbuild - setup" (or so I've been told) whenever you switch from compiling on one version to compiling on the other version.
  5 commentaires
D G
D G le 11 Juil 2012
I think I have narrowed down the problem. It appears that the application crashes only when running on a machine that has both 32 and 64 bit versions installed. It appears that MATLAB is trying to run the 64 bit exe with 32bit MATLAB.
Any thoughts on this?
Image Analyst
Image Analyst le 11 Juil 2012
I might be able to see that happening on a 32 bit machine. The executable is not really the executable but rather a self extracting archive that unpacks the real executable and a bunch of other stuff to a hidden folder in your c:\users\Daniel\.... folder. And that is the one that actually gets run. If you run it again, I think it doesn't need to unpack the stuff and just goes right there to run it immediately. However if you tried to run your 64 on a 32 machine, and then it failed, and then tried to run the 32 bit executable, it might see that hidden stuff if unpacked and decide it doesn't need to do it anymore. Unfortunately it would then be running the 64 bit version which failed, rather than unpacking a new 32 bit version. So it would crash again. Put this line in your code to see where it actually is running:
fprintf('MATLAB is actually running from %s\n', ctfroot);
Since you paid a ton of money for the compiler, I suggest you ask the Mathworks for all the details. You can change where it unpacks all the stuff by changing the MCR_CACHE_ROOT environment variable to dot if you don't want all this stuff buried in some secret hidden folder. (Ask them how).

Connectez-vous pour commenter.

Plus de réponses (1)

hana
hana le 11 Juil 2012
you have to compile the 32bit executable on a 32bit machine and the 64bit one on a 64.
  2 commentaires
Image Analyst
Image Analyst le 11 Juil 2012
Not true.
Walter Roberson
Walter Roberson le 14 Juil 2012
Image Analyst is correct: compiling for 32 bit machines on a 64 bit machine has been officially supported for a couple of releases, and technical solutions were made public for how to do it for a couple of releases before that.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Compiler dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by