Skip to content

libffi not found during build #24

@Jorann

Description

@Jorann

During the build of the Docker image I got the following error: Package libffi was not found in the pkg-config search path.

Changing the apk command in stage 1 in the Dockerfile fixes this:

RUN apk --no-cache add \
    gcc \
    musl-dev \
    pcre-dev \
    linux-headers \
    postgresql-dev \
    python3-dev \
    # libraries installed using git
    git \
    # lxml dependencies
    libxslt-dev \
    # pillow dependencies
    jpeg-dev \
    openjpeg-dev \
    zlib-dev \ 
    libffi-dev

Complete error:

37.37   Running setup.py install for cffi: started
37.61   Running setup.py install for cffi: finished with status 'error'
37.61   error: subprocess-exited-with-error
37.61
37.61   × Running setup.py install for cffi did not run successfully.
37.61   │ exit code: 1
37.61   ╰─> [60 lines of output]
37.61       Package libffi was not found in the pkg-config search path.
37.61       Perhaps you should add the directory containing `libffi.pc'
37.61       to the PKG_CONFIG_PATH environment variable
37.61       Package 'libffi', required by 'virtual:world', not found
37.61       Package libffi was not found in the pkg-config search path.
37.61       Perhaps you should add the directory containing `libffi.pc'
37.61       to the PKG_CONFIG_PATH environment variable
37.61       Package 'libffi', required by 'virtual:world', not found
37.61       Package libffi was not found in the pkg-config search path.
37.61       Perhaps you should add the directory containing `libffi.pc'
37.61       to the PKG_CONFIG_PATH environment variable
37.61       Package 'libffi', required by 'virtual:world', not found
37.61       Package libffi was not found in the pkg-config search path.
37.61       Perhaps you should add the directory containing `libffi.pc'
37.61       to the PKG_CONFIG_PATH environment variable
37.61       Package 'libffi', required by 'virtual:world', not found
37.61       Package libffi was not found in the pkg-config search path.
37.61       Perhaps you should add the directory containing `libffi.pc'
37.61       to the PKG_CONFIG_PATH environment variable
37.61       Package 'libffi', required by 'virtual:world', not found
37.61       /usr/local/lib/python3.9/site-packages/setuptools/config/setupcfg.py:520: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
37.61         warnings.warn(msg, warning_class)
37.61       running install
37.61       /usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
37.61         warnings.warn(
37.61       running build
37.61       running build_py
37.61       creating build
37.61       creating build/lib.linux-aarch64-cpython-39
37.61       creating build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/api.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/cffi_opcode.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/pkgconfig.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/vengine_cpy.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/setuptools_ext.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/recompiler.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/vengine_gen.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/commontypes.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/error.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/lock.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/ffiplatform.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/__init__.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/backend_ctypes.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/verifier.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/model.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/cparser.py -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/_cffi_include.h -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/parse_c_type.h -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/_embedding.h -> build/lib.linux-aarch64-cpython-39/cffi
37.61       copying cffi/_cffi_errors.h -> build/lib.linux-aarch64-cpython-39/cffi
37.61       running build_ext
37.61       building '_cffi_backend' extension
37.61       creating build/temp.linux-aarch64-cpython-39
37.61       creating build/temp.linux-aarch64-cpython-39/c
37.61       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-aarch64-cpython-39/c/_cffi_backend.o
37.61       c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
37.61          15 | #include <ffi.h>
37.61             |          ^~~~~~~
37.61       compilation terminated.
37.61       error: command '/usr/bin/gcc' failed with exit code 1
37.61       [end of output]
37.61
37.61   note: This error originates from a subprocess, and is likely not a problem with pip.
37.61 error: legacy-install-failure
37.61
37.61 × Encountered error while trying to install package.
37.61 ╰─> cffi
37.61
37.61 note: This is an issue with the package mentioned above, not pip.
37.61 hint: See above for output from the failure.

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