Is it possible to create a 32bit standalone executable on a 64bit machine? - matlab

I'm creating a standalone executable from MATLAB .m file using mcc.
My machine is a 64bit machine and the target machine is 32bit machine, is it possible to create such an application (and to be able to run it on the target machine of course)?

Probably the simplest way to do this is to install the 32 bit version of MATLAB and use the mcc from that installation.
Don't worry about the warnings that you get about installing 32 bit MATLAB on 64 bit Windows. It works just fine. I have lots of different versions of MATLAB installed on my machine for development purposes, both 32 and 64 bit, all happily co-existing side by side.
The documentation also mentions a -win32 option that can be passed to mcc:
-win32 Run in 32-Bit Mode
Use this option to build a 32-bit application on a 64-bit system only
when the following are both true:
You use the same MATLAB installation root (matlabroot) for both 32-bit and 64-bit versions of MATLAB.
You are running from a Windows command line (not a MATLAB command line).
Since you have to install 32 bit MATLAB, no matter what, it seems to me that it's just easier to run the 32 bit mcc directly.

Related

compile perl script using par::packer and run it on different linux versions

I have a Perl script which I tried to use PAR::Packer in order to make it a standalone executable so it runs without having Perl on the target machine (because of security reasons).
I used WSL on Windows to pack the Perl script, but the problem I have when I run it on the target machine is the error: "version `GLIBC_2.29' not found".
I ran the command ldd --version and the version on the target machine is 2.17.
The problem I am facing is I cannot install anything on the target machine so I cannot install Perl + PAR::Packer to compile the script and then distribute it to the other machines that are gonna use the script (it's gonna be used in an image so lots of machines).
I cannot seem to find a solution or alternative for this, would love any help from the community.
Edit:
the ubuntu on my WSL was ubuntu 22, the target machines runs redhat and not debian variant, IDK which version as they are a custom linux made by the company i work in.
why am i stuck?
the main problem is that PAR::Packer isn't working on old ubuntu builds ( before 14) and at ubuntu 14 the glibc is already 2.22 while on version 12 its 2.15 so I need to compile the script on old ubuntu (version 12) but the compiling program (PAR::Packer) only works on ubuntu 14 and above so I am stuck in a loop and would apprentice any help or even alternatives for this problem.
Thanks!
Edit: the ubuntu on my WSL was ubuntu 22, the target machines runs redhat
Your problem is that you are trying to build on newer Linux machine, and run the resulting binary on older Linux. That doesn't work (without additional effort).
The simplest solution is to build on the oldest Linux distribution you need to support, possibly in a docker container.
Some other solutions are listed here.

Why my m-file compiled with mcc does not run on my laptop (with Matlab) and on my pc (with MCR 8.2)?

I compiled an M-file on my laptop, obtaining an EXE file (lets say myexe.exe). I have MATLAB 2011b installed.
If I double click on myexe.exe, or if I run it from MATLAB command prompt with !myexe.exe, a window pops up saying:
Could not find version 7.16 of MCR. Attempting to load mclmcrrt7_16.dll.
Please install the correct version of the MCR.
Now, MATLAB Compiler Runtime (MCR) should be a standalone set of shared libraries that enables the execution of compiled MATLAB applications or components in computers in which MATLAB is not installed. I have MATLAB on my PC so why is it complaining about MCR?
Also, I copied this file to another computer in which I do not have MATLAB but I have MCR 8.2, it gives me the same error. I thought MCR was ensuring backward compatibility. Should I copy the MCR version 7.16 from my laptop to my PC and install it (I saw it is located in C:\Program Files\MATLAB\R2011b\toolbox\compiler\deploy\win64\MCRInstaller.exe, and I saw here that 7.14 is the MCR corresponding to MATLAB 2011b)?
What about my Laptop? Do I have to install MCR version 7.16 also there? I don't get why I should.
thanks
A.

Failing to force Python 2.7.4 to run in 32-bit mode on OS X 10.8.3

I have been trying to force Python 2.7.4 to run in 32-bit mode on OS X 10.8.3 by default. I can get Python to run in 32-bit mode by running python32. But when I try to configure Eclipse+PyDev to run Python, it ends up running in 64-bit mode.
I have also tried
export VERSIONER_PYTHON_PREFER_32_BIT=yes
and
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
but neither seem to have any effect on my Python, and it still runs in 64-bit.
I was wondering if anyone has any idea how to permanently run Python 2.7 in 32-bit mode. Alternately, I am open to any solution that makes Eclipse/PyDev use the 32-bit Python.
My Python has been installed in /Library/Frameworks/Python.framework/Versions/2.7 and sys.executable returns /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python on my computer.
Thanks.
This made python go to 32-bit:
arch -i386 /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
import ctypes
print ctypes.sizeof(ctypes.c_voidp)
output -> 4
but I had the same issue as you that couldn't setup a permanent solution with environment flags as before.

Compile native Windows executable from perl source on linux

I have a perl script on a linux system that I would like to compile to generate an executable that runs natively on Windows. I would like to do this with free software, preferably Perl PAR / pp. Is this possible?
You need to run pp on a windows machine to make a windows binary. I know it works, I've done it. Any Linux specific code will need to be made at least platform-independent or windows specific, but Perl is a generally platform independent language. Using File::Spec will help.

Nant on Windows Vista 64

I was wondering if anyone has successfully ran Nant on Windows Vista 64 bit version. It keeps failing with
set-props:
[sysinfo] Setting system information properties under sys.*
BUILD FAILED
Property name 'sys.env.CommonProgramFiles(x86)' is invalid.
Yes, it works. NAnt is by default built for 32-bit. Therefore, one has to remember to run this in a 32-bit command prompt or PowerShell. I run NAnt scripts out of PowerShell (x86) mode on a Vista 64 machine, but an SDK prompt (32-bit) would works as well.
It also has worked well for me. I do run as Scott said in a 32bit command prompt.
It could also be just a specific thing you are trying to capture that nAnt is not expecting.
I've been using NAnt on my Windows 7 64 bit environment, and have found that in order to do so (without needing to use a 32bit command environment) is to simply remove the reference in your NAnt scripts to sysinfo.
I have been through our build scripts over and over and cannot see any downside to removing this setting, as I cannot prove that I'm using the result of it anyway, other than to dump lots of data to the screen which is invaluable during debugging!!
Hope this helps!