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

building MSAN -stdlib=libc++ test requires -fsanitize=memory

Details

    Description

      MDEV-34996 was incomplete it its testing of -stdlib=libc++ as this required -fsanitize=memory

      The MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory prior to MY_CHECK_CXX_COMPILER_FLAG("-stdlib=libc++") doesn't set the CMAKE_REQUIRED_FLAGS so results in:

      /source/CMakeLists.txt(249):  MY_CHECK_CXX_COMPILER_FLAG(-stdlib=libc++ )
      /source/cmake/check_compiler_flag.cmake(28):  STRING(REGEX REPLACE [-,= +] _ result have_CXX_-stdlib=libc++ )
      /source/cmake/check_compiler_flag.cmake(29):  SET(SAVE_CMAKE_REQUIRED_FLAGS  )
      /source/cmake/check_compiler_flag.cmake(30):  SET(CMAKE_REQUIRED_FLAGS  -stdlib=libc++ )
      /source/cmake/check_compiler_flag.cmake(31):  CHECK_CXX_SOURCE_COMPILES(int main(void) { return 0; } have_CXX__stdlib_libc__ FAIL_REGEX;argument unused during compilation;FAIL_REGEX;unsupported .*option;FAIL_REGEX;unknown .*option;FAIL_REGEX;unrecognized .*option;FAIL_REGEX;ignoring unknown option;FAIL_REGEX;warning:.*ignored;FAIL_REGEX;warning:.*is valid for.*but not for;FAIL_REGEX;warning:.*redefined;FAIL_REGEX;[Ww]arning: [Oo]ption )
      -- Performing Test have_CXX__stdlib_libc__
      -- Performing Test have_CXX__stdlib_libc__ - Failed
      /source/cmake/check_compiler_flag.cmake(33):  SET(CMAKE_REQUIRED_FLAGS  )
      /source/CMakeLists.txt(250):  IF(NOT have_CXX__stdlib_libc__ )
      /source/CMakeLists.txt(251):  MESSAGE(FATAL_ERROR C++ Compiler requires support for -stdlib=libc++ )
      CMake Error at CMakeLists.txt:251 (MESSAGE):
        C++ Compiler requires support for -stdlib=libc++
       
       
      -- Configuring incomplete, errors occurred!
      See also "/build/CMakeFiles/CMakeOutput.log".
      See also "/build/CMakeFiles/CMakeError.log".
      buildbot@2f11790aa1e1:/build$ rm -rf .ninja_*
      buildbot@2f11790aa1e1:/build$ tail -n 30 /build/CMakeFiles/CMakeError.log
      Change Dir: /build/CMakeFiles/CMakeScratch/TryCompile-RfQ4we
       
      Run Build Command(s):/usr/bin/ninja cmTC_2cfad && [1/2] Building CXX object CMakeFiles/cmTC_2cfad.dir/src.cxx.o
      [2/2] Linking CXX executable cmTC_2cfad
      FAILED: cmTC_2cfad 
      : && /usr/bin/clang++ -stdlib=libc++ -L/msan-libs -Wl,-rpath=/msan-libs CMakeFiles/cmTC_2cfad.dir/src.cxx.o -o cmTC_2cfad   && :
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_memset'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_retval_origin_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_unpoison'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_param_origin_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_memcpy'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_retval_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_va_arg_overflow_size_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_va_arg_origin_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__sanitizer_dtor_callback_fields'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_memmove'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_chain_origin'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__sanitizer_dtor_callback_vptr'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_va_arg_tls'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_warning_with_origin_noreturn'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_set_alloca_origin_with_descr'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_init'
      /usr/bin/ld: /msan-libs/libc++.so.1: undefined reference to `__msan_param_tls'
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      ninja: build stopped: subcommand failed.
      

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            adjusted per wlad's review - without CMP0066. compliler/linker flag changes where needed and adjusted commit message to be a bit more explicit why.

            I'm hoping justification for 10.6 is sufficient. I don't currently have push access there so if acceptable can you hit the merge on the PR wlad?
            If 10.5 is/was acceptable I'd take that too and simplify some upcoming msan BB changes with one less cmake argument.

            danblack Daniel Black added a comment - adjusted per wlad 's review - without CMP0066. compliler/linker flag changes where needed and adjusted commit message to be a bit more explicit why. I'm hoping justification for 10.6 is sufficient. I don't currently have push access there so if acceptable can you hit the merge on the PR wlad ? If 10.5 is/was acceptable I'd take that too and simplify some upcoming msan BB changes with one less cmake argument.

            I approved, but I can't merge either, there is no button, it says "merging is blocked" and "you are not authorized to push into that branch" in the web interface.

            wlad Vladislav Vaintroub added a comment - I approved, but I can't merge either, there is no button, it says "merging is blocked" and "you are not authorized to push into that branch" in the web interface.

            pushed

            serg Sergei Golubchik added a comment - pushed
            danblack Daniel Black added a comment -

            Thanks serg, wlad and marko

            danblack Daniel Black added a comment - Thanks serg , wlad and marko
            danblack Daniel Black added a comment -

            Affected AIX - configure change:

             -- Check if the system is big endian - big endian
             -- Mroonga doesn't support on big-endian
             -- Performing Test HAVE_PTHREAD_THREADID_NP
            --- Performing Test HAVE_PTHREAD_THREADID_NP - Failed
            +-- Performing Test HAVE_PTHREAD_THREADID_NP - Success
             -- Looking for gettid
             -- Looking for gettid - not found
             -- Performing Test HAVE_SYS_GETTID
             -- Performing Test HAVE_SYS_GETTID - Failed
             -- Performing Test HAVE_GETTHRID
            --- Performing Test HAVE_GETTHRID - Failed
            +-- Performing Test HAVE_GETTHRID - Success
             -- Performing Test HAVE_PTHREAD_GETTHREADID_NP
             -- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
             -- Performing Test HAVE_INTEGER_PTHREAD_SELF
            

            Resulted in:

            In file included from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/pfs.h:34,
                             from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/pfs_buffer_container.h:27,
                             from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/cursor_by_account.cc:30:
            /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/my_thread.h: In function 'my_thread_os_id_t my_thread_os_id()':
            /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/my_thread.h:64:3: error: 'pthread_threadid_np' was not declared in this scope
               64 |   pthread_threadid_np(nullptr, &tid64);
                  |   ^~~~~~~~~~~~~~~~~~~
            [ 48%] Linking CXX static library libfeedback
            

            danblack Daniel Black added a comment - Affected AIX - configure change: -- Check if the system is big endian - big endian -- Mroonga doesn't support on big-endian -- Performing Test HAVE_PTHREAD_THREADID_NP --- Performing Test HAVE_PTHREAD_THREADID_NP - Failed +-- Performing Test HAVE_PTHREAD_THREADID_NP - Success -- Looking for gettid -- Looking for gettid - not found -- Performing Test HAVE_SYS_GETTID -- Performing Test HAVE_SYS_GETTID - Failed -- Performing Test HAVE_GETTHRID --- Performing Test HAVE_GETTHRID - Failed +-- Performing Test HAVE_GETTHRID - Success -- Performing Test HAVE_PTHREAD_GETTHREADID_NP -- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed -- Performing Test HAVE_INTEGER_PTHREAD_SELF Resulted in: In file included from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/pfs.h:34, from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/pfs_buffer_container.h:27, from /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/cursor_by_account.cc:30: /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/my_thread.h: In function 'my_thread_os_id_t my_thread_os_id()': /home/buildbot/ppc64be-aix-71/build/mariadb-10.6.22/storage/perfschema/my_thread.h:64:3: error: 'pthread_threadid_np' was not declared in this scope 64 | pthread_threadid_np(nullptr, &tid64); | ^~~~~~~~~~~~~~~~~~~ [ 48%] Linking CXX static library libfeedback

            People

              danblack Daniel Black
              danblack Daniel Black
              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.