Skip to content

2.3.0 fails to build on macOS Sequoia 15.4: invalid CFI advance_loc expression #109

@shepmaster

Description

@shepmaster

Recently, Apple released updates to their developer tools. With that, the crate no longer builds.

% cargo new x
% cd x
% cargo add libffi-sys
% cargo build
error: failed to run custom build command for `libffi-sys v2.3.0`

Caused by:
  process didn't exit successfully: `/private/tmp/x/target/debug/build/libffi-sys-9bddd79c8e925308/build-script-build` (exit status: 101)
  --- stdout
  checking build system type... aarch64-apple-darwin24.4.0
  checking host system type... aarch64-apple-darwin24.4.0
  checking target system type... aarch64-apple-darwin24.4.0
  continue configure in default builddir "./aarch64-apple-darwin"
  ....exec /bin/sh .././configure "--srcdir=.." "--enable-builddir=aarch64-apple-darwin" "darwin24.4.0"
  checking build system type... aarch64-apple-darwin24.4.0
  checking host system type... aarch64-apple-darwin24.4.0
  checking target system type... aarch64-apple-darwin24.4.0
  checking for gsed... /opt/homebrew/bin/gsed
  checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
  checking whether build environment is sane... yes
  checking for a race-free mkdir -p... /opt/homebrew/bin/gmkdir -p
  checking for gawk... gawk
  checking whether make sets $(MAKE)... yes
  checking whether make supports nested variables... yes
  checking for gcc... cc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether the compiler supports GNU C... yes
  checking whether cc accepts -g... yes
  checking for cc option to enable C11 features... none needed
  checking whether cc understands -c and -o together... yes
  checking whether make supports the include directive... yes (GNU style)
  checking dependency style of cc... gcc3
  checking for g++... g++
  checking whether the compiler supports GNU C++... yes
  checking whether g++ accepts -g... yes
  checking for g++ option to enable C++11 features... none needed
  checking dependency style of g++... gcc3
  checking dependency style of cc... gcc3
  checking for grep that handles long lines and -e... /opt/homebrew/bin/ggrep
  checking for egrep... /opt/homebrew/bin/ggrep -E
  checking how to print strings... printf
  checking for a sed that does not truncate output... /opt/homebrew/bin/gsed
  checking for fgrep... /opt/homebrew/bin/ggrep -F
  checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
  checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
  checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
  checking the name lister (/usr/bin/nm -B) interface... BSD nm
  checking whether ln -s works... yes
  checking the maximum length of command line arguments... 786432
  checking how to convert aarch64-apple-darwin24.4.0 file names to aarch64-apple-darwin24.4.0 format... func_convert_file_noop
  checking how to convert aarch64-apple-darwin24.4.0 file names to toolchain format... func_convert_file_noop
  checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
  checking for file... file
  checking for objdump... objdump
  checking how to recognize dependent libraries... pass_all
  checking for dlltool... no
  checking how to associate runtime and link libraries... printf %s\n
  checking for ar... ar
  checking for archiver @FILE support... no
  checking for strip... strip
  checking for ranlib... ranlib
  checking command to parse /usr/bin/nm -B output from cc object... ok
  checking for sysroot... no
  checking for a working dd... /bin/dd
  checking how to truncate binary pipes... /bin/dd bs=4096 count=1
  checking for mt... no
  checking if : is a manifest tool... no
  checking for dsymutil... dsymutil
  checking for nmedit... nmedit
  checking for lipo... lipo
  checking for otool... otool
  checking for otool64... no
  checking for -single_module linker flag... ld: warning: -single_module is obsolete
  no
  checking for -exported_symbols_list linker flag... yes
  checking for -force_load linker flag... yes
  checking for stdio.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for strings.h... yes
  checking for sys/stat.h... yes
  checking for sys/types.h... yes
  checking for unistd.h... yes
  checking for dlfcn.h... yes
  checking for objdir... .libs
  checking if cc supports -fno-rtti -fno-exceptions... yes
  checking for cc option to produce PIC... -fno-common -DPIC
  checking if cc PIC flag -fno-common -DPIC works... yes
  checking if cc static flag -static works... no
  checking if cc supports -c -o file.o... yes
  checking if cc supports -c -o file.o... (cached) yes
  checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
  checking dynamic linker characteristics... darwin24.4.0 dyld
  checking how to hardcode library paths into programs... immediate
  checking whether stripping libraries is possible... yes
  checking if libtool supports shared libraries... yes
  checking whether to build shared libraries... no
  checking whether to build static libraries... yes
  checking how to run the C++ preprocessor... g++ -E
  checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
  checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
  checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
  checking for g++ option to produce PIC... -fno-common -DPIC
  checking if g++ PIC flag -fno-common -DPIC works... yes
  checking if g++ static flag -static works... no
  checking if g++ supports -c -o file.o... yes
  checking if g++ supports -c -o file.o... (cached) yes
  checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
  checking dynamic linker characteristics... darwin24.4.0 dyld
  checking how to hardcode library paths into programs... immediate
  checking for readelf... no
  checking size of size_t... 8
  checking for C compiler vendor... clang
  checking CFLAGS for most reasonable warnings... -Wall
  checking whether to enable maintainer-specific portions of Makefiles... no
  checking for sys/memfd.h... no
  checking for memfd_create... no
  checking for sys/mman.h... yes
  checking for mmap... yes
  checking for mkostemp... yes
  checking for mkstemp... yes
  checking for sys/mman.h... (cached) yes
  checking for mmap... (cached) yes
  checking whether read-only mmap of a plain file works... yes
  checking whether mmap from /dev/zero works... no
  checking for MAP_ANON(YMOUS)... yes
  checking whether mmap with MAP_ANON(YMOUS) works... yes
  checking for egrep... (cached) /opt/homebrew/bin/ggrep -E
  checking for memcpy... yes
  checking for size_t... yes
  checking for working alloca.h... yes
  checking for alloca... yes
  checking size of double... 8
  checking size of long double... 8
  checking whether byte ordering is bigendian... no
  checking assembler .cfi pseudo-op support... yes
  checking whether compiler supports pointer authentication... no
  checking for _ prefix in compiled symbols... yes
  checking whether C compiler accepts -fno-lto... yes
  checking whether .eh_frame section should be read-only... yes
  checking for __attribute__((visibility("hidden")))... yes
  configure: versioning on shared library symbols is no
  checking that generated files are newer than configure... done
  configure: creating ./config.status
  config.status: creating include/Makefile
  config.status: creating include/ffi.h
  config.status: creating Makefile
  config.status: creating testsuite/Makefile
  config.status: creating man/Makefile
  config.status: creating doc/Makefile
  config.status: creating libffi.pc
  config.status: creating fficonfig.h
  config.status: executing buildir commands
  config.status: create top_srcdir/Makefile guessed from local Makefile
  config.status: build in aarch64-apple-darwin (HOST=aarch64-apple-darwin)
  config.status: executing depfiles commands
  config.status: executing libtool commands
  config.status: executing include commands
  config.status: executing src commands
  MAKE aarch64-apple-darwin :        1 * install
  Making install in include
  make[3]: Nothing to be done for `install-exec-am'.
   /opt/homebrew/bin/gmkdir -p '/private/tmp/x/target/debug/build/libffi-sys-ac627a927d7d4723/out/libffi-root/include'
   /opt/homebrew/bin/ginstall -c -m 644 ffi.h ffitarget.h '/private/tmp/x/target/debug/build/libffi-sys-ac627a927d7d4723/out/libffi-root/include'
  Making install in testsuite
  make[3]: Nothing to be done for `install-exec-am'.
  make[3]: Nothing to be done for `install-data-am'.
  Making install in man
  make[3]: Nothing to be done for `install-exec-am'.
   /opt/homebrew/bin/gmkdir -p '/private/tmp/x/target/debug/build/libffi-sys-ac627a927d7d4723/out/libffi-root/share/man/man3'
   /opt/homebrew/bin/ginstall -c -m 644 ../../man/ffi.3 ../../man/ffi_call.3 ../../man/ffi_prep_cif.3 ../../man/ffi_prep_cif_var.3 '/private/tmp/x/target/debug/build/libffi-sys-ac627a927d7d4723/out/libffi-root/share/man/man3'
  depbase=`echo src/prep_cif.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/prep_cif.lo -MD -MP -MF $depbase.Tpo -c -o src/prep_cif.lo ../src/prep_cif.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/prep_cif.lo -MD -MP -MF src/.deps/prep_cif.Tpo -c ../src/prep_cif.c  -fno-common -DPIC -o src/prep_cif.o
  depbase=`echo src/types.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/types.lo -MD -MP -MF $depbase.Tpo -c -o src/types.lo ../src/types.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/types.lo -MD -MP -MF src/.deps/types.Tpo -c ../src/types.c  -fno-common -DPIC -o src/types.o
  depbase=`echo src/raw_api.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/raw_api.lo -MD -MP -MF $depbase.Tpo -c -o src/raw_api.lo ../src/raw_api.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/raw_api.lo -MD -MP -MF src/.deps/raw_api.Tpo -c ../src/raw_api.c  -fno-common -DPIC -o src/raw_api.o
  depbase=`echo src/java_raw_api.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/java_raw_api.lo -MD -MP -MF $depbase.Tpo -c -o src/java_raw_api.lo ../src/java_raw_api.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/java_raw_api.lo -MD -MP -MF src/.deps/java_raw_api.Tpo -c ../src/java_raw_api.c  -fno-common -DPIC -o src/java_raw_api.o
  depbase=`echo src/closures.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/closures.lo -MD -MP -MF $depbase.Tpo -c -o src/closures.lo ../src/closures.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/closures.lo -MD -MP -MF src/.deps/closures.Tpo -c ../src/closures.c  -fno-common -DPIC -o src/closures.o
  depbase=`echo src/tramp.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/tramp.lo -MD -MP -MF $depbase.Tpo -c -o src/tramp.lo ../src/tramp.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/tramp.lo -MD -MP -MF src/.deps/tramp.Tpo -c ../src/tramp.c  -fno-common -DPIC -o src/tramp.o
  depbase=`echo src/aarch64/ffi.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src   -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/aarch64/ffi.lo -MD -MP -MF $depbase.Tpo -c -o src/aarch64/ffi.lo ../src/aarch64/ffi.c &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -Wall -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -fexceptions -MT src/aarch64/ffi.lo -MD -MP -MF src/aarch64/.deps/ffi.Tpo -c ../src/aarch64/ffi.c  -fno-common -DPIC -o src/aarch64/ffi.o
  depbase=`echo src/aarch64/sysv.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  	/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I..  -I. -I../include -Iinclude -I../src  -I. -I../include -Iinclude -I../src -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -MT src/aarch64/sysv.lo -MD -MP -MF $depbase.Tpo -c -o src/aarch64/sysv.lo ../src/aarch64/sysv.S &&\
  	mv -f $depbase.Tpo $depbase.Plo
  libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -I. -I../include -Iinclude -I../src -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer --target=arm64-apple-macosx -mmacosx-version-min=15.4 -Wno-implicit-function-declaration -MT src/aarch64/sysv.lo -MD -MP -MF src/aarch64/.deps/sysv.Tpo -c ../src/aarch64/sysv.S  -fno-common -DPIC -o src/aarch64/sysv.o

  --- stderr
  rm: conftest.dSYM: is a directory
  rm: conftest.dSYM: is a directory
  rm: conftest.dSYM: is a directory
  rm: conftest.dSYM: is a directory
  clang: error: unsupported option '-print-multi-os-directory'
  clang: error: no input files
  ../src/java_raw_api.c:328:46: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
    328 |   ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
        |                                              ^
  include/ffi.h:326:56: note: 'ffi_java_raw_size' has been explicitly marked deprecated here
    326 | size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
        |                                                        ^
  ../src/java_raw_api.c:331:3: warning: 'ffi_java_ptrarray_to_raw' is deprecated [-Wdeprecated-declarations]
    331 |   ffi_java_ptrarray_to_raw (cif, avalue, raw);
        |   ^
  include/ffi.h:322:93: note: 'ffi_java_ptrarray_to_raw' has been explicitly marked deprecated here
    322 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
        |                                                                                             ^
  2 warnings generated.
  /var/folders/s4/sppppbvd44b8f_zzsc3zjtbm0000gn/T/sysv-f94a17.s:27:2: error: invalid CFI advance_loc expression
   .cfi_def_cfa x1, 40;
   ^
  /var/folders/s4/sppppbvd44b8f_zzsc3zjtbm0000gn/T/sysv-f94a17.s:188:2: error: invalid CFI advance_loc expression
   .cfi_adjust_cfa_offset (8*2 + (8 * 16 + 8 * 8) + 64)
   ^
  make[2]: *** [src/aarch64/sysv.lo] Error 1
  make[1]: *** [install-recursive] Error 1
  make: *** [install] Error 2

  thread 'main' panicked at /Users/shep/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libffi-sys-2.3.0/build/common.rs:8:5:
  Building libffi
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

clang --version

Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions