Almost every Linux system is available for 32-bit system architecture as well as 64-bit architecture. But the problem is that, by default, an application written to run on 32-bit system will not work on a 64-bit system and vice versa. This can be really painful since nobody wants to develop two source codes for the same application or maintain 2 separate binary files, for different architecture. You can solve this by making a 32-bit program to be able to run on 64-bit architecture. In this article, we will learn how to run 32-bit app on 64-bit Linux.
How to Run 32-bit App on 64-bit Linux
Here are the steps to run 32-bit app on 64-bit Linux. To be able to run a 32-bit program on 64-bit Linux system such as Ubuntu, you need to add i386 architecture and install 3 library packages libc6:i386, libncurses5:i386, and libstdc++6:i386.
1. Add 1386 Architecture
Open terminal and run the following command to do it.
$ sudo dpkg --add-architecture i386
In case you are using Ubuntu <=12.04 use the following command instead.
$ echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch
2. Install Required Package Libraries
Then run the following command to install 3 package libraries.
$ sudo apt-get update $ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
If the above command fails, run the following command instead.
$ sudo apt-get install multiarch-support
3. Execute 32-bit Program
Now you should be able to run your 32-bit program on 64-bit system. Replace sample32bitprogram below with the filename of your program’s binary.
If you are running an incompatible version of gcc on your Ubuntu system you may get an error while running above commands, you may need to update your system gcc using the following command.
$ sudo apt-get install gcc-multilib
In this article, we have learnt how to run 32-bit programs on 64-bit, without creating separate binary files for both 32-bit as well as 64-bit systems.
How to Change File Extension Of Multiple Files in Python
How to Change File Extension of Multiple Files in Linux
How to Remove HTML Tags from CSV Using Python
How to Convert PDF to CSV Using Python
How to Convert PDF to Text in Python