Skip to content

Fix installation location of libffi#448

Open
ffontaine wants to merge 1 commit into
libffi:masterfrom
ffontaine:master
Open

Fix installation location of libffi#448
ffontaine wants to merge 1 commit into
libffi:masterfrom
ffontaine:master

Conversation

@ffontaine

@ffontaine ffontaine commented Aug 30, 2018

Copy link
Copy Markdown
Contributor

The libffi is currently declared as toolexeclib_LTLIBRARIES. In many
cases, toolexeclib libraries will be installed in /usr/lib, so it
doesn't make any difference.

However, with multilib toolchains, they get installed in a
subdirectory of /usr/lib/. For example, with a Sourcery CodeBench
PowerPC toolchain, if the e500mc multilib variant is used, the libffi
library gets installed in /usr/lib/te500mc/. This is due to the
following code in the configure script:

  multi_os_directory=`$CC -print-multi-os-directory`
  case $multi_os_directory in
    .) ;; # Avoid trailing /.
    *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  esac

Once the library is installed in /usr/lib/te500mc/, nothing works
because this installation location is inconsistent with the
installation location declared in libffi.pc.

So, instead of using this bizarre toolexeclib_LTLIBRARIES, simply use
the more standard lib_LTLIBRARIES, which ensures that the libffi
library is always installed in /usr/lib.

Signed-off-by: Thomas Petazzoni thomas.petazzoni@free-electrons.com
[unfuzz for 3.2.1]
Signed-off-by: Jörg Krause joerg.krause@embedded.rocks
[Patch retrieved from:
https://git.buildroot.net/buildroot/tree/package/libffi/0001-Fix-installation-location-of-libffi.patch]
Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

The libffi is currently declared as toolexeclib_LTLIBRARIES. In many
cases, toolexeclib libraries will be installed in /usr/lib, so it
doesn't make any difference.

However, with multilib toolchains, they get installed in a
subdirectory of /usr/lib/. For example, with a Sourcery CodeBench
PowerPC toolchain, if the e500mc multilib variant is used, the libffi
library gets installed in /usr/lib/te500mc/. This is due to the
following code in the configure script:

  multi_os_directory=`$CC -print-multi-os-directory`
  case $multi_os_directory in
    .) ;; # Avoid trailing /.
    *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  esac

Once the library is installed in /usr/lib/te500mc/, nothing works
because this installation location is inconsistent with the
installation location declared in libffi.pc.

So, instead of using this bizarre toolexeclib_LTLIBRARIES, simply use
the more standard lib_LTLIBRARIES, which ensures that the libffi
library is always installed in /usr/lib.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[unfuzz for 3.2.1]
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
[Patch retrieved from:
https://git.buildroot.net/buildroot/tree/package/libffi/0001-Fix-installation-location-of-libffi.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
@bradbishop

Copy link
Copy Markdown

Was this patch ignored because of the CI failures?

@xnox

xnox commented Aug 20, 2020

Copy link
Copy Markdown

Ping, can this please be merged?

@atgreen

atgreen commented Sep 7, 2022

Copy link
Copy Markdown
Member

Wouldn't it be better to update libffi.pc?

@ffontaine

Copy link
Copy Markdown
Contributor Author

IMHO, as explained in the commit log, installing a library in toolexeclib_LTLIBRARIES is not really standard so this patch is probably better than updating libffi.pc. This patch has been applied in buildroot nearly 10 years ago.

@heitbaum

heitbaum commented Feb 5, 2026

Copy link
Copy Markdown

heitbaum pushed a commit to heitbaum/libffi that referenced this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants