Bug 280541 - databases/mysql80-server: build of 8.0.39 fails with assertion failure
Summary: databases/mysql80-server: build of 8.0.39 fails with assertion failure
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Many People
Assignee: Jochen Neumeister
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-31 17:47 UTC by Martin Birgmeier
Modified: 2024-08-31 08:14 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (joneum)


Attachments
make log (47.86 KB, application/x-xz)
2024-07-31 17:52 UTC, Martin Birgmeier
no flags Details
patch to mysql80-server-8.0.39 to fix compilation on i386 (641 bytes, text/plain)
2024-08-07 17:29 UTC, Martin Birgmeier
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2024-07-31 17:47:45 UTC
Scenario:
- FreeBSD 14 stable @ 4f5440f2abe9 with minor local patches
- i386
- ports latest
- using portmaster to upgrade ports
- portmaster tries to upgrade mysql80-server to 8.0.39

Result:
- The build fails in storage/innobase/include/detail/ut0new.h:

In file included from /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut0new.h:37:
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:289:17: error: static assertion failed due to requirement 'allocator_metadata_size <= max_metadata_size': Aligned_alloc_impl provides a strong guarantee of only up to Aligned_alloc_impl::metadata_size bytes.
  289 |   static_assert(allocator_metadata_size <= max_metadata_size,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:451:17: note: in instantiation of template class 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>' requested here
  451 |   static inline allocator_metadata::meta_2_t datalen(
      |                 ^
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:289:41: note: expression evaluates to '8 <= 4'
  289 |   static_assert(allocator_metadata_size <= max_metadata_size,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:425:27: error: no member named 'meta_1' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  425 |       allocator_metadata::meta_1(ret.first, ret.second);
      |       ~~~~~~~~~~~~~~~~~~~~^
--- storage/example/CMakeFiles/example.dir/all ---
--- plugin_output_directory/ha_example.so ---
--- storage/innobase/CMakeFiles/innodb_zipdecompress.dir/all ---
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:426:27: error: no member named 'meta_2' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  426 |       allocator_metadata::meta_2(ret.first, size);
      |       ~~~~~~~~~~~~~~~~~~~~^
--- storage/example/CMakeFiles/example.dir/all ---
[ 26%] Linking CXX shared module ../../plugin_output_directory/ha_example.so
cd /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/.build/storage/example && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/example.dir/link.txt --verbose=1
--- storage/innobase/CMakeFiles/innodb_zipdecompress.dir/all ---
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:455:32: error: no member named 'meta_2' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  455 |     return allocator_metadata::meta_2(data);
      |            ~~~~~~~~~~~~~~~~~~~~^
--- storage/example/CMakeFiles/example.dir/all ---
/usr/bin/c++ -fPIC -std=c++17 -fno-omit-frame-pointer -ftls-model=initial-exec -O2 -pipe  -fPIC -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++17 -Wall -Wextra -Wformat-security -Wvla -Wundef -Woverloaded-virtual -Wcast-qual -Wno-null-conversion -Wno-unused-private-field -Wconditional-uninitialized -Wdeprecated -Wextra-semi -Wheader-hygiene -Wnon-virtual-dtor -Wundefined-reinterpret-cast -Wrange-loop-analysis -Winconsistent-missing-destructor-override -Winconsistent-missing-override -Wshadow-field -ffunction-sections -fdata-sections -O2 -pipe  -fPIC -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++17  -DNDEBUG -shared  -o ../../plugin_output_directory/ha_example.so CMakeFiles/example.dir/ha_example.cc.o  -lpthread ../../libservices/libmysqlservices.a ../../archive_output_directory/libzlib.a -lpthread
--- storage/innobase/CMakeFiles/innodb_zipdecompress.dir/all ---
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:466:39: error: no member named 'meta_1' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  466 |     auto offset = allocator_metadata::meta_1(data);
      |                   ~~~~~~~~~~~~~~~~~~~~^
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:593:25: error: no member named 'meta_1' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  593 |     allocator_metadata::meta_1(ret.first, ret.second);
      |     ~~~~~~~~~~~~~~~~~~~~^
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:594:25: error: no member named 'meta_2' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  594 |     allocator_metadata::meta_2(ret.first, size);
      |     ~~~~~~~~~~~~~~~~~~~~^
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:655:32: error: no member named 'meta_2' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  655 |     return allocator_metadata::meta_2(pfs_metadata::deduce_pfs_meta(data));
      |            ~~~~~~~~~~~~~~~~~~~~^
/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:668:39: error: no member named 'meta_1' in 'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
  668 |     auto offset = allocator_metadata::meta_1(pfs_meta);
      |                   ~~~~~~~~~~~~~~~~~~~~^

Expected result:
- The build should succeed (as it does on amd64)

Note:
- Maybe this is related to bug 274918.

-- Martin
Comment 1 Martin Birgmeier 2024-07-31 17:52:17 UTC
Created attachment 252403 [details]
make log
Comment 2 Martin Birgmeier 2024-08-07 17:29:45 UTC
Created attachment 252595 [details]
patch to mysql80-server-8.0.39 to fix compilation on i386

Attached is a somewhat crude patch which gets mysql80-server-8.0.39 compiling on i386.

I have not tested the resulting binary.

-- Martin
Comment 3 Martin Birgmeier 2024-08-09 08:30:19 UTC
As a comment, it seems nonsensical to add alignof() results in the way this is done in mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h. What should the meaning be of an expression like "alignof(uint32_t) + alignof(char)"? It is not done with these two types in that file, but still the meaning of an addition of alignofs() is questionable.

-- Martin
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2024-08-29 18:09:44 UTC
Comment on attachment 252595 [details]
patch to mysql80-server-8.0.39 to fix compilation on i386

I think this is the best we can do for this issue. As long as metadata_size is big enough to store two uint32_t's, all the code below it should compile.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2024-08-29 18:17:17 UTC
(In reply to Dimitry Andric from comment #4)
One minor note, I would use "2 * sizeof(uint32_t)", since this is not about the alignment but the size of the two metadata fields (which are always uint32_t, as far as I can see).
Comment 6 Martin Birgmeier 2024-08-29 18:49:00 UTC
(In reply to Dimitry Andric from comment #5)

This is similar to the critique I laid down in comment #3. But alignof(type) can be greater than sizeof(type), and since alignof() is used for the other parts in the comparison, it seems better to stick with it, even if it is ugly and nonsensical.

Practically of course it shouldn't make a difference on i386.

-- Martin
Comment 7 Dimitry Andric freebsd_committer freebsd_triage 2024-08-29 19:08:37 UTC
Not on FreeBSD at least, where the alignment of uint32_t is also 4 bytes. I think this mess comes from the fact that on Linux alignof(max_align_t) is 16 bytes even on i386... :)
Comment 8 Jochen Neumeister freebsd_committer freebsd_triage 2024-08-29 19:24:30 UTC
is that a ‘)’ too much at the end?
I will test the patch, thanks for that
Comment 9 commit-hook freebsd_committer freebsd_triage 2024-08-31 08:13:37 UTC
A commit in branch main references this bug:

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

commit e481ca786b0daca6c4252fa065154aef0ab328bd
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2024-08-31 08:11:30 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2024-08-31 08:12:55 +0000

    databases/mysql80-server: fix build for i386

    --- storage/innobase/CMakeFiles/innodb_zipdecompress.dir/all ---
    /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:466:39:
    error: no member named 'meta_1' in
    'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
      466 |     auto offset = allocator_metadata::meta_1(data);
          |                   ~~~~~~~~~~~~~~~~~~~~^
    /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:593:25:
    error: no member named 'meta_1' in
    'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
      593 |     allocator_metadata::meta_1(ret.first, ret.second);
          |     ~~~~~~~~~~~~~~~~~~~~^
    /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:594:25:
    error: no member named 'meta_2' in
    'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
      594 |     allocator_metadata::meta_2(ret.first, size);
          |     ~~~~~~~~~~~~~~~~~~~~^
    /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:655:32:
    error: no member named 'meta_2' in
    'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
      655 |     return
    allocator_metadata::meta_2(pfs_metadata::deduce_pfs_meta(data));
          |            ~~~~~~~~~~~~~~~~~~~~^
    /usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/databases/mysql80-server/work/mysql-8.0.39/storage/innobase/include/detail/ut/aligned_alloc.h:668:39:
    error: no member named 'meta_1' in
    'ut::detail::Aligned_alloc_metadata<unsigned int, unsigned int>'
      668 |     auto offset = allocator_metadata::meta_1(pfs_meta);
          |                   ~~~~~~~~~~~~~~~~~~~~^

    PR:     280541
    Sponsored by:   Netzkommune GmbH

 ...-storage_innobase_include_details_ut_aligned_alloc.h (new) | 11 +++++++++++
 1 file changed, 11 insertions(+)