cffi / cffi

The Common Foreign Function Interface
http://common-lisp.net/project/cffi
MIT License
440 stars 134 forks source link

Fails to build on Darwin PowerPC: `error: 'FFI_SYSV' undeclared (first use in this function)` #379

Open barracuda156 opened 8 months ago

barracuda156 commented 8 months ago

Trying to build this on macOS PowerPC, I get the following failure:

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
; compiling file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi.lisp" (written 11 OCT 2023 06:01:47 PM):

; wrote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-tmp7LQ0A0VI.fasl
; compilation finished in 0:00:00.010
; pkg-config libffi --cflags
-I/opt/local/include
; /opt/local/bin/gcc-mp-13 -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel-tmp74KGUNRZ.o -c -arch ppc -g -Wall -O2 -fdollars-in-identifiers -D_XOPEN_SOURCE -mmacosx-version-min=10.6 -I/opt/local/include -isystem/opt/local/include/LegacySupport -fno-pie -I/opt/local/include/ -I/opt/local/include -fPIC -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c: In function 'main':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c:71:42: error: 'FFI_SYSV' undeclared (first use in this function)
   71 |   fprintf(output, "%" PRIiMAX, (intmax_t)FFI_SYSV);
      |                                          ^~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c:71:42: note: each undeclared identifier is reported only once for each function it appears in
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c:11:7: warning: unused variable 'autotype_tmp' [-Wunused-variable]
   11 |   int autotype_tmp;
      |       ^~~~~~~~~~~~
Unhandled CFFI-GROVEL:GROVEL-ERROR in thread #<error printing a SB-THREAD:THREAD: #<PRINT-NOT-READABLE {11C7A351}>>: Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {11C775F9}>
 with command ("/opt/local/bin/gcc-mp-13" "-o" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel-tmp74KGUNRZ.o" "-c" "-arch" "ppc" "-g" "-Wall" "-O2" "-fdollars-in-identifiers" "-D_XOPEN_SOURCE" "-mmacosx-version-min=10.6" "-I/opt/local/include" "-isystem/opt/local/include/LegacySupport" "-fno-pie" "-I/opt/local/include/" "-I/opt/local/include" "-fPIC" "-I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types__grovel.c")
 exited with error code 1

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {12EAE439}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<CFFI-GROVEL:GROVEL-ERROR "~a" {11C78CB9}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<CFFI-GROVEL:GROVEL-ERROR "~a" {11C78CB9}>)
2: (INVOKE-DEBUGGER #<CFFI-GROVEL:GROVEL-ERROR "~a" {11C78CB9}>)
3: (ERROR CFFI-GROVEL:GROVEL-ERROR :FORMAT-CONTROL "~a" :FORMAT-ARGUMENTS (#<UIOP/RUN-PROGRAM:SUBPROCESS-ERROR {11C78299}>))
4: (CFFI-GROVEL:GROVEL-ERROR "~a" #<UIOP/RUN-PROGRAM:SUBPROCESS-ERROR {11C78299}>)
5: ((FLET "THUNK" :IN CFFI-GROVEL:PROCESS-GROVEL-FILE))
6: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<FUNCTION (FLET "THUNK" :IN CFFI-GROVEL:PROCESS-GROVEL-FILE) {1000C1D}>)
7: (CFFI-GROVEL:PROCESS-GROVEL-FILE #P"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/source/cl-cffi/libffi/libffi-types.lisp" #P#<(SIMPLE-ARRAY CHARACTER (388)) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/.home/.cache/common-lisp/sbcl-2.4.0-macosx-ppc32/opt/local/va... {11C8F6FF}>)
8: ((:METHOD ASDF/ACTION:PERFORM (CFFI-GROVEL::PROCESS-OP CFFI-GROVEL:GROVEL-FILE)) #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">) [fast-method]
9: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unused argument> #<unused argument> #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">)
10: ((LAMBDA NIL :IN ASDF/ACTION:CALL-WHILE-VISITING-ACTION))
11: ((:METHOD ASDF/ACTION:PERFORM :AROUND (CFFI-GROVEL::PROCESS-OP CFFI-GROVEL::CC-FLAGS-MIXIN)) #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">) [fast-method]
12: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">) [fast-method]
13: ((:METHOD ASDF/PLAN:PERFORM-PLAN (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {13306089}>) [fast-method]
14: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
15: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {13306089}>) [fast-method]
16: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/OPERATE:BUILD-OP > #<ASDF/SYSTEM:SYSTEM "cffi-libffi"> :PLAN-CLASS NIL :PLAN-OPTIONS NIL) [fast-method]
17: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> #<ASDF/OPERATE:BUILD-OP > #<ASDF/SYSTEM:SYSTEM "cffi-libffi">)
18: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
19: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/OPERATE:BUILD-OP > #<ASDF/SYSTEM:SYSTEM "cffi-libffi">) [fast-method]
20: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> ASDF/OPERATE:BUILD-OP CFFI-LIBFFI)
21: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
22: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/OPERATE:BUILD-OP CFFI-LIBFFI) [fast-method]
23: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {12EB68FD}> :OVERRIDE T :KEY NIL :OVERRIDE-CACHE T :OVERRIDE-FORCING NIL)
24: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
25: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {12EAC0D5}> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
26: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/OPERATE:BUILD-OP CFFI-LIBFFI) [fast-method]
27: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ASDF/OPERATE:OPERATE (QUOTE ASDF/OPERATE:BUILD-OP) (QUOTE CFFI-LIBFFI)) #<NULL-LEXENV>)
28: (EVAL (ASDF/OPERATE:OPERATE (QUOTE ASDF/OPERATE:BUILD-OP) (QUOTE CFFI-LIBFFI)))
29: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:EVAL . "(require \"asdf\")") (:EVAL . #<(SIMPLE-ARRAY CHARACTER (296)) (setf asdf:*central-registry* (list* (quote *default-pathname-defaults*) #p"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cff... {1361F26F}>) (:EVAL . "(asdf:operate (quote asdf:build-op) (quote cffi-libffi))") (:QUIT)))
30: (SB-IMPL::TOPLEVEL-INIT)
31: ((FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP))
32: ((FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-IMPL::START-LISP))
33: (SB-IMPL::%START-LISP)

unhandled condition in --disable-debugger mode, quitting
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
Command failed: /opt/local/bin/sbcl --no-sysinit --no-userinit --non-interactive --eval '(require "asdf")' --eval '(setf asdf:*central-registry* (list* (quote *default-pathname-defaults*) #p"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lisp_cl-cffi/cl-cffi/work/build/system/" #p"/opt/local/share/common-lisp/system/" asdf:*central-registry*))' --eval '(asdf:operate (quote asdf:build-op) (quote cffi-libffi))' 2>&1
Exit code: 1

@catap FYI

catap commented 8 months ago

@barracuda156 you need just need to adjust lines near here: https://github.com/cffi/cffi/blob/master/libffi/libffi-types.lisp#L71-L77