Skip to content

Instantly share code, notes, and snippets.

@vardhanapoorv
Created January 9, 2024 17:05
Show Gist options
  • Save vardhanapoorv/5aafa76adafe09b5e0b89d0506671c54 to your computer and use it in GitHub Desktop.
Save vardhanapoorv/5aafa76adafe09b5e0b89d0506671c54 to your computer and use it in GitHub Desktop.
Troubleshoot building MariaDB on MacOS (M2) from source

I followed this https://mariadb.com/kb/en/Build_Environment_Setup_for_Mac/ and then https://mariadb.com/kb/en/generic-build-instructions/.

Encountered few errors along the way. Below are the issues with the fixes that worked for me -

    • Issue:Bison error
    • Fix: Ran brew install bison to upgrade bison version. Cleaned up build folder and re-ran build.
    • Issue: pcre2.h missing
    • Fix: Ran brew install pcre2 to install the dependency. Created a symbolic link - ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h \ /Library/Developer/CommandLineTools/usr/include/pcre2.h.
    • Issue: unknown type name 'malloc_statistics_t'
    • Fix: Since the usage is in some statistics, can ignore that code. Quick clean hack suggested by someone -
      --- a/sql/sql_test.cc
      +++ b/sql/sql_test.cc
      @@ -653,7 +653,7 @@ Memory allocated by threads:             %s\n",
                llstr(tmp.global_memory_used, llbuff[8]),
                llstr(tmp.local_memory_used, llbuff[9]));
      
      -#elif defined(HAVE_MALLOC_ZONE)
      +#elif 0
         malloc_statistics_t info;
         char llbuff[4][22];
    • Issue: error: 'sprintf' is deprecated
    • Fix: Build with DMYSQL_MAINTAINER_MODE=OFF. that should do the trick. From docs -
      By default, MariaDB is compiled with the -Werror flag, which causes compiling to abort if there is a compiler warning. 
      You can disable that by configuring with -DMYSQL_MAINTAINER_MODE=OFF.
      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment