Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am developing a 3D game/graphics/simulation engine on 64-bit ubuntu 12.04 LTS. The 64-bit version of my application compiles, links and executes just fine. However, I cannot build a 32-bit version of my application. I get the following build errors:

ld : cannot find -lX11
ld : cannot find -lcairo
ld : cannot find -lpango
ld : cannot find -lfreetype
ld : cannot find -lfmodex

My assumption is, I do not have 32-bit versions of some libraries installed. However, when I look for files with -i386 or :i386 suffix in "ubuntu software center", I don't see any. For example, if I enter "libcairo" in the search field, it shows:

libcairo2
libcairo2-dev
libcairo2-doc
libcairo2-dbg
plus a other irrelevant files (bindings for other languages).

No matter how I search, I cannot see any package names that imply 32-bit libraries.

How, exactly, are we supposed to develop 32-bit executables on 64-bit linux circa 2012 and beyond (ubuntu 12.04 LTS in my case)?

share|improve this question
    
Pondering same issue. I am just migrating my main PC to 64bit, but intend to keep a secondary machine for 32bit (or cross-platform) compilation. –  david6 Jun 8 '12 at 6:11
1  
That's not supposed to be necessary. A 64-bit operating system can run both 64-bit and 32-bit applications AND it is supposed to be possible to develop both 64-bit and 32-bit applications on 64-bit linux. In fact, before I switched to 64-bit ubuntu 12.04 LTS a week ago, I was developing my applications as both 64-bit and 32-bit on 64-bit ubuntu 10.04 LTS. –  honestann Jun 8 '12 at 7:50
    
LATER: As it turns out, we still need to install the ia32-libs package to get many fundamental 32-bit shared libraries installed on our computers. –  honestann Jun 11 '12 at 10:30
    
LATER: As it also turns out, once I installed the ia32-libs package on my computer, henceforth packages with :i386 started to appear in searches on "ubuntu software center". Wow! –  honestann Jun 11 '12 at 10:31

1 Answer 1

up vote 2 down vote accepted

Development packages are usually architecture-independent. For everything else, to get the i386 (32-bit) libraries you need to install the ia32-libs package in Software Center. That should automatically pull in all the i386 libraries you may need (depending on the 64-bit ones already installed).

enter image description here

share|improve this answer
    
But someone else told me gcc-multilib and g++-multilib are the new and improved replacements for ia32-libs. Is that wrong? –  honestann Jun 8 '12 at 7:47
    
gcc/g++-multilib are the cross-compilers -- they do not contain all the possible 32-bit shared libraries in the world an applicatin may need to link to! :) Those are provided by ia32-libs –  izx Jun 8 '12 at 7:54
1  
So ia32-libs will be needed into the indefinite future on 64-bit operating systems? Someone said it was obsolete, or soon would be (replaced by "multiarch", "multilib" or something). –  honestann Jun 8 '12 at 7:59
    
Okay, I installed ia32-libs, then make a whole slew of soft-links in directory /usr/lib/i386-linux-gnu to point to the verbose shared library files. For example, the soft-links I created in directory /usr/lib/i386-linux-gnu were: libX11.so libcairo.so, libpango.so, libpangocairo.so, libfmodex.so, etc). And that did the trick - I can now compile/link/execute the 32-bit versions of my 3D engine. Thanks! –  honestann Jun 8 '12 at 8:36
    
Thanks Ann -- multiarch was designed to ensure you don't have to do what you painstakingly did, but not all packages have been converted to multiarch yet, hence the need for ia32-libs. That's the short version, I'll edit the answer tomorrow to explain a little more about multiarch and how it affects cross-compiling, especially. :) –  izx Jun 8 '12 at 8:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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