cffi-libffi doesn't build with libffi from git due to changes in available ABIs (FFI_SYSV undefined)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
New
|
Undecided
|
Unassigned |
Bug Description
Loading cffi on openSuse Tumbleweed results in two errors.
The first one,
(FL-ERROR "Unable to load any of the alternatives:~% ~S" ("libffi.so.6" "libffi32.so.6" "libffi.so.5" "libffi32.so.5"))
is easily solved by providing ("libffi.so") as a value to be used instead.
This is because Tumbleweed comes with libffi7, from git. As far as I can tell from
their package changelog, it's https:/
This leads to another problem:
grov.c: In function ‘main’:
grov.c:72:41: error: ‘FFI_SYSV’ undeclared (first use in this function)
fprintf(output, "%"PRIiMAX, (intmax_
FFI_SYSV isn't defined because ffi_abi struct in ffitarget.h resolves to
#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
FFI_FIRST_ABI = 1,
FFI_UNIX64,
FFI_WIN64,
FFI_EFI64 = FFI_WIN64,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_UNIX64
leaving FFI_SYSV undefined.
As a temporary fix, I added #define FFI_SYSV 1 to grovel/common.h, and compiling worked
just fine for my case (https:/
but a proper patch is needed.
EDIT: Proposed patch
2 files changed, 7 insertions(+), 2 deletions(-)
libffi/
libffi/libffi.lisp | 2 +-
modified libffi/
@@ -65,7 +65,12 @@
((:sysv "FFI_SYSV"))
((:stdcall "FFI_STDCALL")))
-#-(or freebsd windows)
+#+(and x86-64 (not windows))
+(cenum abi
+ ((:default-abi "FFI_DEFAULT_ABI"))
+ ((:unix64 "FFI_UNIX64")))
+
+#-(or freebsd windows x86-64)
(cenum abi
((:default-abi "FFI_DEFAULT_ABI"))
((:sysv "FFI_SYSV"))
modified libffi/libffi.lisp
@@ -31,7 +31,7 @@
(:darwin (:or "libffi.dylib" "libffi32.dylib" "/usr/lib/
(:solaris (:or "/usr/lib/
(:openbsd "libffi.so")
- (:unix (:or "libffi.so.6" "libffi32.so.6" "libffi.so.5" "libffi32.so.5"))
+ (:unix (:or "libffi.so.6" "libffi32.so.6" "libffi.so.5" "libffi32.so.5" "libffi.so"))
(:windows (:or "libffi-6.dll" "libffi-5.dll" "libffi.dll"))
(t (:default "libffi")))
I don't know nearly enough about cffi internals to be sure it doesn't break other stuff. Otherwise I'd post this as a pull request.