美文网首页
交叉编译arm64版mysql(5.6.51)

交叉编译arm64版mysql(5.6.51)

作者: 叶迎宪 | 来源:发表于2022-02-09 15:54 被阅读0次

    步骤跟5.6.34是类似的,这里只记录新出现的问题

    报错 /home/3536_cross_src/mysql-5.6.51-arm/storage/innobase/fts/fts0fts.cc:4079:57: error: ‘os_atomic_increment_ulint’ was not declared in this scope

    os_atomic_increment_ulint的定义位于 storage/innobase/include/os0sync.h

    #if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
    ...
    #else
    # define IB_ATOMICS_STARTUP_MSG \
        "Mutexes and rw_locks use InnoDB's own implementation"
    #endif
    #ifdef HAVE_ATOMIC_BUILTINS
    #define os_atomic_inc_ulint(m,v,d)  os_atomic_increment_ulint(v, d)
    #define os_atomic_dec_ulint(m,v,d)  os_atomic_decrement_ulint(v, d)
    #else
    #define os_atomic_inc_ulint(m,v,d)  os_atomic_inc_ulint_func(m, v, d)
    #define os_atomic_dec_ulint(m,v,d)  os_atomic_dec_ulint_func(m, v, d)
    #endif /* HAVE_ATOMIC_BUILTINS */
    

    而决定宏HAVE_IB_GCC_ATOMIC_BUILTINS是否定义,位于 storage/innobase/CMakeLists.txt

    IF(NOT CMAKE_CROSSCOMPILING)
      CHECK_C_SOURCE_RUNS(
      "
      int main()
      {
        long        x;
        long        y;
        long        res;
    
        x = 10;
        y = 123;
        res = __sync_bool_compare_and_swap(&x, x, y);
        if (!res || x != y) {
          return(1);
        }
    
        x = 10;
        y = 123;
        res = __sync_bool_compare_and_swap(&x, x + 1, y);
        if (res || x != 10) {
          return(1);
        }
        x = 10;
        y = 123;
        res = __sync_add_and_fetch(&x, y);
        if (res != 123 + 10 || x != 123 + 10) {
          return(1);
        }
        return(0);
      }"
      HAVE_IB_GCC_ATOMIC_BUILTINS
      )
    

    由于是交叉编译,因此这段测试程序不会被运行,因此宏也不会被定义。
    解决方案,把
    IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
    ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
    ENDIF()
    IF(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
    ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_TEST_AND_SET=1)
    ENDIF()
    都改为 IF(1)

    相关文章

      网友评论

          本文标题:交叉编译arm64版mysql(5.6.51)

          本文链接:https://www.haomeiwen.com/subject/oaewkrtx.html