Bug 268339 - databases/mysql57-server: fix build with clang 15 on i386
Summary: databases/mysql57-server: fix build with clang 15 on i386
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jochen Neumeister
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-12 20:07 UTC by Dimitry Andric
Modified: 2022-12-18 17:48 UTC (History)
1 user (show)

See Also:
joneum: maintainer-feedback+


Attachments
databases/mysql57-server: fix build with clang 15 on i386 (4.06 KB, patch)
2022-12-12 20:08 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-12 20:07:53 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that databases/mysql57-server failed to build with clang 15, on i386:

  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_plugin.cc:30:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_session.h:31:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/client_session.h:30:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/protocol_encoder.h:31:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/protocol/page_pool.h:34:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs_common/atomic.h:29:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic.hpp:12:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/atomic.hpp:20:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/fences.hpp:21:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/operations.hpp:17:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/operations_lockfree.hpp:21:
  In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/ops_gcc_atomic.hpp:23:
  /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/ops_gcc_x86_dcas.hpp:147:21: error: address argument to atomic builtin cannot be const-qualified ('const volatile boost::atomics::detail::gcc_dcas_x86<true>::storage_type *' (aka 'const volatile long long *') invalid)
              value = __sync_val_compare_and_swap(&storage, (storage_type)0, (storage_type)0);
                      ^                           ~~~~~~~~
  /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/atomic_template.hpp:110:54: note: in instantiation of member function 'boost::atomics::detail::gcc_dcas_x86<true>::load' requested here
          return static_cast< value_type >(operations::load(m_storage, order));
                                                       ^
  /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_common_status_variables.h:43:57: note: in instantiation of member function 'boost::atomics::detail::base_atomic<long long, int>::load' requested here
      void operator=(const Variable& other) { store(other.load()); }
                                                          ^

This is because mysql has an old embedded copy of boost, which assumes clang needs a workaround to allocate eax:edx register pairs in inline assembly. Since this is no longer true with recent versions of clang, patch out the clang checks and use the generic inline assembly code.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-12 20:08:20 UTC
Created attachment 238737 [details]
databases/mysql57-server: fix build with clang 15 on i386
Comment 2 Jochen Neumeister freebsd_committer freebsd_triage 2022-12-13 18:05:57 UTC
LGTM :-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-12-18 17:44:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6c83371d649205efdcf47fcbc4aea1f24ee148fe

commit 6c83371d649205efdcf47fcbc4aea1f24ee148fe
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-12 20:02:40 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-18 17:35:44 +0000

    databases/mysql57-server: fix build with clang 15 on i386

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    databases/mysql57-server failed to build with clang 15, on i386:

      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_plugin.cc:30:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_session.h:31:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/client_session.h:30:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/protocol_encoder.h:31:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs/protocol/page_pool.h:34:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/ngs/include/ngs_common/atomic.h:29:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic.hpp:12:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/atomic.hpp:20:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/fences.hpp:21:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/operations.hpp:17:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/operations_lockfree.hpp:21:
      In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/ops_gcc_atomic.hpp:23:
      /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/ops_gcc_x86_dcas.hpp:147:21: error: address argument to atomic builtin cannot be const-qualified ('const volatile boost::atomics::detail::gcc_dcas_x86<true>::storage_type *' (aka 'const volatile long long *') invalid)
                  value = __sync_val_compare_and_swap(&storage, (storage_type)0, (storage_type)0);
                          ^                           ~~~~~~~~
      /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/boost/boost_1_59_0/boost/atomic/detail/atomic_template.hpp:110:54: note: in instantiation of member function 'boost::atomics::detail::gcc_dcas_x86<true>::load' requested here
              return static_cast< value_type >(operations::load(m_storage, order));
                                                           ^
      /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.40/rapid/plugin/x/src/xpl_common_status_variables.h:43:57: note: in instantiation of member function 'boost::atomics::detail::base_atomic<long long, int>::load' requested here
          void operator=(const Variable& other) { store(other.load()); }
                                                              ^

    This is because mysql has an old embedded copy of boost, which assumes
    clang needs a workaround to allocate eax:edx register pairs in inline
    assembly. Since this is no longer true with recent versions of clang,
    patch out the clang checks and use the generic inline assembly code.

    PR:             268339
    Approved by:    portmgr (tcberner)
    MFH:            2022Q4

 databases/mysql57-server/Makefile | 2 ++
 1 file changed, 2 insertions(+)