116

I installed Ubuntu 14.04 (Trusty Tahr) yesterday. Everything seems OK. But when I tried to compile some C code, I encounter the following error. The error seems to be due to the OS lacking the 32-bit architecture support. The error output is as following:

/usr/bin/ld: i386 architecture of input file `./libsc.a(ftl_msg.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `./libsc.a(libsc_debug.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `./libsc.a(libsc_str.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `./libsc.a(libsc_cfg_common.o)' is incompatible with i386:x86-64 output

I used to apt-get install ia32-libs when I was using Ubuntu 12.04 (Precise Pangolin). But what I know is that Ubuntu has removed the ia32-libs since Ubuntu 13.10 (Saucy Salamander). How can I fix this problem?

Adnan Y
  • 2,982
  • 1
  • 26
  • 29
andycoder
  • 1,593
  • 2
  • 11
  • 10
  • Check the multiarch information for Ubuntu. You can append :i386 to a package name to install the 32bit version of it. – TeTeT Apr 21 '14 at 06:49
  • 1
    I have exactly this problem, i need the ia32-libs for running fortinet vpn client, it worked perfectly under 10.04 LTS and 12.04 LTS. I tried 'sudo apt-get install ia32-libs:i386' but doesn't work, i've also installed the 'lib32z1 lib32ncurses5 lib32bz2-1.0' packages but they don't work. – javaPhobic Apr 21 '14 at 08:44
  • @javaPhobic I decide to install ubuntu12.04(32bit). About my question, I have got some answers. They are not my keys, but may give help to you. 1. you can try make clean then make your code again. 2. you can try to install whole ia32-libs, just like what Mike Tang's answer. 3. you can try to add ``-m32` when you compass your code, for example: `gcc -m32 helloworld.c`. Good luck. – andycoder Apr 21 '14 at 09:38
  • This should really be on Server Fault. – AStopher Feb 19 '15 at 22:33
  • 2
    I'm voting to close this question as off-topic because its about the location of libraries for linux. While tangentially *about* programming, the solution will be more of a linux configuration answer, not a programming one. – BradleyDotNET Feb 19 '15 at 22:37
  • Possible duplicate of [How to make Android's aapt and adb work on 64-bit Ubuntu without ia32-libs (works for versions 12, 13 and 14)](https://stackoverflow.com/questions/19523502/how-to-make-androids-aapt-and-adb-work-on-64-bit-ubuntu-without-ia32-libs-work) – Alex P. Jun 01 '18 at 22:31

11 Answers11

140

You can try this to install the 32-bit library (not all in ia32-libs):

sudo  apt-get install program:i386

sudo dpkg --add-architecture i386 may be required (if you haven't ever run that).


Or if you want to install the whole ia32-lib instead, try the following order:

sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs

PS: In this way, you can install ia32-libs. However, we add the source of 13.04 instead, so, there may be some unknown problem. After installing ia32-libs, I recommend you to remove the ia32-libs-raring.list in /etc/apt/sources.list.d, and do sudo apt-get update.


If you want to fix the dependency of Android SDK, you can try this bellow:

sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
D0n9X1n
  • 2,114
  • 1
  • 14
  • 17
  • 3
    E: Package 'ia32-libs' has no installation candidate – ThatAintWorking May 04 '14 at 20:37
  • 2
    I couldn't access archive.ubuntu.com. Lots of _not found_ while `apt-get update`. So I changed the package source to `deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multi verse`. Now it works. – Tim Wu Jul 18 '14 at 00:54
  • 3
    Raring archive is not available on the ubuntu archive anymore. I changed the raring archive for the precise archive. Package ia32-libs will install now. – Martijn Burger Aug 05 '14 at 11:23
  • Doesn't work on 14.04. The solution that works for me is Aleksei's answer. – joelparkerhenderson Dec 10 '14 at 06:39
  • 1
    the second line is echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >/etc/apt/sources.list.d/ia32-libs-raring.list – Vigen Oct 15 '15 at 08:36
  • I was trying to install this for PlayOnLinux. It did work for me. – Chris1804505 Nov 07 '15 at 02:33
  • This is a very terrible solution. (1) You should minimize how you are using an unsupported mix of releases, such as by pinning it to use only a very specific set of packages. (2) You don't need to do this at all for non-bugged packages... just use the packages that are in the new release instead of the old ones. And for bugged packages that depend on non-existent packages, this is not the right way either. Report the bug and use apt-get with some option to ignore deps (I don't know which... can't find it... or use dpkg --ignore-depends=package) until it's fixed. – Peter Jul 08 '16 at 07:50
80

Install gcc multiple library.

sudo apt-get install gcc-multilib
Nelson Chen
  • 801
  • 6
  • 2
  • 3
    This gcc-multilib meta package in 14.04 is the closest drop-in replacement for the ia32-libs meta package that was in 12.04 that I have encountered so far, but it still doesn't satisfy package dependencies that are explicitly set to ia32-libs. – quickthyme Jul 31 '14 at 22:25
  • 7
    Can't upvote this enough. This and `libstdc++6-4.7-dev:i386` is required to extract the Internet Explorer virtual machines from www.modern.ie – Tek Aug 07 '14 at 20:39
  • this still works on Ubuntu 16.04 (but I don't know how complete it is) – Peter Jul 07 '16 at 12:26
  • I also had to: `sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0` – Mike Godin Apr 13 '17 at 21:50
  • Thanks to this post and this: https://unix.stackexchange.com/questions/407432/cups-reports-all-successful-but-nothing-prints-on-brother-hl-2240-series-usb-pr i was able to setup my Brother DCP J152 as printer in CUPS. Thanks!! – Josef Biehler Dec 20 '20 at 11:39
56

The best answer I have ever seen is How to run 32-bit applications on Ubuntu 64-bit?

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo ./adb
Community
  • 1
  • 1
Aleksei
  • 1,207
  • 1
  • 13
  • 16
  • 2
    It was totally a problem with my adb (packed with clockworkmod carbon/helium). Thanks for that answer which was spot on for my problem (maybe not OP problem, though ^^). And anyway, this answer seems to me to be the cleaner. No adding previous previous ubuntu version repository link, which will create a big mess afterwards I'm sure… – Dolanor Oct 04 '14 at 12:30
  • 1
    This also did the trick for me, where I got the unhelpful (and hardly any Google results too, so pray this gets indexed) error "error while loading shared libraries: libncurses.so.5". Thanks! – Honoki Nov 17 '14 at 20:56
  • great answer for Ubuntu 14.04 but doesn't work on 16.04 – Peter Jul 07 '16 at 12:23
29

I got it finally! Here is my way, and I hope it can help you :)

sudo apt-get install libc6:i386
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
rm /etc/apt/sources.list.d/ia32-libs-raring.list
apt-get update
exit
sudo apt-get install gcc-multilib

I don't know the reason why I need to install these, but it works on my computer. When you finish installing these packages, it's time to try. Oh yes, I need to tell you. This time when you want to compile your code, you should add -m32 after gcc, for example: gcc -m32 -o hello helloworld.c. Just make clean and make again. Good luck friends.

PS: my environment is: Ubuntu 14.04 64-bit (Trusty Tahr) and GCC version 4.8.4. I have written the solution in my blog, but it is in Chinese :-) - How to compass 32bit programm under ubuntu14.04.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
andycoder
  • 1,593
  • 2
  • 11
  • 10
  • It's probably obvious to anyone actually having to do this, but don't put the "/" in the rm statement. – keefer May 19 '14 at 17:36
  • Yes, it's my mistake. I have fixed it now. Thank you~ @keefer – andycoder May 21 '14 at 03:22
  • 2
    -1: While this works, it is **really bad** practice. There are much better solutions in this [AskUbuntu post](http://askubuntu.com/q/107230/145754) that don't require installing old repositories. This method should only be needed for very old binary packages. But as you have the source code, this method is really not appropriate. – jmiserez Aug 06 '14 at 03:12
  • Raring archive is not available on the ubuntu archive anymore. I changed the raring archive for the precise archive. Package ia32-libs will install now. – Zhenya Sep 02 '14 at 09:41
  • -1 for me too. You will face a ton of problems with dependencies coming from 2 versions. Even if you removed the raring references afterwards. Totally agree with @jmiserez. – Dolanor Oct 04 '14 at 12:33
  • Do not mix two sources for this. See the better answer by Aleksei. – joelparkerhenderson Dec 10 '14 at 06:38
20

These alternative libraries worked for me:

sudo apt-get update
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
Paolo Rovelli
  • 9,396
  • 2
  • 58
  • 37
wisbucky
  • 33,218
  • 10
  • 150
  • 101
17

I had the same problem as above and Eclipse suggested installing:

Hint: On 64-bit systems, make sure the 32-bit libraries are installed:   
   "sudo apt-get install ia32-libs"    
or on some systems,  
   "sudo apt-get install lib32z1"   

When I tried to install ia32-libs, Ubuntu prompted to install three other packages:

$ sudo apt-get install ia32-libs  
Reading package lists... Done  
Building dependency tree         
Reading state information... Done  
Package ia32-libs is not available, but is referred to by another package.  
This may mean that the package is missing, has been obsoleted, or  
is only available from another source  
However the following packages replace it:  
  lib32z1 lib32ncurses5 lib32bz2-1.0  

E: Package 'ia32-libs' has no installation candidate  
$   
$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0    

With Android Studio and intellij, I also had to install the 32bit version of libstdc++6:

sudo apt-get install lib32stdc++6
Community
  • 1
  • 1
Bob
  • 780
  • 9
  • 10
8

For me, I have to run

sudo dpkg --add-architecture i386

before running Mike Tang's answer. Otherwise, I can't install ia32-libs.

Skippy le Grand Gourou
  • 6,976
  • 4
  • 60
  • 76
fkpwolf
  • 373
  • 4
  • 13
4

Simply install the 32-bit version of the program, instead of the 64-bit version.

This is much safer than installing packages that are not intended for the distribution at hand.

I got this suggestion from the Google Earth installation instructions for Ubuntu 14.04. Google Earth used to employ ia32-libs under 64-bit Ubuntu 12.04.

Quoting webupd8.org:

The ia32-libs package is no longer available in Ubuntu, starting with Ubuntu 13.10. The package was superseded by multiarch support so you don't need it any more, but some 64bit packages (which are actually 32bit applications) still depend on this package and because of this, they can't be installed in Ubuntu 14.04 or 13.10, 64bit. [...]

The "fix" or more specifically the correct way of installing these apps which depend on ia32-libs is to simply install the 32bit package on Ubuntu 64bit. Of course, that will install quite a few 32bit packages, but that's how multiarch works.

The problem with some programs (like Google Earth) is that the 32-bit package does not support multiarch. Consequently, some 32-bit dependencies need to be installed manually to make the 32-bit version of the program run on Ubuntu 64-bit.

sudo dpkg --add-architecture i386 # only needed once
sudo apt-get update
sudo apt-get install libfontconfig1:i386 libx11-6:i386 libxrender1:i386 libxext6:i386 libgl1-mesa-glx:i386 libglu1-mesa:i386 libglib2.0-0:i386 libsm6:i386
Serge Stroobandt
  • 28,495
  • 9
  • 107
  • 102
2
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
rm /etc/apt/sources.list.d/ia32-libs-raring.list
apt-get update
exit

If you are in China, you can modify "raring" to "precise" (for Ubuntu 13.04 (Raring Ringtail) and Ubuntu 12.04 LTS (Precise Pangolin), respectively). I installed Beyond Compare on Ubuntu 14.04 (Trusty Tahr).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

The problem is that in many cases the packages are multiarch already so the i386 package is not available, but other packages still depend on the i386 package only. This is a problem in the repository, and the managers of the repos should fix it

0

A solution is add the corresponding Debian package way to your repository. For this, type the below commands:

echo "deb ftp.us.debian.org/debian wheezy main" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install ia32-libs-i386

The first line writes in the end of the sources.list file the package way. This works for me. I wish that helps you.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
bbruno5
  • 111
  • 1
  • 4
  • 9