Denis Vidale
Denis Vidale

Reputation: 1

Running 32bit linux (ubuntu) application on 64bit

I'm trying to run a 32bit executable developed on ubuntu 18.04 32bit on ubuntu 22.04 64bit. The applciation is compiled with GNU GCC Compiler with CodeBlocks (with -m32 flags) On Ubuntu 18.04 32 bit works fine. I've added the architecture on ubuntu 22.04 and also needed libraries

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

The application depends on libgtksourceview2.0. I've installed it and it's present in /usr/lib/x86_64-linux-gnu/ the path is also added on /etc/ld.so.conf.d/

When I try to run the applicatin I get the following error:

**error while loading shared libraries: libgtksourceview-2.0.so.0: cannot open shared object file: No such file or directory **

I've also tryed to compile the application on ubuntu 22.04 but all libraries which are installed under x86_64-linux-gnu seem to not be on search path.

Also other application which depends on libraries under that folder do not start.

Anyone can help me?

Thank you

I've tried to add the path on ld.so.conf.d. I've installed the library libgtksourceview several times

this is a part of ldd application

    libcairo.so.2 => /lib/i386-linux-gnu/libcairo.so.2 (0xf7328000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7223000)
libgtksourceview-2.0.so.0 => not found
libgdk-x11-2.0.so.0 => /lib/i386-linux-gnu/libgdk-x11-2.0.so.0 (0xf715c000)
libX11.so.6 => /lib/i386-linux-gnu/libX11.so.6 (0xf700d000)

I expect the application will run even on 64 bit environment

Upvotes: 0

Views: 2466

Answers (1)

couyoh
couyoh

Reputation: 313

You can't mix 32-bit and 64-bit code.

You said you added the -m32 flag. It means your application is 32-bit. But you also said that libgtksourceview2.0 is in /usr/lib/x86_64-linux-gnu/. It's considered 64-bit. (You can check by readelf -h).

Therefore, you need to build libgtksourceview2.0 in 32-bit, and then add it to the library path.

To add the library path, I think it's better to specify the built path to LD_LIBRARY_PATH. Other than that, copy built files to the path that is defined at /etc/ld.so.conf or /etc/ld.so.conf.d/*.conf. In your case, probably /lib/i386-linux-gnu/.

Upvotes: 1

Related Questions