10
$ sudo apt-get install libffi libffi5-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libffi
E: Unable to locate package libffi5-dev

another try:

$ sudo apt-get install libffi5 libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libffi5

and

$ cat /etc/issue  
Ubuntu 12.04.4 LTS \n \l

What am I supposed to do now?

3 Answers3

22

The packages are be called libffi6 and libffi-dev.

Package names can be searched on http://packages.ubuntu.com/


For searching packages use apt-cache search.
Example in your case following can help you:

$ apt-cache search libffi
libffi-dev - Foreign Function Interface library (development files)
libffi6 - Foreign Function Interface library runtime
libffi6-dbg - Foreign Function Interface library runtime (debug symbols)
ffindex-dbg - simple index/database for huge amounts of small files (debug)
libbfio-dbg - Library to provide basic input/output abstraction (debug)
libffindex0 - library for simple index/database for huge amounts of small files
libffindex0-dev - library for simple index/database for huge amounts of small files (development)
libjffi-java - Java Foreign Function Interface
libjffi-jni - Java Foreign Function Interface (JNI library)
Pandya
  • 35,771
  • 44
  • 128
  • 188
Jan
  • 12,291
  • 3
  • 32
  • 38
  • 1
    @Jan Edited (Improved) your answer by providing apt-cache search. – Pandya Sep 11 '14 at 13:42
  • libffi5 and libffi6 aren't the same thing. For example when downloading and running pypy3 on raspbian, I will still get "error while loading shared libraries: libffi.so.5: cannot open shared object file: No such file or directory" – Ant6n Oct 21 '19 at 02:04
1

Your Ubuntu package repository may be too old to update.

Keep in mind select the suitable architecture and change your package repository url by adding a line to your /etc/apt/sources.list like this:

deb https://launchpad.net/ubuntu/+mirror/mirror.enzu.com-archive focal main

There are alternative other mirror links like https://launchpad.net/ubuntu/+mirror/mirror.enzu.com-archive.

Select the suitable mirror based on your region and internet speed.

or you can download the package directly and install it.

gogog
  • 121
1

You can also try installing the upstream Debian libffi5 package, if another package specifically requires libffi5.

See: https://packages.debian.org/wheezy/libffi5 or the appropriate upstream Debian version for your Ubuntu release.

Download the appropriate Debian package (.deb) for your architecture, and install using dpkg; e.g. dpkg -i libffi5_3.0.10-3+deb7u2_amd64.deb. Then either fix the original install (apt-get -f install), or reinstall the desired package (apt-get install ...).