0

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 version of libgtk-3-dev. I could not do this without removing important system packages. In the end I resorted to simply using a 32bit linux distro with the 32bit version of libgtk-3-dev installed.

1 Answer 1

2

You could run:

apt-get install libgtk-3-dev:i386

then rerun your compile command and it should work. If the above command returns an error saying it cannot find the package specified, you may need to run this, then try again:

dpkg --add-architecture i386

Warning: If the command above asks you to remove packages, read the list carefully, if the list includes important system packages or if you are unsure then do not proceed.

10
  • How do I undo the effects of dpkg --add-architecture i386, I tried sudo dpkg --remove-architecture i386 but I got this error - dpkg: error: cannot remove architecture 'i386' currently in use by the database
    – olfek
    Commented Jul 11, 2016 at 21:14
  • Did you remove libgtk-3-dev:i386 and all its dependencies?
    – oldtechaa
    Commented Jul 12, 2016 at 1:39
  • I didn't install it. I stopped when it said it wanted to remove a bunch of packages, one of them was the desktop environment.
    – olfek
    Commented Jul 12, 2016 at 9:09
  • 1
    Found the solution/explanation. link
    – olfek
    Commented Jul 12, 2016 at 10:49
  • 1
    See wiki.debian.org/Multiarch. the immediate practical effects are getting rid of the ia32-libs package, and allowing proper cross-architecture dependencies for cross-building. According to that wiki, dpkg became multiarch-aware in 2011. Commented Jul 15, 2016 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.