Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36217

New MY_RELAX_CPU dependency on riscv_pause breaks riscv64 build (Regression from MDEV-35827)

Details

    Description

      While shipping latest February 2025 security updates to Ubuntu it was noticed that the riscv64 builds failed:

      https://bugs.launchpad.net/ubuntu/+source/mariadb/+bug/2099785

      https://launchpadlibrarian.net/780028462/buildlog_ubuntu-noble-riscv64.mariadb_1%3A10.11.11-0ubuntu0.24.04.1_BUILDING.txt.gz :

      [ 20%] Building C object mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o
      cd /<<PKGBUILDDIR>>/builddir/mysys && /usr/bin/cc -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>>/include/providers -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/mysys -g -O2 -fno-omit-frame-pointer -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-stack-clash-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/mariadb-1:10.11.11-0ubuntu0.24.04.1 -Wdate-time -D_FORTIFY_SOURCE=3 -Wdate-time -D_FORTIFY_SOURCE=3 -pie -fPIC -fstack-protector --param=ssp-buffer-size=4 -O3 -g -DNDEBUG -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -fno-omit-frame-pointer -DDBUG_OFF -Wall -Wdeclaration-after-statement -Wenum-compare -Wenum-conversion -Wextra -Wformat-security -Wmissing-braces -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Wvla -Wwrite-strings -std=gnu99 -Wdate-time -D_FORTIFY_SOURCE=3 -fPIC -MD -MT mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o -MF CMakeFiles/mysys.dir/lf_alloc-pin.c.o.d -o CMakeFiles/mysys.dir/lf_alloc-pin.c.o -c /<<PKGBUILDDIR>>/mysys/lf_alloc-pin.c
      /tmp/cclf2UNo.s: Assembler messages:
      /tmp/cclf2UNo.s:265: Error: unrecognized opcode `pause', extension `zihintpause' required
      /tmp/cclf2UNo.s:1168: Error: unrecognized opcode `pause', extension `zihintpause' required
      make[4]: *** [mysys/CMakeFiles/mysys.dir/build.make:1367: mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o] Error 1
      

      https://launchpadlibrarian.net/780036342/buildlog_ubuntu-jammy-riscv64.mariadb-10.6_1%3A10.6.21-0ubuntu0.22.04.1_BUILDING.txt.gz :

      [ 12%] Building C object storage/mroonga/vendor/groonga/lib/CMakeFiles/libgroonga.dir/id.c.o
      In file included from /<<PKGBUILDDIR>>/mysys/lf_hash.cc:30:
      /<<PKGBUILDDIR>>/include/my_cpu.h: In function ‘void MY_RELAX_CPU()’:
      /<<PKGBUILDDIR>>/include/my_cpu.h:100:3: error: ‘__builtin_riscv_pause’ was not declared in this scope; did you mean ‘__builtin_riscv_fsflags’?
      100 | __builtin_riscv_pause();
      | ^~~~~~~~~~~~~~~~~~~~~
      | __builtin_riscv_fsflags
      

      Can you marko advise how we could patch the source of 10.11.11 and 10.6.21 so that the riscv64 builders in Ubuntu 24.04 and 22.04 respectively work?

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            Alternate clang version - https://github.com/MariaDB/server/pull/3871 that might be made use of.

            danblack Daniel Black added a comment - Alternate clang version - https://github.com/MariaDB/server/pull/3871 that might be made use of.

            otto, while the community pull request may feel a bit hacky, it is more portable than my initial suggestion, because it should work with any reasonably recent clang or GCC version. Can you please test it? Just replace the compiler builtin function with the following:

             __asm__ volatile(".long 0x0100000f" ::: "memory");
            

            marko Marko Mäkelä added a comment - otto , while the community pull request may feel a bit hacky, it is more portable than my initial suggestion, because it should work with any reasonably recent clang or GCC version. Can you please test it? Just replace the compiler builtin function with the following: __asm__ volatile ( ".long 0x0100000f" ::: "memory" );

            Actually I saw this failure while preparing https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/96 but I didn't think it was severe initially.

            I am now testing the fix in https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/108 and will post results in a couple of hours.

            otto Otto Kekäläinen added a comment - Actually I saw this failure while preparing https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/96 but I didn't think it was severe initially. I am now testing the fix in https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/108 and will post results in a couple of hours.

            otto, thank you. I see that also the later build failed because you tested a version of the pull request instead of how I suggested it to be revised. I believe that it is simplest to use the numeric encoding of the instruction on any version of clang or GCC. Today morning’s update of the pull request should work for your testing, since you’re using GCC 11 and the pull request is (currently) treating GCC 14 or later in a special way.

            marko Marko Mäkelä added a comment - otto , thank you. I see that also the later build failed because you tested a version of the pull request instead of how I suggested it to be revised. I believe that it is simplest to use the numeric encoding of the instruction on any version of clang or GCC. Today morning’s update of the pull request should work for your testing, since you’re using GCC 11 and the pull request is (currently) treating GCC 14 or later in a special way.

            I approved the community fix https://github.com/MariaDB/server/pull/3871 and otto tested it. Without this simple patch, the 10.6 branch would fail to build on RISC-V.

            marko Marko Mäkelä added a comment - I approved the community fix https://github.com/MariaDB/server/pull/3871 and otto tested it. Without this simple patch, the 10.6 branch would fail to build on RISC-V.

            People

              marko Marko Mäkelä
              otto Otto Kekäläinen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.