title: Compiling 32-bit GTK+ Applications of 64 bit Linux
body: <p>I am having some trouble compiling 32-bit GTK+ applications on 64-bit Linux, specifically Ubuntu 10.04.  Compiling 64-bit GTK+ applications works fine, and everything is set up to compile 32-bit apps as well, but it doesn't work with GTK+</p>
  
  <p>I have a very simple test program that I am using for trouble shooting that is simply a gtk_init and a gtk_main, which compiles fine as -m64.  I am compiling with gcc 4.6.2, calling it with:</p>
  
  <pre><code>gcc -m32 gtktest.c `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
  </code></pre>
  
  <p>These are the two different kinds of error messages I get:</p>
  
  <pre><code>/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libXext.so.6, needed by /usr/lib/../lib32/libgtk-x11-2.0.so, not found (try using -rpath or -rpath-link)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>/usr/lib/../lib32/libgdk-x11-2.0.so: undefined reference to `XmbSetWMProperties'
  </code></pre>
  
  <p>Keep in mind that these aren't the only errors, I just included the two specific types for reference and to keep it short, I get errors for the whole stack of GTK+ libraries.</p>
  
  <p>I do have all of the proper 32-bit versions of the libraries in my lib32 folders.</p>
  
  <p>Hopefull someone has had this problem before and can help me, this is really causing me quite the headaches, and I can't fine much help any where on the net.</p>
  
  <p>Please ask if there is any other information you need me to provide to help with diagnosing this problem.</p>
  
  <p>Note: I do have the ia32-libs and gcc-multilib packages.  Ubuntu 10.04 does not have a separate ia32-libs-gtk packages, but I think these are wrapped in to the ia32-libs packages. They all are present on my system.</p>
  
  <p>I think this must be some sort of linker config problem.  I've recently built the new Free Pascal compiler and a 32 bit cross compiler, and I also upgraded GCC to 4.6.2 to take advantage of some of the new C++ features and fixes to C99 support.  The default 4.4.3 GCC still exists on my system.  Where I think the problem has been introduced is when I installed a new binutils because I've been experimenting with Clang and LLVM as a toolchain, and I wanted and ld with plug-in capabilities, so I figured might as well upgrade them all.  </p>
  
  <p>Everything works fine compiling 64 bit programs, there hasn't been a single problem with the new tools at all, and I can compile 32-bit programs but when it comes time to explicitly link something in I have problems.</p>
  
  <p>I know my current set of libs is appropriate, and I have Free Basic installed which only emits 32 bit code, and I was able to build 32-bit GTK+ programs no problem before this upgrade.</p>
  
  <p>Just wondering if anyone has any ideas what configs might have been changed in this upgrade or has had this happen to them before?  I really should upgrade to a newer distro so I can take advantage of all the new software with out have to hack up all of my packages, but unfortunatly there is a bug in the newer kernels that prevents my computer from coming back from standby, and this is a laptop I use for personal side projects, so proper power management is pretty important, and it's not a huge loss if I bork the system, other than I have it set up pretty much perfect for my workflow. </p>