Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4505

mongoc counters on macos M1 fails due to an undeclared function call

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.23.2
    • Affects Version/s: None
    • Component/s: None

      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);

            Assignee:
            kyle.kloberdanz@mongodb.com Kyle Kloberdanz (Inactive)
            Reporter:
            gil.alon@mongodb.com Gil Alon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: