Summary
Building the CDriver on a M1 macOS fails because of a call to an undeclared function (getpagesize). However, this function is available on macOS M1. Using the configuration and the build commands listed below, the c driver can't be built.
Environment
C driver version is 1.23.0
The host is on MacOS Monterey 12.6 on the M1 chip ARM64.
clang version 15.0.2
How to Reproduce
These steps were taken from the C Driver Getting Started guide.
Configure cmake:
cmake \ -DCMAKE_C_COMPILER="<path to LLVM>/bin/clang" \ -DENABLE_MAINTAINER_FLAGS=ON \ -DMONGO_SANITIZE="address;leak" \ -B./cmake-build
Then build the executables:
cmake --build cmake-build --target example-client
Then run the executable
./cmake-build/src/libmongoc/example-client
This error will appear in
mongo-c-driver/src/libmongoc/src/mongoc/mongoc-counters.c
error: call to undeclared function 'getpagesize'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] return BSON_MAX (getpagesize (), size);