Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-521

ucontext not detected on macOS with Apple Silicon

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.1.11
    • 3.2.0, 3.1.12
    • None
    • None
    • macOS 11.1
      Apple clang version 12.0.0 (clang-1200.0.32.28)

    Description

      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[1]: *** [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.

      Attachments

        Activity

          People

            georg Georg Richter
            emiller999 Evan Miller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.