sudoman sudoman - 4 months ago 21
Linux Question

Trying to compile GTK application for 32bit linux from 64bit linux

I am trying to compile a GTK application for 32bit linux from 64bit linux.

When I run this command:

gcc main.c -m32 -mms-bitfields -o output/main `pkg-config --cflags --libs gtk+-3.0` && ./output/main


I get these errors:

/usr/bin/ld: cannot find -lgtk-3
/usr/bin/ld: cannot find -lgdk-3
/usr/bin/ld: cannot find -latk-1.0
/usr/bin/ld: cannot find -lgio-2.0
/usr/bin/ld: cannot find -lpangocairo-1.0
/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/ld: cannot find -lcairo-gobject
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lcairo
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lglib-2.0
collect2: error: ld returned 1 exit status


Running Linux Mint 17.2 Rafaela.

I have all the required packages and I've even included the
-m32
option but it still doesnt work.

There is also a similar question here which doesn't have an accepted answer.

Edit:

The accepted answer below suggested I install the 32bit gtk lib. I could not do this without removing important system packages. In the end I resorted to simply using a 32bit linux pc with the 32bit gtk lib installed.

Answer

You could run:

dpkg --add-architecture i386
apt-get install libgtk-3-dev:i386

then rerun your compile command and it should work.