Gitlab doesn't rebuild against ruby 3.2

We are currently working on updating ruby to version 3.2.4 in our staging repository, but when trying to build gitlab against staging this error shows up:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /build/gitlab/src/gitlab-foss/vendor/bundle/ruby/3.2.0/gems/google-protobuf-3.25.3/ext/google/protobuf_c
/usr/bin/ruby extconf.rb -- --with-cflags\=-march\=x86-64\ -mtune\=generic\ -O2\ -pipe\ -fno-plt\ -fexceptions\ -Wp,-D_FORTIFY_SOURCE\=2\ -Wformat\ -fstack-clash-protection\ -fcf-protection\ -fno-omit-frame-pointer\ -mno-omit-leaf-frame-pointer\ -g\
-ffile-prefix-map\=/build/ruby/src\=/usr/src/debug/ruby\ -flto\=auto\ -fPIC
creating Makefile

current directory: /build/gitlab/src/gitlab-foss/vendor/bundle/ruby/3.2.0/gems/google-protobuf-3.25.3/ext/google/protobuf_c
make DESTDIR\= sitearchdir\=./.gem.20240606-1638-zfk2qc sitelibdir\=./.gem.20240606-1638-zfk2qc clean

current directory: /build/gitlab/src/gitlab-foss/vendor/bundle/ruby/3.2.0/gems/google-protobuf-3.25.3/ext/google/protobuf_c
make DESTDIR\= sitearchdir\=./.gem.20240606-1638-zfk2qc sitelibdir\=./.gem.20240606-1638-zfk2qc
compiling protobuf.c
compiling convert.c
convert.c: In function ‘Msgval_IsEqual’:
convert.c:295:58: warning: passing argument 4 of ‘shared_Msgval_IsEqual’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  295 |                                             type_info.def.msgdef, &status);
      |                                             ~~~~~~~~~~~~~^~~~~~~
In file included from convert.c:21:
shared_convert.h:19:60: note: expected ‘upb_MessageDef *’ but argument is of type ‘const upb_MessageDef *’
   19 |                            upb_CType type, upb_MessageDef* msgdef,
      |                                            ~~~~~~~~~~~~~~~~^~~~~~
convert.c: In function ‘Msgval_GetHash’:
convert.c:308:41: warning: passing argument 3 of ‘shared_Msgval_GetHash’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  308 |       val, type_info.type, type_info.def.msgdef, seed, &status);
      |                            ~~~~~~~~~~~~~^~~~~~~
shared_convert.h:23:48: note: expected ‘upb_MessageDef *’ but argument is of type ‘const upb_MessageDef *’
   23 |                                upb_MessageDef* msgdef, uint64_t seed,
      |                                ~~~~~~~~~~~~~~~~^~~~~~
compiling defs.c
compiling message.c
message.c: In function ‘Map_initialize_kwarg’:
message.c:491:24: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  491 |     upb_MiniTable* t = upb_MessageDef_MiniTable(map_init->val_type.def.msgdef);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
message.c: In function ‘MessageValue_FromValue’:
message.c:522:24: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  522 |     upb_MiniTable* t = upb_MessageDef_MiniTable(info.def.msgdef);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
message.c: In function ‘Message_initialize’:
message.c:638:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  638 |   upb_MiniTable* t = upb_MessageDef_MiniTable(self->msgdef);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~
compiling repeated_field.c
compiling map.c
map.c: In function ‘Map_delete’:
map.c:447:26: warning: passing argument 1 of ‘upb_Map_Delete’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  447 |   if (upb_Map_Delete(self->map, key_upb, &val_upb)) {
      |                      ~~~~^~~~~
In file included from defs.h:12,
                 from protobuf.h:29,
                 from convert.h:11,
                 from map.c:8:
ruby-upb.h:1772:38: note: expected ‘upb_Map *’ but argument is of type ‘const upb_Map *’
 1772 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
      |                             ~~~~~~~~~^~~
compiling ruby-upb.c
compiling wrap_memcpy.c
compiling ./third_party/utf8_range/naive.c
compiling ./third_party/utf8_range/range2-neon.c
compiling ./third_party/utf8_range/range2-sse.c
compiling shared_convert.c
shared_convert.c: In function ‘shared_Msgval_IsEqual’:
shared_convert.c:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
shared_convert.c: In function ‘shared_Msgval_GetHash’:
shared_convert.c:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^
compiling shared_message.c
shared_message.c: In function ‘shared_Message_Hash’:
shared_message.c:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
shared_message.c: In function ‘shared_Message_Equal’:
shared_message.c:65:1: warning: control reaches end of non-void function [-Wreturn-type]
   65 | }
      | ^
linking shared-object google/protobuf_c.so
/usr/bin/ld: /tmp/ccm4XF7q.ltrans1.ltrans.o: in function `jsonenc_putbytes.lto_priv.0':
/usr/include/bits/string_fortified.h:29:(.text+0x2579): undefined reference to `__wrap_memcpy'
/usr/bin/ld: /tmp/ccm4XF7q.ltrans1.ltrans.o: relocation R_X86_64_PC32 against undefined hidden symbol `__wrap_memcpy' can not be used when making a shared object
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:265: protobuf_c.so] Error 1

make failed, exit code 2

Gem files will remain installed in /build/gitlab/src/gitlab-foss/vendor/bundle/ruby/3.2.0/gems/google-protobuf-3.25.3 for inspection.
Results logged to /build/gitlab/src/gitlab-foss/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/google-protobuf-3.25.3/gem_make.out

  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:119:in `run'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:53:in `block in make'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:45:in `each'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:45:in `make'
  /usr/lib/ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:187:in `build_extension'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:221:in `block in build_extensions'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `each'
  /usr/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `build_extensions'
  /usr/lib/ruby/3.2.0/rubygems/installer.rb:846:in `build_extensions'
  /usr/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:76:in `build_extensions'
  /usr/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /usr/lib/ruby/3.2.0/bundler/source/rubygems.rb:206:in `install'
  /usr/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:54:in `install'
  /usr/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:132:in `do_install'
  /usr/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:123:in `block in worker_pool'
  /usr/lib/ruby/3.2.0/bundler/worker.rb:62:in `apply_func'
  /usr/lib/ruby/3.2.0/bundler/worker.rb:57:in `block in process_queue'
  /usr/lib/ruby/3.2.0/bundler/worker.rb:54:in `loop'
  /usr/lib/ruby/3.2.0/bundler/worker.rb:54:in `process_queue'
  /usr/lib/ruby/3.2.0/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing google-protobuf (3.25.3), and Bundler cannot continue.

In Gemfile:
  cloud_profiler_agent was resolved to 0.0.1.pre, which depends on
    google-cloud-profiler-v2 was resolved to 0.4.0, which depends on
      gapic-common was resolved to 0.20.0, which depends on
        googleapis-common-protos was resolved to 1.4.0, which depends on
          grpc was resolved to 1.63.0, which depends on
            googleapis-common-protos-types was resolved to 1.5.0, which depends on
              google-protobuf
==> ERROR: A failure occurred in build().
    Aborting...

It would be nice if someone who has experience with this package could have a look at this.