The Libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time.
FFI stands for Foreign Function Interface. An FFI allows a program written in one language to call a program written in another language. Specifically, Libffi can provide a bridge between an interpreter like Perl, or Python, and shared library subroutines written in C, or C++.
Like GMP, Libffi builds with optimizations specific to the
processor in use. If building for another system, change the
value of the --with-gcc-arch=
parameter in the
following command to an architecture name fully implemented by
the CPU on that system. If this is not done, all applications
that link to libffi
will trigger
Illegal Operation Errors.
Prepare Libffi for compilation:
./configure --prefix=/usr \ --disable-static \ --with-gcc-arch=native
The meaning of the configure option:
--with-gcc-arch=native
Ensure GCC optimizes for the current system. If this is not specified, the system is guessed and the code generated may not be correct. If the generated code will be copied from the native system to a less capable system, use the less capable system as a parameter. For details about alternative system types, see the x86 options in the GCC manual.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Clean previous build:
make distclean
Prepare Libffi for compilation:
CC="gcc -m32" CXX="g++ -m32" ./configure \ --host=i686-pc-linux-gnu \ --prefix=/usr \ --libdir=/usr/lib32 \ --disable-static \ --with-gcc-arch=i686
Compile the package:
make
To test the results, issue:
make check
Install the package:
make DESTDIR=$PWD/DESTDIR install cp -Rv DESTDIR/usr/lib32/* /usr/lib32 rm -rf DESTDIR
Clean previous build:
make distclean
Prepare Libffi for compilation:
CC="gcc -mx32" CXX="g++ -mx32" ./configure \ --host=x86_64-unknown-linux-gnux32 \ --prefix=/usr \ --libdir=/usr/libx32 \ --disable-static \ --with-gcc-arch=x86_64
Compile the package:
make
To test the results, issue:
make check
Install the package:
make DESTDIR=$PWD/DESTDIR install cp -Rv DESTDIR/usr/libx32/* /usr/libx32 rm -rf DESTDIR