4

I have an old program compiled for an ubuntu 16.04 i386, I need to run it or recompile for i386 architecture in my new pc (change 32 to 64 bit is quite complicated in this code". I have an ubuntu 22.04.1 but I dont know how to run 32 bit program on 64 bit ubuntu

  • 1
    If you let us know what the program is (assuming it's open source or source available) someone may be able to provide you with a guide. Without knowing which program it is, the options may be many, or limited. – popey Feb 15 '23 at 12:26
  • @popey It is not an open source code, but the problem will be the same as if I did with a Hello World Window with some push buttons and tables... – Juan Jose Feb 15 '23 at 12:38
  • 1
    So your real question is how can you run a 32 bit program on a 64 bit OS? – David Feb 15 '23 at 12:56
  • No, it isn't the same. Dependencies, how it's built (cmake vs make or whatever) and so on makes it different. I might have recommended bundling in a snap or lxc or docker, depending on what it was. – popey Feb 15 '23 at 12:56
  • @popey it is a c++ Program and it uses a lot of qt libs and only libusb lib. It uses make for build – Juan Jose Feb 15 '23 at 13:01
  • @David yes it is. I do not need to compile it... – Juan Jose Feb 15 '23 at 13:02
  • 1
    What happens if you just run it? What does it complain about? 32-bit code can run on 64-bit installs. But some of the 32-bit libraries it may depend on have been removed, making this problem harder to solve. – popey Feb 15 '23 at 13:04
  • @popey bash: ./motor No such file or directory so I did ls -la -rxwxr-xr-x 1 user user 7414460 Feb 14 15:15 motor – Juan Jose Feb 15 '23 at 13:15
  • can you run ldd ./motor and see what libraries it's after? – popey Feb 15 '23 at 13:16
  • @popey not a dynamic executable – Juan Jose Feb 15 '23 at 13:17
  • Might need to use strace to see what it's after. If it's something you only need now and then, you could spin up a 32-bit 16.04 VM and run it there, but if you need it regularly, it's likely you're going to need to port to 64-bit or get someone else do to the port. – popey Feb 15 '23 at 13:26
  • No such file or directory and not a dynamic executable likely mean you don't even have a loader for 32-bit executables (ex. /lib32/ld-linux.so.2) on your system - at a minimum, you will need to add the i386 architecture and install the libc6:i386 package I think. Then you will be able to see what other 32-bit dynamic libs are missing. – steeldriver Feb 15 '23 at 13:44
  • 2
    @steeldriver you where right I finally got it. Simply run the following commands: sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libc6:i386 libstdc++6:i386 I also installed the following packages from apt

    sudo apt-get install qtbase5-dev:i386 qtmultimedia5-dev:i386 Now everything is working perfectly.

    – Juan Jose Feb 15 '23 at 13:56
  • 2
    @JuanJose can you answer your own question? That will help other users in the future – Archisman Panigrahi Feb 15 '23 at 14:11
  • Does this answer your question? Can't install i386 package(s) – NotTheDr01ds Feb 20 '23 at 13:03
  • @NoElDr01ds No, It doesnt – Juan Jose Feb 20 '23 at 22:02

1 Answers1

2

First

sudo dpkg --add-architecture i386 
sudo apt-get update
sudo apt-get install libc6:i386 libstdc++6:i386

This allow my system to recognize which libraries the program needs. Then, know libs needed.

ldd your_program_name

I needed a lot of Qt libs so I installed.

sudo apt-get install qtbase5-dev:i386 qtmultimedia5-dev:i386

That is all that I needed.