Skip to content

Missing #include in C API when building on Alpine Linux #3142

@cascade256

Description

@cascade256

Summary

When building the C API in Alpine Linux, several build errors like these show up:

 /tmp/faiss/c_api/utils/distances_c.h:26:9: error: 'int64_t' was not declared in this scope
   26 |     	int64_t d,
  	|     	^~~~~~~

Adding #include <stdint.h> in faiss/c_api/utils/distances_c.h fixes the issue and it builds successfully. I believe this is caused by Alpine Linux using musl libc. In glibc, stdlib.h appears to automatically include the definitions from stdint.h.

Platform

OS: Alpine Linux 3.18.4

Faiss version: 467f70e

Reproduction instructions

docker run -it alpine sh
apk add git cmake build-base blas-dev lapack-dev
cd /tmp
git clone --depth=1 https://github.com/facebookresearch/faiss.git
cd /tmp/faiss
cmake -B build . -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DFAISS_ENABLE_C_API=ON
make -C build

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