Skip to content

libffi dependency fails to compile on newer compilers: both clang and gcc #5344

@JamesClarke7283

Description

@JamesClarke7283

Summary

The libffi dependency inside the rustpython-jit crate, fails to compile on newer compilers like those on Archlinux.

Expected

Compilation of rustpython-jit suceeds

Actual

error:

--- stderr
  ../src/java_raw_api.c: In function 'ffi_java_raw_call':
  ../src/java_raw_api.c:317:3: warning: 'ffi_java_raw_to_ptrarray' is deprecated [-Wdeprecated-declarations]
    317 |   ffi_java_raw_to_ptrarray (cif, raw, avalue);
        |   ^~~~~~~~~~~~~~~~~~~~~~~~
  ../src/java_raw_api.c:76:1: note: declared here
     76 | ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args)
        | ^~~~~~~~~~~~~~~~~~~~~~~~
  ../src/java_raw_api.c: In function 'ffi_java_translate_args':
  ../src/java_raw_api.c:328:3: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
    328 |   ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
        |   ^~~~~~~~~~~~
  ../src/java_raw_api.c:45:1: note: declared here
     45 | ffi_java_raw_size (ffi_cif *cif)
        | ^~~~~~~~~~~~~~~~~
  ../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);
        |   ^~~~~~~~~~~~~~~~~~~~~~~~
  ../src/java_raw_api.c:157:1: note: declared here
    157 | ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
        | ^~~~~~~~~~~~~~~~~~~~~~~~
  ../src/java_raw_api.c: In function 'ffi_prep_java_raw_closure':
  ../src/java_raw_api.c:369:3: warning: 'ffi_prep_java_raw_closure_loc' is deprecated [-Wdeprecated-declarations]
    369 |   return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
        |   ^~~~~~
  ../src/java_raw_api.c:337:1: note: declared here
    337 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/tramp.c: In function 'ffi_tramp_get_temp_file':
  ../src/tramp.c:262:22: error: implicit declaration of function 'open_temp_exec_file' [-Wimplicit-function-declaration]
    262 |   tramp_globals.fd = open_temp_exec_file ();
        |                      ^~~~~~~~~~~~~~~~~~~
  make[2]: *** [Makefile:1320: src/tramp.lo] Error 1
  make[1]: *** [Makefile:1397: install-recursive] Error 1
  make: *** [Makefile:3158: install] Error 2

Python Documentation

N/A

Program versions/System info

gcc (GCC) 14.1.1 20240522
clang version 17.0.6
Linux desktop 6.6.14-gnu-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 02:02:54 +0000 x86_64 GNU/Linux

Solution

Replace libffi dependency with version specifying system version of libffi.
Like so:

[dependencies.libffi]
version = "2.3.0"
features = ["system"]

The downside is the user would need libffi installed on their system, but at least this issue would go.

Alternate solution

clearly this does not work:
libffi-rs/libffi-rs@ce05302
So we could get upstream to fix it on their bundled version of libffi.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions