The non-blocking functions on non-x86 architectures require ucontext. However, ucontext is not properly detected on Apple Silicon systems because _XOPEN_SOURCE must be set in order to expose makecontext to the compiler. The error log indicates:
Determining if files ucontext.h exist failed with the following output:
Change Dir: /XXX/mariadb-connector-c-3.1.11-src/CMakeFiles/CMakeTmp
Run Build Command(s):/Library/Developer/CommandLineTools/usr/bin/make cmTC_b1c76/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_b1c76.dir/build.make CMakeFiles/cmTC_b1c76.dir/build
Building C object CMakeFiles/cmTC_b1c76.dir/HAVE_FILE_UCONTEXT_H.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -arch x86_64 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.13 -o CMakeFiles/cmTC_b1c76.dir/HAVE_FILE_UCONTEXT_H.c.o -c /XXX/mariadb-connector-c-3.1.11-src/CMakeFiles/CheckIncludeFiles/HAVE_FILE_UCONTEXT_H.c
In file included from /XXX/mariadb-connector-c-3.1.11-src/CMakeFiles/CheckIncludeFiles/HAVE_FILE_UCONTEXT_H.c:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/ucontext.h:51:2: error: The deprecated ucontext routines require _XOPEN_SOURCE to be defined
#error The deprecated ucontext routines require _XOPEN_SOURCE to be defined
1 error generated.
make: *** [CMakeFiles/cmTC_b1c76.dir/HAVE_FILE_UCONTEXT_H.c.o] Error 1
make: *** [cmTC_b1c76/fast] Error 2
The message states that the ucontext functions are deprecated. However, in my testing the functions do work on Apple Silicon systems, and they are the only way to enable MYSQL_OPT_NONBLOCK on those machines. I will open a pull request on GitHub with the changes that I suggest.