Hi everyone,


Recently I want to test MariaDB 10.1.9 on Linux on Power8.

But GCC will report following errors:

[ 52%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/api/api0api.cc.o
In file included from /root/mariadb-10.1.9/storage/innobase/include/ut0ut.h:36,
                 from /root/mariadb-10.1.9/storage/innobase/include/univ.i:636,
                 from /root/mariadb-10.1.9/storage/innobase/api/api0api.cc:27:
/root/mariadb-10.1.9/storage/innobase/include/os0sync.h:521:4: error: #error "Unsupported platform"
[ 52%] Building CXX object storage/archive/CMakeFiles/archive.dir/ha_archive.cc.o
In file included from /root/mariadb-10.1.9/storage/innobase/include/sync0sync.h:837,
                 from /root/mariadb-10.1.9/storage/innobase/include/mem0mem.h:34,
                 from /root/mariadb-10.1.9/storage/innobase/include/data0data.h:33,
                 from /root/mariadb-10.1.9/storage/innobase/include/que0que.h:30,
                 from /root/mariadb-10.1.9/storage/innobase/include/api0misc.h:32,
                 from /root/mariadb-10.1.9/storage/innobase/api/api0api.cc:38:
/root/mariadb-10.1.9/storage/innobase/include/sync0sync.ic: In function ‘lock_word_t ib_mutex_test_and_set(ib_mutex_t*)’:
/root/mariadb-10.1.9/storage/innobase/include/sync0sync.ic:85: error: ‘os_atomic_test_and_set’ was not declared in this scope
/root/mariadb-10.1.9/storage/innobase/include/sync0sync.ic: In function ‘void mutex_reset_lock_word(ib_mutex_t*)’:
/root/mariadb-10.1.9/storage/innobase/include/sync0sync.ic:113: error: ‘os_atomic_clear’ was not declared in this scope
make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/api/api0api.cc.o] Error 1
make[1]: *** [storage/innobase/CMakeFiles/innobase.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....


I found the problem is:

storage/innobase/include/sync0sync.ic
ib_mutex_test_and_set(
/*==================*/
        ib_mutex_t*     mutex)  /*!< in: mutex */
{
#if defined(HAVE_ATOMIC_BUILTINS)
        return(os_atomic_test_and_set(&mutex->lock_word));
#else

storage/innobase/include/os0sync.h
#if defined(__powerpc__) || defined(__aarch64__)
/*
  os_atomic_test_and_set_byte_release() should imply a release barrier before
  setting, and a full barrier after. But __sync_lock_test_and_set() is only
  documented as an aquire barrier. So on PowerPC we need to add the full
  barrier explicitly.  */
# define os_atomic_test_and_set_byte_release(ptr, new_val) \
        do { __sync_lock_release(ptr); \
             __sync_synchronize(); } while (0)
#else

Only  HAVE_IB_GCC_ATOMIC_TEST_AND_SET or IB_STRONG_MEMORY_MODEL will enable codes about os_atomic_test_and_set() and os_atomic_clear().

But on my Power8 environment, HAVE_ATOMIC_BUILTINS is defined, HAVE_IB_GCC_ATOMIC_TEST_AND_SET and IB_STRONG_MEMORY_MODEL are not defined.

So in sync0sync.ic, os_atomic_test_and_set() is used, but in os0sync.h, os_atomic_test_and_set() is not defined.


Does anybody know how to solve this problem?
I'm not familiar with Power.


Thanks,
Lixun

--
Staff Database Engineer @ Alibaba Cloud Computing
Oracle ACE for MySQL
Phone: +86 18658156856 (Hangzhou)
Blog: http://www.penglixun.com