Bug #110736 Build failure with Homebrew rapidjson installed & symlinked
Submitted: 19 Apr 2023 14:52 Modified: 3 May 2023 21:54
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.33 OS:MacOS (13.3.1)
Assigned to: CPU Architecture:ARM
Tags: homebrew, macos, rapidjson, regression

[19 Apr 2023 14:52] Laurynas Biveinis
Description:
On macOS, If Homebrew rapidjson is installed, then build fails. Note that even -DWITH_RAPIDJSON=bundled does not help, and the only workaround is brew unlink rapidjson.
This is a regression against 8.0.32.

/Users/laurynas/vilniusdb/mysql-8.0.33/sql/json_schema.cc:114:7: error: no matching constructor for initialization of 'rapidjson::SchemaDocument' (aka 'GenericSchemaDocument<GenericValue<UTF8<>>>')
    : m_cached_schema(schema_document, /*uri=*/nullptr, /*uriLength=*/0,
      ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/include/rapidjson/schema.h:1341:14: note: candidate constructor not viable: requires at most 3 arguments, but 4 were provided
    explicit GenericSchemaDocument(const ValueType& document, IRemoteSchemaDocumentProviderType* remoteProvider = 0, Allocator* allocator = 0) :
             ^
/opt/homebrew/include/rapidjson/schema.h:1378:5: note: candidate constructor not viable: requires single argument 'rhs', but 4 arguments were provided
    GenericSchemaDocument(GenericSchemaDocument&& rhs) RAPIDJSON_NOEXCEPT :
    ^
/opt/homebrew/include/rapidjson/schema.h:1405:5: note: candidate constructor not viable: requires 1 argument, but 4 were provided
    GenericSchemaDocument(const GenericSchemaDocument&);
    ^
/opt/homebrew/include/rapidjson/schema.h:1913:30: error: no matching constructor for initialization of 'Syntax_check_handler'
        static OutputHandler nullHandler;
                             ^
/opt/homebrew/include/rapidjson/schema.h:1794:24: note: in instantiation of member function 'rapidjson::GenericSchemaValidator<rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF8<>>>, Syntax_check_handler>::GetNullHandler' requested here
        outputHandler_(GetNullHandler()),
                       ^
/opt/homebrew/include/rapidjson/schema.h:1742:81: note: in instantiation of member function 'rapidjson::GenericSchemaValidator<rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF8<>>>, Syntax_check_handler>::GenericSchemaValidator' requested here
        return new (GetStateAllocator().Malloc(sizeof(GenericSchemaValidator))) GenericSchemaValidator(*schemaDocument_, root,
                                                                                ^
/opt/homebrew/include/rapidjson/schema.h:1597:5: note: in instantiation of member function 'rapidjson::GenericSchemaValidator<rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF8<>>>, Syntax_check_handler>::CreateSchemaValidator' requested here
    GenericSchemaValidator(
    ^
/Users/laurynas/vilniusdb/mysql-8.0.33/sql/json_schema.cc:139:7: note: in instantiation of member function 'rapidjson::GenericSchemaValidator<rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF8<>>>, Syntax_check_handler>::GenericSchemaValidator' requested here
      validator(m_cached_schema, syntaxCheckHandler);
      ^
/Users/laurynas/vilniusdb/mysql-8.0.33/sql-common/json_syntax_check.h:72:12: note: candidate constructor not viable: requires single argument 'm_depth_handler', but no arguments were provided
  explicit Syntax_check_handler(JsonDocumentDepthHandler m_depth_handler);
[ 78%] Building CXX object sql/CMakeFiles/sql_main.dir/locked_tables_list.cc.o
           ^
/Users/laurynas/vilniusdb/mysql-8.0.33/sql-common/json_syntax_check.h:64:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
class Syntax_check_handler : public rapidjson::BaseReaderHandler<> {
      ^
/Users/laurynas/vilniusdb/mysql-8.0.33/sql-common/json_syntax_check.h:64:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided

How to repeat:
brew install rapidjson
cmake with -DWITH_RAPIDJSON=system
cmake with -DWITH_RAPIDJSON=bundled
build both versions
[20 Apr 2023 4:54] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feedback!

regards,
Umesh
[3 May 2023 21:54] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.34 and 8.1.0 releases, and here's the proposed changelog entry from the documentation team:

On macOS, MySQL would not compile if rapidjson was installed via
Homebrew. The workaround was to brew unlink rapidjson.

Thank you for the bug report.