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

Compile error with gcc-15 (signal returns)

Details

    Description

      Potential fix available at https://github.com/MariaDB/server/pull/3686

      Attachments

        Issue Links

          Activity

            there's a configure check for the correct signal handler return type. it doesn't work in your environment and we need to understand why.
            Here's how you can find it out:

            cmake # with whatever options you normally do it
            cmake -USIGNAL_RETURN_TYPE_IS_VOID --debug-trycompile
            cd CMakeFiles/CMakeScratch/TryCompile-*
            make
            

            the last line might look differently depending on your cmake version and your make tool

            serg Sergei Golubchik added a comment - there's a configure check for the correct signal handler return type. it doesn't work in your environment and we need to understand why. Here's how you can find it out: cmake # with whatever options you normally do it cmake -USIGNAL_RETURN_TYPE_IS_VOID --debug-trycompile cd CMakeFiles /CMakeScratch/TryCompile- * make the last line might look differently depending on your cmake version and your make tool
            heitbaum Rudi Heitbaum added a comment -

            I believe I was able to ascertain why the void check is failing. This from CMakeConfigureLog.yaml

                kind: "try_compile-v1"
                backtrace:
                  - "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/share/cmake-3.31/Modules/Internal/CheckSourceCompiles.cmake:108 (try_compile)"
                  - "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/share/cmake-3.31/Modules/CheckCSourceCompiles.cmake:58 (cmake_check_source_compiles)"
                  - "configure.cmake:678 (CHECK_C_SOURCE_COMPILES)"
                  - "CMakeLists.txt:396 (INCLUDE)"
                checks:
                  - "Performing Test SIGNAL_RETURN_TYPE_IS_VOID"
                directories:
                  source: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI"
                  binary: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI"
                cmakeVariables:
                  CMAKE_C_FLAGS: "-march=x86-64-v3 -Wall -pipe  -O2 -fomit-frame-pointer -DNDEBUG"
                  CMAKE_MODULE_PATH: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/cmake;/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/cmake/Internal/CPack"
                buildResult:
                  variable: "SIGNAL_RETURN_TYPE_IS_VOID"
                  cached: true
                  stdout: |
                    Change Dir: '/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI'
                    
                    Run Build Command(s): /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/ninja -v cmTC_7156c
                    [1/2] /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -DPACKAGE=test -DSIGNAL_RETURN_TYPE_IS_VOID -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -march=x86-64-v3 -Wall -pipe  -O2 -fomit-frame-pointer -DNDEBUG -o CMakeFiles/cmTC_7156c.dir/src.c.o -c /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI/src.c
                    FAILED: CMakeFiles/cmTC_7156c.dir/src.c.o 
                    /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -DPACKAGE=test -DSIGNAL_RETURN_TYPE_IS_VOID -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -march=x86-64-v3 -Wall -pipe  -O2 -fomit-frame-pointer -DNDEBUG -o CMakeFiles/cmTC_7156c.dir/src.c.o -c /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI/src.c
                    src.c:9:8: error: conflicting types for 'signal'; have 'void (*(void))(void)'
                        9 | void (*signal ()) ();
                          |        ^~~~~~
                    In file included from src.c:2:
                    /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/x86_64-libreelec-linux-gnu/sysroot/usr/include/signal.h:88:23: note: previous declaration of 'signal' with type 'void (*(int,  void (*)(int)))(int)'
                       88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
                          |                       ^~~~~~
                    ninja: build stopped: subcommand failed.
                    
                  exitCode: 1
            

            heitbaum Rudi Heitbaum added a comment - I believe I was able to ascertain why the void check is failing. This from CMakeConfigureLog.yaml kind: "try_compile-v1" backtrace: - "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/share/cmake-3.31/Modules/Internal/CheckSourceCompiles.cmake:108 (try_compile)" - "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/share/cmake-3.31/Modules/CheckCSourceCompiles.cmake:58 (cmake_check_source_compiles)" - "configure.cmake:678 (CHECK_C_SOURCE_COMPILES)" - "CMakeLists.txt:396 (INCLUDE)" checks: - "Performing Test SIGNAL_RETURN_TYPE_IS_VOID" directories: source: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI" binary: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI" cmakeVariables: CMAKE_C_FLAGS: "-march=x86-64-v3 -Wall -pipe -O2 -fomit-frame-pointer -DNDEBUG" CMAKE_MODULE_PATH: "/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/cmake;/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/cmake/Internal/CPack" buildResult: variable: "SIGNAL_RETURN_TYPE_IS_VOID" cached: true stdout: | Change Dir: '/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI' Run Build Command(s): /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/ninja -v cmTC_7156c [1/2] /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -DPACKAGE=test -DSIGNAL_RETURN_TYPE_IS_VOID -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -march=x86-64-v3 -Wall -pipe -O2 -fomit-frame-pointer -DNDEBUG -o CMakeFiles/cmTC_7156c.dir/src.c.o -c /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI/src.c FAILED: CMakeFiles/cmTC_7156c.dir/src.c.o /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -DPACKAGE=test -DSIGNAL_RETURN_TYPE_IS_VOID -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -march=x86-64-v3 -Wall -pipe -O2 -fomit-frame-pointer -DNDEBUG -o CMakeFiles/cmTC_7156c.dir/src.c.o -c /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/mariadb-11.4.4/.x86_64-libreelec-linux-gnu/CMakeFiles/CMakeScratch/TryCompile-RsDXgI/src.c src.c:9:8: error: conflicting types for 'signal'; have 'void (*(void))(void)' 9 | void (*signal ()) (); | ^~~~~~ In file included from src.c:2: /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/x86_64-libreelec-linux-gnu/sysroot/usr/include/signal.h:88:23: note: previous declaration of 'signal' with type 'void (*(int, void (*)(int)))(int)' 88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler) | ^~~~~~ ninja: build stopped: subcommand failed. exitCode: 1
            heitbaum Rudi Heitbaum added a comment -

            As a quick hack test, the following allowed a correct compile of mariadb with gcc-15

            --- mariadb-11.4.4/configure.cmake      2024-10-30 14:38:12.000000000 +0000
            +++ build/mariadb-11.4.4/configure.cmake      2024-12-10 14:58:29.378634217 +0000
            @@ -672,27 +672,8 @@
               SET(STACK_DIRECTION -1 CACHE INTERNAL "Stack grows direction")
             ENDIF()
             
            -#
            -# Check return type of signal handlers
            -#
            -CHECK_C_SOURCE_COMPILES("
            -#include <signal.h>
            -#ifdef signal
            -# undef signal
            -#endif
            -#ifdef __cplusplus
            -extern \"C\" void (*signal (int, void (*)(int)))(int);
            -#else
            -void (*signal ()) ();
            -#endif
            -int main(int ac, char **av) {}
            -" SIGNAL_RETURN_TYPE_IS_VOID)
            -IF(SIGNAL_RETURN_TYPE_IS_VOID)
               SET(RETSIGTYPE void)
               SET(VOID_SIGHANDLER 1)
            -ELSE(SIGNAL_RETURN_TYPE_IS_VOID)
            -  SET(RETSIGTYPE int)
            -ENDIF(SIGNAL_RETURN_TYPE_IS_VOID)
             
             
             CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
            

            heitbaum Rudi Heitbaum added a comment - As a quick hack test, the following allowed a correct compile of mariadb with gcc-15 --- mariadb-11.4.4/configure.cmake 2024-10-30 14:38:12.000000000 +0000 +++ build/mariadb-11.4.4/configure.cmake 2024-12-10 14:58:29.378634217 +0000 @@ -672,27 +672,8 @@ SET(STACK_DIRECTION -1 CACHE INTERNAL "Stack grows direction") ENDIF() -# -# Check return type of signal handlers -# -CHECK_C_SOURCE_COMPILES(" -#include <signal.h> -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern \"C\" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif -int main(int ac, char **av) {} -" SIGNAL_RETURN_TYPE_IS_VOID) -IF(SIGNAL_RETURN_TYPE_IS_VOID) SET(RETSIGTYPE void) SET(VOID_SIGHANDLER 1) -ELSE(SIGNAL_RETURN_TYPE_IS_VOID) - SET(RETSIGTYPE int) -ENDIF(SIGNAL_RETURN_TYPE_IS_VOID) CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)

            According to https://gcc.gnu.org/gcc-15/changes.html

            Note: GCC 15 has not been released yet, so this document is a work-in-progress.

            and I think it's too early to think about gcc-15 portability

            serg Sergei Golubchik added a comment - According to https://gcc.gnu.org/gcc-15/changes.html Note: GCC 15 has not been released yet, so this document is a work-in-progress. and I think it's too early to think about gcc-15 portability

            gcc-14 works fine. Let's wait for gcc-15 release. I couldn't find this change in behavior in the documentation or release notes, may be it's some debugging extra strictness that will go away in a release.

            serg Sergei Golubchik added a comment - gcc-14 works fine. Let's wait for gcc-15 release. I couldn't find this change in behavior in the documentation or release notes, may be it's some debugging extra strictness that will go away in a release.

            Indeed, even gcc-13 fails this with -std=c2x, while -std=c18 works.

            So the actual reason is the new stricter C standard. And supposedly MDEV-35606 will need a separate fix too.

            serg Sergei Golubchik added a comment - Indeed, even gcc-13 fails this with -std=c2x , while -std=c18 works. So the actual reason is the new stricter C standard. And supposedly MDEV-35606 will need a separate fix too.

            could you try this fix? it worked for me, but I didn't try gcc-15

            serg Sergei Golubchik added a comment - could you try this fix ? it worked for me, but I didn't try gcc-15

            People

              serg Sergei Golubchik
              heitbaum Rudi Heitbaum
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.